Skip to content

Commit

Permalink
feat: add more routes to chain adapters (#112)
Browse files Browse the repository at this point in the history
* add more routes to chain adapters

* Add moonriver adapter
  • Loading branch information
samchuk-vlad committed Feb 11, 2024
1 parent 33ff499 commit a7211fe
Show file tree
Hide file tree
Showing 10 changed files with 594 additions and 28 deletions.
7 changes: 7 additions & 0 deletions src/adapters/acala/acala-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export const acalaRouteConfigs = createRouteConfigs("acala", [
fee: { token: "ACA", amount: "1920000000" },
},
},
{
to: "parallel",
token: "AUSD",
xcm: {
fee: { token: "AUSD", amount: "700000" },
},
},
{
to: "parallel",
token: "LDOT",
Expand Down
21 changes: 21 additions & 0 deletions src/adapters/acala/karura-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ export const karuraRouteConfigs = createRouteConfigs("karura", [
fee: { token: "BNC", amount: "5120000000" },
},
},
{
to: "bifrost",
token: "KSM",
xcm: {
fee: { token: "KSM", amount: "5120000000" },
},
},
{
to: "bifrost",
token: "KAR",
Expand Down Expand Up @@ -184,6 +191,13 @@ export const karuraRouteConfigs = createRouteConfigs("karura", [
fee: { token: "KUSD", amount: "320000000000" },
},
},
{
to: "calamari",
token: "KSM",
xcm: {
fee: { token: "KSM", amount: "100000000000" },
},
},
{
to: "calamari",
token: "KMA",
Expand Down Expand Up @@ -254,6 +268,13 @@ export const karuraRouteConfigs = createRouteConfigs("karura", [
fee: { token: "LKSM", amount: "48000000" },
},
},
{
to: "heiko",
token: "KUSD",
xcm: {
fee: { token: "KUSD", amount: "48000000" },
},
},
{
to: "pichiu",
token: "PCHU",
Expand Down
35 changes: 33 additions & 2 deletions src/adapters/astar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
validateAddress,
createRouteConfigs,
getDestAccountInfo,
createXTokensAssetsParam,
createXTokensDestParam,
} from "../utils";

type TokenData = ExtendedToken & { toQuery: () => string };
Expand Down Expand Up @@ -60,6 +62,14 @@ export const astarRouteConfigs = createRouteConfigs("astar", [
weightLimit: "Unlimited",
},
},
{
to: "statemint",
token: "USDT",
xcm: {
fee: { token: "USDT", amount: "44306118000000000" },
weightLimit: "Unlimited",
},
},
]);

export const shidenRouteConfigs = createRouteConfigs("shiden", [
Expand Down Expand Up @@ -107,13 +117,21 @@ export const astarTokensConfig: Record<string, Record<string, TokenData>> = {
"0x0001000000000000000000000000000000000000000000000000000000000000",
toQuery: () => "18446744073709551617",
},
USDT: {
name: "USDT",
symbol: "USDT",
decimals: 6,
ed: "1",
toRaw: () =>
"0x0001000000000000000000000000000000000000000000000000000000000000", // TODO: update
toQuery: () => "4294969280",
},
LDOT: {
name: "LDOT",
symbol: "LDOT",
decimals: 10,
ed: "1",
toRaw: () =>
"0x0003000000000000000000000000000000000000000000000000000000000000",
toRaw: () => "1984",
toQuery: () => "18446744073709551618",
},
},
Expand Down Expand Up @@ -323,6 +341,19 @@ class BaseAstarAdapter extends BaseCrossChainAdapter {

const tokenData: TokenData = this.getToken(params.token);

if (tokenData.symbol === "USDT") {
return this.api.tx.xTokens.transferMultiasset(
createXTokensAssetsParam(
this.api,
toChain.paraChainId,
tokenData.toRaw(),
amount.toChainData()
),
createXTokensDestParam(this.api, toChain.paraChainId, accountId) as any,
"Unlimited"
);
}

return this.api.tx.xTokens.transferMultiasset(
{
V3: {
Expand Down
17 changes: 17 additions & 0 deletions src/adapters/hydradx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ export const hydradxRoutersConfig = createRouteConfigs("hydradx", [
fee: { token: "DOT", amount: "469417452" },
},
},
{
to: "subsocial",
token: "SUB",
xcm: {
fee: {
token: "SUB",
amount: "63199000",
},
},
},
{
to: "acala",
token: "DAI",
Expand Down Expand Up @@ -267,6 +277,13 @@ export const hydradxTokensConfig: Record<string, ExtendedToken> = {
ed: "36",
toRaw: () => 11,
},
SUB: {
name: "SUB",
symbol: "SUB",
decimals: 10,
ed: "100000000",
toRaw: () => 24,
},
DOT: {
name: "DOT",
symbol: "DOT",
Expand Down
12 changes: 12 additions & 0 deletions src/adapters/interlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export const interlayRouteConfigs = createRouteConfigs("interlay", [
token: "IBTC",
xcm: { fee: { token: "IBTC", amount: "9" } },
},
{
to: "statemint",
token: "USDT",
xcm: { fee: { token: "USDT", amount: "9" } },
},
{
to: "hydradx",
token: "IBTC",
Expand Down Expand Up @@ -77,6 +82,13 @@ export const interlayTokensConfig: Record<
ed: "0",
toRaw: () => ({ Token: "IBTC" }),
},
USDT: {
name: "USDT",
symbol: "USDT",
decimals: 6,
ed: "0",
toRaw: () => ({ Token: "USDT" }),
},
},
kintsugi: {
KINT: {
Expand Down
Loading

0 comments on commit a7211fe

Please sign in to comment.