Skip to content

Commit

Permalink
feat: added minBridgeAmount for Astar
Browse files Browse the repository at this point in the history
  • Loading branch information
ap211unitech committed Jun 7, 2024
1 parent 2af4a42 commit 25e5533
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/thea/src/config/substrate/config/astar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const toPolkadex: AssetConfig[] = [
balance: BalanceBuilder().substrate().assets().account(),
destination: polkadex,
destinationFee: {
amount: 0.1,
amount: 0.05,
asset: dot,
balance: BalanceBuilder().substrate().system().account(),
},
Expand Down Expand Up @@ -61,7 +61,7 @@ const toPolkadex: AssetConfig[] = [
balance: BalanceBuilder().substrate().assets().account(),
destination: polkadex,
destinationFee: {
amount: 0.1,
amount: 0,
asset: unq,
balance: BalanceBuilder().substrate().assets().account(),
},
Expand All @@ -78,7 +78,7 @@ const toPolkadex: AssetConfig[] = [
balance: BalanceBuilder().substrate().assets().account(),
destination: polkadex,
destinationFee: {
amount: 0.2,
amount: 0.1,
asset: pha,
balance: BalanceBuilder().substrate().assets().account(),
},
Expand Down Expand Up @@ -129,7 +129,7 @@ const toPolkadex: AssetConfig[] = [
balance: BalanceBuilder().substrate().assets().account(),
destination: polkadex,
destinationFee: {
amount: 0.000003,
amount: 0.00000063,
asset: ibtc,
balance: BalanceBuilder().substrate().assets().account(),
},
Expand Down
14 changes: 14 additions & 0 deletions packages/thea/src/config/substrate/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ const Interlay: Config = {
},
};

const Astar: Config = {
Polkadex: {
ASTR: 0.01,
DOT: 0.1,
GLMR: 0.15,
UNQ: 0.1,
PHA: 0.2,
IBTC: 0.000003,
BNC: 0.1,
vDOT: 0.1,
},
};

export const MIN_BRIDGE_AMOUNT: Record<string, Config> = {
Interlay,
Astar,
};
11 changes: 8 additions & 3 deletions packages/thea/src/sdk/substrate/astar.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 Astar 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 25e5533

Please sign in to comment.