Skip to content

Commit

Permalink
feat: added minBridgeAmount for Interlay
Browse files Browse the repository at this point in the history
  • Loading branch information
ap211unitech committed Jun 7, 2024
1 parent 47f1662 commit 2af4a42
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/thea/src/config/substrate/config/interlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const toPolkadex: AssetConfig[] = [
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: polkadex,
destinationFee: {
amount: 0.1,
amount: 0.06,
asset: dot,
balance: BalanceBuilder().substrate().assets().account(),
},
Expand Down Expand Up @@ -75,7 +75,7 @@ const toPolkadex: AssetConfig[] = [
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: polkadex,
destinationFee: {
amount: 0.00000008,
amount: 0.00000007,
asset: vdot,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
Expand Down
19 changes: 19 additions & 0 deletions packages/thea/src/config/substrate/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Note - We are configuring minimum amount for a cross-chain transfer here as @moonbeam/sdk doesn't support it natively.

// Note - Ensure that the Chain and Asset ticker match the definitions provided in the configurations.

type Config = Record<string, Record<string, number>>;

const Interlay: Config = {
Polkadex: {
IBTC: 0.0000001,
DOT: 0.1,
GLMR: 0.1,
BNC: 0.01,
vDOT: 0.0001,
},
};

export const MIN_BRIDGE_AMOUNT: Record<string, Config> = {
Interlay,
};
1 change: 1 addition & 0 deletions packages/thea/src/config/substrate/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./config";
export * from "./constants";
export * from "./chains";
export * from "./assets";
export * from "./helpers";
11 changes: 8 additions & 3 deletions packages/thea/src/sdk/substrate/interlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
chainsMap,
getSubstrateChain,
getSubstrateAsset,
MIN_BRIDGE_AMOUNT,
} from "../../config";
import { AssetAmount, BaseChainAdapter, TransferConfig } from "../types";

Expand Down Expand Up @@ -102,9 +103,13 @@ export class Interlay implements BaseChainAdapter {

const min: AssetAmount = {
ticker: transferConfig.source.min.originSymbol,
amount: +Utils.formatUnits(
transferConfig.source.min.amount,
transferConfig.source.min.decimals
amount: Math.max(
MIN_BRIDGE_AMOUNT[this.chain.name]?.[destChain.name]?.[asset.ticker] ||
0,
+Utils.formatUnits(
transferConfig.source.min.amount,
transferConfig.source.min.decimals
)
),
};

Expand Down

0 comments on commit 2af4a42

Please sign in to comment.