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 HDX routes #191

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ All channels support transfers in both directions.
| parallel | INTR IBTC |
| polkadot | DOT |
| polkadot asset hub | USDT |
| hydradx | IBTC |
| hydradx | HDX IBTC |

#### Kintsugi:

Expand Down
5 changes: 5 additions & 0 deletions scripts/configs/interlay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ import-storage:
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice, usdc
- foreignAsset: 12
- free: '1000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice, hdx
- foreignAsset: 13
- free: '1000000000000000'
9 changes: 9 additions & 0 deletions src/adapters/hydradx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import { xTokensHelper } from "../utils/xtokens-helper";
const DEST_WEIGHT = "Unlimited";

export const hydraRoutersConfig: Omit<CrossChainRouterConfigs, "from">[] = [
{
to: "interlay",
token: "HDX",
xcm: {
// recent transfer cost: 405_777_777_777 - 5x margin for fee estimate
fee: { token: "HDX", amount: "1000000000000" },
weightLimit: DEST_WEIGHT,
},
},
{
to: "interlay",
token: "IBTC",
Expand Down
11 changes: 11 additions & 0 deletions src/adapters/interlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ export const interlayRoutersConfig: Omit<CrossChainRouterConfigs, "from">[] = [
weightLimit: DEST_WEIGHT,
},
},
{
to: "hydra",
token: "HDX",
// from recent transfer: 80_376_806_468 - add 5x safety margin
xcm: {
fee: { token: "HDX", amount: "400000000000" },
weightLimit: DEST_WEIGHT,
},
},
// {
// to: "hydra",
// token: "USDC",
Expand Down Expand Up @@ -222,6 +231,7 @@ export const interlayTokensConfig: Record<
USDT: { name: "USDT", symbol: "USDT", decimals: 6, ed: "0" },
VDOT: { name: "VDOT", symbol: "VDOT", decimals: 10, ed: "0" },
BNC: { name: "BNC", symbol: "BNC", decimals: 12, ed: "0" },
HDX: { name: "HDX", symbol: "HDX", decimals: 12, ed: "0" },
},
kintsugi: {
KBTC: { name: "KBTC", symbol: "KBTC", decimals: 8, ed: "0" },
Expand Down Expand Up @@ -250,6 +260,7 @@ const INTERLAY_SUPPORTED_TOKENS: Record<string, unknown> = {
VDOT: { ForeignAsset: 3 },
BNC: { ForeignAsset: 11 },
USDC: { ForeignAsset: 12 },
HDX: { ForeignAsset: 13 },
};

const getSupportedTokens = (chainname: string): Record<string, unknown> => {
Expand Down