From d0ac65617b5778b700c88339fdc9bcbb8ea96c36 Mon Sep 17 00:00:00 2001 From: Brendon Votteler Date: Wed, 31 Jul 2024 11:21:43 +0200 Subject: [PATCH] chore: adjust phala fees and chopsticks configs --- scripts/configs/interlay.yml | 5 +++++ src/adapters/interlay.ts | 10 +++++----- src/adapters/phala.ts | 12 ++++++------ src/bridge.spec.ts | 10 ++++++++-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/scripts/configs/interlay.yml b/scripts/configs/interlay.yml index e77801a8..98e486d6 100644 --- a/scripts/configs/interlay.yml +++ b/scripts/configs/interlay.yml @@ -49,3 +49,8 @@ import-storage: - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice, hdx - foreignAsset: 13 - free: '1000000000000000' + - + - + - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice, pha + - foreignAsset: 14 + - free: '1000000000000000' diff --git a/src/adapters/interlay.ts b/src/adapters/interlay.ts index 113a4fdd..361d57d3 100644 --- a/src/adapters/interlay.ts +++ b/src/adapters/interlay.ts @@ -69,8 +69,8 @@ export const interlayRoutersConfig: Omit[] = [ to: "phala", token: "PHA", xcm: { - // TODO: get chopsticks test data - fee: { token: "PHA", amount: "101200000000" }, + // chopsticks test data: 2_810_000_095, use ~10x buffer + fee: { token: "PHA", amount: "28000000000" }, weightLimit: DEST_WEIGHT, }, }, @@ -78,8 +78,8 @@ export const interlayRoutersConfig: Omit[] = [ to: "phala", token: "INTR", xcm: { - // TODO: get chopsticks test data: fee = 6_535_947_712 Add 10x margin - fee: { token: "INTR", amount: "65359477120" }, + // chopsticks test data: fee = 642_960_000, use ~10x buffer + fee: { token: "INTR", amount: "6400000000" }, weightLimit: DEST_WEIGHT, }, }, @@ -87,7 +87,7 @@ export const interlayRoutersConfig: Omit[] = [ to: "phala", token: "IBTC", xcm: { - // chopsticks test: fee = 6429600. Add ~3x margin + // chopsticks test: fee = 6429600. Use ~3x buffer fee: { token: "IBTC", amount: "20000000" }, weightLimit: DEST_WEIGHT }, diff --git a/src/adapters/phala.ts b/src/adapters/phala.ts index 4032f7cc..31cc0b42 100644 --- a/src/adapters/phala.ts +++ b/src/adapters/phala.ts @@ -25,8 +25,8 @@ export const phalaRoutersConfig: Omit[] = [ to: "interlay", token: "PHA", xcm: { - // TODO: confirm via chopsticks test - fee: { token: "PHA", amount: "1016604720" }, + // TODO: confirm via chopsticks test, best guess: 8_000_0000_000_000 + fee: { token: "PHA", amount: "5000000000000000" }, weightLimit: DEST_WEIGHT, }, }, @@ -34,8 +34,8 @@ export const phalaRoutersConfig: Omit[] = [ to: "interlay", token: "IBTC", xcm: { - // during chopsticks test: fee = 71 Add 10x margin - fee: { token: "IBTC", amount: "710" }, + // during chopsticks test: fee = 63, use ~10x buffer + fee: { token: "IBTC", amount: "600" }, weightLimit: DEST_WEIGHT, }, }, @@ -43,8 +43,8 @@ export const phalaRoutersConfig: Omit[] = [ to: "interlay", token: "INTR", xcm: { - // during chopsticks test: fee = 21_660_472 Add 10x margin - fee: { token: "INTR", amount: "216604720" }, + // during chopsticks test: fee = 19_213_457, use ~10x buffer + fee: { token: "INTR", amount: "200000000" }, weightLimit: DEST_WEIGHT, }, }, diff --git a/src/bridge.spec.ts b/src/bridge.spec.ts index 5e957385..a30ac446 100644 --- a/src/bridge.spec.ts +++ b/src/bridge.spec.ts @@ -13,6 +13,7 @@ import { AcalaAdapter, KaruraAdapter } from "./adapters/acala"; import { BifrostKusamaAdapter, BifrostPolkadotAdapter } from "./adapters/bifrost"; import { HydraAdapter } from "./adapters/hydradx"; import { AstarAdapter } from "./adapters/astar"; +import { PhalaAdapter } from "./adapters/phala"; describe.skip("Bridge sdk usage", () => { jest.setTimeout(30000); @@ -34,6 +35,7 @@ describe.skip("Bridge sdk usage", () => { hydra: new HydraAdapter(), parallel: new ParallelAdapter(), astar: new AstarAdapter(), + phala: new PhalaAdapter(), }; const bridge = new Bridge({ @@ -183,6 +185,9 @@ describe.skip("Bridge sdk usage", () => { // interlay // printBidirectionalTxs("interlay", "polkadot", "DOT"); + printBidirectionalTxs("interlay", "phala", "PHA"); + printBidirectionalTxs("interlay", "phala", "INTR"); + printBidirectionalTxs("interlay", "phala", "IBTC"); // printBidirectionalTxs("interlay", "statemint", "USDT"); // printBidirectionalTxs("interlay", "hydra", "IBTC"); // printBidirectionalTxs("interlay", "hydra", "INTR"); @@ -192,11 +197,11 @@ describe.skip("Bridge sdk usage", () => { // printBidirectionalTxs("interlay", "parallel", "IBTC"); // printBidirectionalTxs("interlay", "astar", "INTR"); // printBidirectionalTxs("interlay", "astar", "IBTC"); - printBidirectionalTxs("interlay", "bifrost_polkadot", "VDOT"); + // printBidirectionalTxs("interlay", "bifrost_polkadot", "VDOT"); // printBidirectionalTxs("polkadot", "statemint", "DOT"); }); - test("5. getNativeToken should work", () => { + test.skip("5. getNativeToken should work", () => { const testCases: [ChainName, String][] = [ // kusama network ["kusama", "KSM"], @@ -213,6 +218,7 @@ describe.skip("Bridge sdk usage", () => { ["parallel", "PARA"], ["bifrost_polkadot", "BNC"], ["statemint", "DOT"], + ["phala", "PHA"], ]; for (const [chainName, expectedNativeToken] of testCases) {