Skip to content

Commit

Permalink
Moved fee balance on source chain to source.destinationFee.balance
Browse files Browse the repository at this point in the history
  • Loading branch information
ekenigs committed Aug 30, 2024
1 parent 8287796 commit 31e609f
Show file tree
Hide file tree
Showing 51 changed files with 734 additions and 252 deletions.
8 changes: 6 additions & 2 deletions packages/config/src/types/AssetRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
FeeConfigBuilder,
MrlConfigBuilder,
} from '@moonbeam-network/xcm-builder';
import type { AnyChain, Asset } from '@moonbeam-network/xcm-types';
import type { AnyChain, Asset, SetOptional } from '@moonbeam-network/xcm-types';

export interface AssetRouteConstructorParams {
asset: Asset;
Expand All @@ -21,6 +21,9 @@ export interface SourceConfig {
chain: AnyChain;
balance: BalanceConfigBuilder;
fee?: FeeConfig;
destinationFee?: {
balance: BalanceConfigBuilder;
};
min?: AssetMinConfigBuilder;
}

Expand All @@ -36,7 +39,8 @@ export interface FeeConfig {
extra?: number;
}

export interface DestinationFeeConfig extends FeeConfig {
export interface DestinationFeeConfig
extends SetOptional<FeeConfig, 'balance'> {
amount: number | FeeConfigBuilder;
}

Expand Down
16 changes: 12 additions & 4 deletions packages/config/src/xcm-configs/acala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ export const acalaRoutes = new ChainRoutes({
asset: aca,
source: {
balance: BalanceBuilder().substrate().system().account(),
destinationFee: {
balance: BalanceBuilder().substrate().system().account(),
},
},
destination: {
chain: moonbeam,
balance: BalanceBuilder().substrate().assets().account(),
fee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: aca,
balance: BalanceBuilder().substrate().system().account(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
Expand All @@ -36,14 +38,16 @@ export const acalaRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().assetMetadatas(),
destinationFee: {
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
destination: {
chain: moonbeam,
balance: BalanceBuilder().substrate().assets().account(),
fee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: aseed,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
Expand All @@ -57,14 +61,16 @@ export const acalaRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().assetMetadatas(),
destinationFee: {
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
destination: {
chain: moonbeam,
balance: BalanceBuilder().substrate().system().account(),
fee: {
amount: 0.01,
asset: glmr,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
Expand All @@ -78,14 +84,16 @@ export const acalaRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().assetMetadatas(),
destinationFee: {
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
destination: {
chain: moonbeam,
balance: BalanceBuilder().substrate().assets().account(),
fee: {
amount: 0.005,
asset: ldot,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
Expand Down
4 changes: 3 additions & 1 deletion packages/config/src/xcm-configs/alphanetAssetHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ export const alphanetAssetHubRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assets().asset(),
destinationFee: {
balance: BalanceBuilder().substrate().assets().account(),
},
},
destination: {
chain: moonbaseAlpha,
balance: BalanceBuilder().substrate().assets().account(),
fee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: tt1,
balance: BalanceBuilder().substrate().assets().account(),
},
},
extrinsic: ExtrinsicBuilder()
Expand Down
4 changes: 3 additions & 1 deletion packages/config/src/xcm-configs/alphanetRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ export const alphanetRelayRoutes = new ChainRoutes({
asset: unit,
source: {
balance: BalanceBuilder().substrate().system().account(),
destinationFee: {
balance: BalanceBuilder().substrate().system().account(),
},
},
destination: {
chain: moonbaseAlpha,
balance: BalanceBuilder().substrate().assets().account(),
fee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: unit,
balance: BalanceBuilder().substrate().system().account(),
},
},
extrinsic: ExtrinsicBuilder()
Expand Down
8 changes: 6 additions & 2 deletions packages/config/src/xcm-configs/astar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ export const astarRoutes = new ChainRoutes({
asset: astr,
source: {
balance: BalanceBuilder().substrate().system().account(),
destinationFee: {
balance: BalanceBuilder().substrate().system().account(),
},
},
destination: {
chain: moonbeam,
balance: BalanceBuilder().substrate().assets().account(),
fee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: astr,
balance: BalanceBuilder().substrate().system().account(),
},
},
extrinsic: ExtrinsicBuilder()
Expand All @@ -37,14 +39,16 @@ export const astarRoutes = new ChainRoutes({
asset: astr,
balance: BalanceBuilder().substrate().system().account(),
},
destinationFee: {
balance: BalanceBuilder().substrate().assets().account(),
},
},
destination: {
chain: moonbeam,
balance: BalanceBuilder().substrate().system().account(),
fee: {
amount: 0.01,
asset: glmr,
balance: BalanceBuilder().substrate().assets().account(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
Expand Down
20 changes: 15 additions & 5 deletions packages/config/src/xcm-configs/bifrostKusama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ export const bifrostKusamaRoutes = new ChainRoutes({
asset: bnc,
source: {
balance: BalanceBuilder().substrate().system().account(),
destinationFee: {
balance: BalanceBuilder().substrate().system().account(),
},
},
destination: {
chain: moonriver,
balance: BalanceBuilder().substrate().assets().account(),
fee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: bnc,
balance: BalanceBuilder().substrate().system().account(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
Expand All @@ -36,14 +38,16 @@ export const bifrostKusamaRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().currencyMetadatas(),
destinationFee: {
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
destination: {
chain: moonriver,
balance: BalanceBuilder().substrate().system().account(),
fee: {
amount: 0.0001,
asset: movr,
balance: BalanceBuilder().substrate().tokens().accounts(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
Expand All @@ -57,14 +61,16 @@ export const bifrostKusamaRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().currencyMetadatas(),
destinationFee: {
balance: BalanceBuilder().substrate().system().account(),
},
},
destination: {
chain: moonriver,
balance: BalanceBuilder().evm().erc20(),
fee: {
amount: 0.2,
asset: bnc,
balance: BalanceBuilder().substrate().system().account(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(),
Expand All @@ -78,14 +84,16 @@ export const bifrostKusamaRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().currencyMetadatas(),
destinationFee: {
balance: BalanceBuilder().substrate().system().account(),
},
},
destination: {
chain: moonriver,
balance: BalanceBuilder().evm().erc20(),
fee: {
amount: 0.2,
asset: bnc,
balance: BalanceBuilder().substrate().system().account(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(),
Expand All @@ -99,14 +107,16 @@ export const bifrostKusamaRoutes = new ChainRoutes({
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().currencyMetadatas(),
destinationFee: {
balance: BalanceBuilder().substrate().system().account(),
},
},
destination: {
chain: moonriver,
balance: BalanceBuilder().evm().erc20(),
fee: {
amount: 0.2,
asset: bnc,
balance: BalanceBuilder().substrate().system().account(),
},
},
extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(),
Expand Down
Loading

0 comments on commit 31e609f

Please sign in to comment.