Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add/update Interlay and Kintsugi routes #121

Merged
merged 7 commits into from
Mar 14, 2024
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ dist

# TernJS port file
.tern-port

# VSCode
.vscode
2 changes: 1 addition & 1 deletion src/adapters/acala/acala-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const acalaRouteConfigs = createRouteConfigs("acala", [
to: "interlay",
token: "INTR",
xcm: {
fee: { token: "INTR", amount: "19000000" },
fee: { token: "INTR", amount: "20000000" },
},
},
{
Expand Down
18 changes: 17 additions & 1 deletion src/adapters/assethub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ export const assetHubPolkadotRouteConfigs = createRouteConfigs(
to: "interlay",
token: "USDT",
xcm: {
fee: { token: "USDT", amount: "808" },
fee: { token: "USDT", amount: "25000" },
weightLimit: "Unlimited",
},
},
{
to: "interlay",
token: "USDC",
xcm: {
fee: { token: "USDC", amount: "25000" },
weightLimit: "Unlimited",
},
},
Expand Down Expand Up @@ -126,6 +134,14 @@ export const assetHubKusamaRouteConfigs = createRouteConfigs("assetHubKusama", [
token: "USDT",
xcm: { fee: { token: "USDT", amount: "808" }, weightLimit: "Unlimited" },
},
{
to: "kintsugi",
token: "USDT",
xcm: {
fee: { token: "USDT", amount: "20000" },
weightLimit: "Unlimited",
},
},
]);

export const assetHubPolkadotTokensConfig: Record<string, ExtendedToken> = {
Expand Down
34 changes: 34 additions & 0 deletions src/adapters/astar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ export const astarRouteConfigs = createRouteConfigs("astar", [
weightLimit: "Unlimited",
},
},
{
to: "interlay",
token: "IBTC",
xcm: {
fee: { token: "IBTC", amount: "75" },
weightLimit: "Unlimited",
},
},
{
to: "interlay",
token: "INTR",
xcm: {
fee: { token: "INTR", amount: "20000000" },
weightLimit: "Unlimited",
},
},
]);

export const shidenRouteConfigs = createRouteConfigs("shiden", [
Expand Down Expand Up @@ -134,6 +150,24 @@ export const astarTokensConfig: Record<string, Record<string, TokenData>> = {
toRaw: () => "1984",
toQuery: () => "18446744073709551618",
},
IBTC: {
name: "IBTC",
symbol: "IBTC",
decimals: 8,
ed: "1",
toRaw: () =>
"0x0001000000000000000000000000000000000000000000000000000000000000",
toQuery: () => "18446744073709551620",
},
INTR: {
name: "INTR",
symbol: "INTR",
decimals: 10,
ed: "1",
toRaw: () =>
"0x0002000000000000000000000000000000000000000000000000000000000000",
toQuery: () => "18446744073709551621",
},
},
shiden: {
SDN: {
Expand Down
62 changes: 58 additions & 4 deletions src/adapters/bifrost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ApiNotFound, InvalidAddress, TokenNotFound } from "../errors";
import { BalanceData, ExtendedToken, TransferParams } from "../types";
import { createRouteConfigs, validateAddress } from "../utils";

export const bifrostRouteConfigs = createRouteConfigs("bifrost", [
export const bifrostKusamaRouteConfigs = createRouteConfigs("bifrost", [
{
to: "karura",
token: "BNC",
Expand Down Expand Up @@ -48,9 +48,29 @@ export const bifrostRouteConfigs = createRouteConfigs("bifrost", [
fee: { token: "KUSD", amount: "10011896008" },
},
},
{
to: "kintsugi",
token: "VKSM",
xcm: {
fee: { token: "VKSM", amount: "175000000" },
},
},
]);

export const bifrostTokensConfig: Record<string, ExtendedToken> = {
export const bifrostPolkadotRoutersConfig = createRouteConfigs(
"bifrostPolkadot",
[
{
to: "interlay",
token: "VDOT",
xcm: {
fee: { token: "VDOT", amount: "20000000" },
},
},
]
);

export const bifrostKusamaTokensConfig: Record<string, ExtendedToken> = {
BNC: {
name: "BNC",
symbol: "BNC",
Expand Down Expand Up @@ -86,6 +106,30 @@ export const bifrostTokensConfig: Record<string, ExtendedToken> = {
ed: "100000000",
toRaw: () => ({ Stable: "KUSD" }),
},
VKSM: {
name: "VKSM",
symbol: "VKSM",
decimals: 12,
ed: "100000000",
toRaw: () => ({ VToken: "KSM" }),
},
};

export const bifrostPolkadotTokensConfig: Record<string, ExtendedToken> = {
BNC: {
name: "BNC",
symbol: "BNC",
decimals: 12,
ed: "10000000000",
toRaw: () => ({ Native: "BNC" }),
},
VDOT: {
name: "VDOT",
symbol: "VDOT",
decimals: 10,
ed: "1000000",
toRaw: () => ({ VToken2: 0 }),
},
};

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
Expand Down Expand Up @@ -168,7 +212,7 @@ class BaseBifrostAdapter extends BaseCrossChainAdapter {
this.balanceAdapter = new BifrostBalanceAdapter({
chain: this.chain.id as ChainId,
api,
tokens: bifrostTokensConfig,
tokens: bifrostKusamaTokensConfig,
});
}

Expand Down Expand Up @@ -233,6 +277,16 @@ class BaseBifrostAdapter extends BaseCrossChainAdapter {

export class BifrostAdapter extends BaseBifrostAdapter {
constructor() {
super(chains.bifrost, bifrostRouteConfigs, bifrostTokensConfig);
super(chains.bifrost, bifrostKusamaRouteConfigs, bifrostKusamaTokensConfig);
}
}

export class BifrostPolkadotAdapter extends BaseBifrostAdapter {
constructor() {
super(
chains.bifrostPolkadot,
bifrostPolkadotRoutersConfig,
bifrostPolkadotTokensConfig
);
}
}
14 changes: 14 additions & 0 deletions src/adapters/hydradx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ export const hydradxRoutersConfig = createRouteConfigs("hydradx", [
token: "IBTC",
xcm: { fee: { token: "IBTC", amount: "62" } },
},
{
to: "interlay",
token: "INTR",
xcm: {
fee: { token: "INTR", amount: "20000000" },
},
},
{
to: "assetHubPolkadot",
token: "USDT",
Expand Down Expand Up @@ -280,6 +287,13 @@ export const hydradxTokensConfig: Record<string, ExtendedToken> = {
ed: "36",
toRaw: () => 11,
},
INTR: {
name: "INTR",
symbol: "INTR",
decimals: 10,
ed: "6164274209",
toRaw: () => 17,
},
SUB: {
name: "SUB",
symbol: "SUB",
Expand Down
Loading
Loading