Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIL integration with moonbeam and eq fix with xcm v3 #144

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/neat-buses-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@moonbeam-network/xcm-builder': patch
'@moonbeam-network/xcm-config': patch
'@moonbeam-network/xcm-sdk': patch
---

FIL integration and EQ fix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`eqBalances transferXcm should get correct arguments 1`] = `
{
"AccountKey20": {
"key": "0xeF46c7649270C912704fB09B75097f6E32208b85",
"network": "Any",
"network": null,
},
},
],
Expand Down Expand Up @@ -60,7 +60,7 @@ exports[`eqBalances xcmTransfer should get correct arguments 1`] = `
{
"AccountKey20": {
"key": "0xeF46c7649270C912704fB09B75097f6E32208b85",
"network": "Any",
"network": null,
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function eqBalances() {
},
{
AccountKey20: {
network: 'Any',
network: null,
key: address,
},
},
Expand Down Expand Up @@ -60,7 +60,7 @@ export function eqBalances() {
},
{
AccountKey20: {
network: 'Any',
network: null,
key: address,
},
},
Expand Down
6 changes: 6 additions & 0 deletions packages/config/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export const dai = new Asset({
originSymbol: 'DAI',
});

export const fil = new Asset({
key: 'fil',
originSymbol: 'FIL',
});

export const glmr = new Asset({
key: 'glmr',
originSymbol: 'GLMR',
Expand Down Expand Up @@ -280,6 +285,7 @@ export const assetsList: Asset[] = [
dot,
eq,
eqd,
fil,
glmr,
hdx,
hko,
Expand Down
10 changes: 10 additions & 0 deletions packages/config/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
dot,
eq,
eqd,
fil,
glmr,
hdx,
hko,
Expand Down Expand Up @@ -191,6 +192,10 @@ export const bifrostPolkadot = new Parachain({
asset: bnc,
id: { Native: bnc.originSymbol },
},
{
asset: fil,
id: { Token2: 4 },
},
{
asset: vdot,
id: { VToken2: 0 },
Expand Down Expand Up @@ -792,6 +797,11 @@ export const moonbeam = new EvmParachain({
asset: eqd,
id: '187224307232923873519830480073807488153',
},
{
asset: fil,
id: '0xfFFfFFFF6C57e17D210DF507c82807149fFd70B2',
metadataId: 0, // no metadata for ERC20 tokens
},
{
asset: glmr,
id: '0x0000000000000000000000000000000000000802',
Expand Down
18 changes: 17 additions & 1 deletion packages/config/src/configs/bifrostPolkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ExtrinsicBuilder,
FeeBuilder,
} from '@moonbeam-network/xcm-builder';
import { bnc, glmr, vdot, vfil, vglmr } from '../assets';
import { bnc, fil, glmr, vdot, vfil, vglmr } from '../assets';
import { bifrostPolkadot, moonbeam } from '../chains';
import { AssetConfig } from '../types/AssetConfig';
import { ChainConfig } from '../types/ChainConfig';
Expand All @@ -22,6 +22,22 @@ export const bifrostPolkadotConfig = new ChainConfig({
},
extrinsic: ExtrinsicBuilder().xTokens().transfer(),
}),
new AssetConfig({
asset: fil,
balance: BalanceBuilder().substrate().tokens().accounts(),
destination: moonbeam,
destinationFee: {
amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(),
asset: bnc,
balance: BalanceBuilder().substrate().system().account(),
},
extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(),
fee: {
asset: bnc,
balance: BalanceBuilder().substrate().system().account(),
},
min: AssetMinBuilder().assetRegistry().currencyMetadatas(),
}),
new AssetConfig({
asset: glmr,
balance: BalanceBuilder().substrate().tokens().accounts(),
Expand Down
16 changes: 16 additions & 0 deletions packages/config/src/configs/moonbeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
dot,
eq,
eqd,
fil,
glmr,
hdx,
ibtc,
Expand Down Expand Up @@ -485,6 +486,21 @@ export const moonbeamConfig = new ChainConfig({
balance: BalanceBuilder().substrate().system().account(),
},
}),
new AssetConfig({
asset: fil,
balance: BalanceBuilder().evm().erc20(),
contract: ContractBuilder().Xtokens().transfer(),
destination: bifrostPolkadot,
destinationFee: {
amount: 0.00000001,
asset: fil,
balance: BalanceBuilder().evm().erc20(),
},
fee: {
asset: glmr,
balance: BalanceBuilder().substrate().system().account(),
},
}),
],
chain: moonbeam,
});
8 changes: 6 additions & 2 deletions packages/sdk/src/polkadot/PolkadotService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IConfigService,
darwiniaPangoro,
eq,
equilibrium,
equilibriumAlphanet,
paring,
} from '@moonbeam-network/xcm-config';
Expand Down Expand Up @@ -71,9 +72,12 @@ export class PolkadotService {
const symbol = this.api.registry.chainTokens.at(0);
const key = symbol?.toString().toLowerCase();

// TODO: Remove this once Equilibrium Alphanet is updated
// TODO: Remove this once Equilibrium is updated
// or find better way if issue appears on other chains
if (key === 'token' && this.chain.key === equilibriumAlphanet.key) {
if (
key === 'token' &&
[equilibriumAlphanet.key, equilibrium.key].includes(this.chain.key)
) {
return eq;
}

Expand Down
Loading