Skip to content

Commit

Permalink
Merge pull request #190 from interlay/feat-add-bnc-and-hdx
Browse files Browse the repository at this point in the history
Feat: Add routes for BNC
  • Loading branch information
bvotteler authored Apr 19, 2024
2 parents 3818f4b + 022100e commit be311a4
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ All channels support transfers in both directions.
| ------------------ | --------- |
| acala | INTR IBTC |
| astar | INTR IBTC |
| bifrost | VDOT |
| bifrost | BNC VDOT |
| parallel | INTR IBTC |
| polkadot | DOT |
| polkadot asset hub | USDT |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interlay/bridge",
"version": "0.5.1",
"version": "0.5.2",
"description": "polkawallet bridge sdk",
"main": "build/index.js",
"typings": "build/index.d.ts",
Expand Down
8 changes: 7 additions & 1 deletion scripts/configs/bifrost-polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import-storage:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
- providers: 1
data:
free: '1000000000000000'
-
-
- 5Eg2fntQS1bgCgPtXQ9Ysip6RUQkQJEMZqZ9u9qX6fcnhB4H # sibl 2032 (interlay sov)
- providers: 1
data:
free: '1000000000000000'
Expand Down
5 changes: 5 additions & 0 deletions scripts/configs/interlay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ import-storage:
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice, vdot
- foreignAsset: 3
- free: '100000000000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice, bnc
- foreignAsset: 11
- free: '1000000000000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice, usdc
Expand Down
17 changes: 15 additions & 2 deletions src/adapters/bifrost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,34 @@ export const bifrostPolkadotRoutersConfig: Omit<
weightLimit: DEST_WEIGHT,
},
},
{
to: "interlay",
token: "BNC",
xcm: {
// chopsticks test value: 48_800_000_000, add buffer
fee: { token: "BNC", amount: "500000000000" },
weightLimit: DEST_WEIGHT,
},
},
];

export const bifrostKusamaTokensConfig: Record<string, BasicToken> = {
BNC: { name: "BNC", symbol: "BNC", decimals: 12, ed: "10000000000" },
VKSM: { name: "VKSM", symbol: "VKSM", decimals: 12, ed: "100000000" },
};

export const bifrostPolkadotTokensConfig: Record<string, BasicToken> = {
BNC: { name: "BNC", symbol: "BNC", decimals: 12, ed: "10000000000" },
VDOT: { name: "VDOT", symbol: "VDOT", decimals: 10, ed: "1000000" },
};

const SUPPORTED_KUSAMA_TOKENS: Record<string, unknown> = {
BNC: { Native: "BNC" },
VKSM: { VToken: "KSM" },
};

const SUPPORTED_POLKADOT_TOKENS: Record<string, unknown> = {
BNC: { Native: "BNC" },
VDOT: { VToken2: 0 },
};

Expand Down Expand Up @@ -107,10 +120,10 @@ class BifrostBalanceAdapter extends BalanceAdapter {
return storage.observable.pipe(
map(({ data }) => ({
free: FN.fromInner(data.free.toString(), this.decimals),
locked: FN.fromInner(data.miscFrozen.toString(), this.decimals),
locked: FN.fromInner(data.frozen.toString(), this.decimals),
reserved: FN.fromInner(data.reserved.toString(), this.decimals),
available: FN.fromInner(
data.free.sub(data.miscFrozen).toString(),
data.free.sub(data.frozen).toString(),
this.decimals
),
}))
Expand Down
11 changes: 11 additions & 0 deletions src/adapters/interlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ export const interlayRoutersConfig: Omit<CrossChainRouterConfigs, "from">[] = [
weightLimit: DEST_WEIGHT,
},
},
{
to: "bifrost_polkadot",
token: "BNC",
xcm: {
// chopsticks test value: 514_368_000, add buffer
fee: { token: "BNC", amount: "5000000000" },
weightLimit: DEST_WEIGHT,
},
},
];

export const kintsugiRoutersConfig: Omit<CrossChainRouterConfigs, "from">[] = [
Expand Down Expand Up @@ -212,6 +221,7 @@ export const interlayTokensConfig: Record<
USDC: { name: "USDC", symbol: "USDC", decimals: 6, ed: "0" },
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" },
},
kintsugi: {
KBTC: { name: "KBTC", symbol: "KBTC", decimals: 8, ed: "0" },
Expand All @@ -238,6 +248,7 @@ const INTERLAY_SUPPORTED_TOKENS: Record<string, unknown> = {
INTR: { Token: "INTR" },
USDT: { ForeignAsset: 2 },
VDOT: { ForeignAsset: 3 },
BNC: { ForeignAsset: 11 },
USDC: { ForeignAsset: 12 },
};

Expand Down

0 comments on commit be311a4

Please sign in to comment.