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

Ethereum, moonbeam and Hydration configurations #409

Merged
merged 6 commits into from
Dec 20, 2024
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
1 change: 0 additions & 1 deletion packages/builder/src/contract/contracts/Xtokens/Xtokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ type DestinationMultilocation = [
),
];

// TODO test if this is needed
function getDestinationMultilocationForPrecompileDestination(
address: string,
destination: AnyParachain,
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 @@ -110,6 +110,11 @@ export const eqd = new Asset({
originSymbol: 'EQD',
});

export const eth = new Asset({
key: 'eth',
originSymbol: 'ETH',
});

export const fil = new Asset({
key: 'fil',
originSymbol: 'FIL',
Expand Down Expand Up @@ -428,6 +433,7 @@ export const assetsList: Asset[] = [
dot,
eq,
eqd,
eth,
fil,
ftm,
ftmwh,
Expand Down
48 changes: 47 additions & 1 deletion packages/config/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
dot,
eq,
eqd,
eth,
fil,
ftm,
ftmwh,
Expand Down Expand Up @@ -461,12 +462,53 @@ export const darwiniaCrab = new EvmParachain({
ws: ['wss://darwiniacrab-rpc.dwellir.com', 'wss://crab-rpc.darwinia.network'],
});

export const ethereum = new EvmChain({
assets: [
ChainAsset.fromAsset(eth, {
decimals: 18,
}),
ChainAsset.fromAsset(usdc, {
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
decimals: 6,
}),
ChainAsset.fromAsset(usdt, {
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
decimals: 6,
}),
ChainAsset.fromAsset(dai, {
address: '0x6b175474e89094c44da98b954eedeac495271d0f',
decimals: 18,
}),
ChainAsset.fromAsset(wbtc, {
address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
decimals: 8,
}),
ChainAsset.fromAsset(glmr, {
address: '0x93d3696A9F879b331f40CB5059e37015423A3Bd0',
decimals: 18,
}),
ChainAsset.fromAsset(peaq, {
address: '0x6e642b4dfe787b8f101d1fb66c2ef56e2b4c6c52',
decimals: 18,
}),
],
ecosystem: Ecosystem.Polkadot,
explorer: 'https://etherscan.io',
id: 1,
key: 'ethereum',
name: 'Ethereum',
nativeAsset: eth,
rpc: 'https://ethereum-rpc.publicnode.com',
wh: {
name: 'Ethereum',
},
});

export const fantomTestnet = new EvmChain({
assets: [
ChainAsset.fromAsset(ftm, {
decimals: 18,
}),
// TODO should be WGLMR ?
ChainAsset.fromAsset(dev, {
address: '0x41E3CFDFC255A4bF3C8D3560Bc8D3D9b5080338e',
decimals: 18,
Expand Down Expand Up @@ -1367,6 +1409,9 @@ export const moonbeam = new EvmParachain({
rpc: 'https://rpc.api.moonbeam.network',
ss58Format: 1284,
ws: ['wss://wss.api.moonbeam.network'],
wh: {
name: 'Moonbeam',
},
});

export const moonriver = new EvmParachain({
Expand Down Expand Up @@ -2262,6 +2307,7 @@ export const chainsList: AnyChain[] = [
crustShadow,
darwinia,
darwiniaCrab,
ethereum,
fantomTestnet,
hydration,
hydrationAlphanet,
Expand Down
282 changes: 282 additions & 0 deletions packages/config/src/mrl-configs/ethereum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
import { BalanceBuilder, MrlBuilder } from '@moonbeam-network/xcm-builder';
import {
dai,
eth,
glmr,
usdc,
usdcwh,
usdt,
usdtwh,
wbtc,
weth,
} from '../assets';
import { ethereum, hydration, moonbeam } from '../chains';
import { MrlChainRoutes } from '../types/MrlChainRoutes';

export const ethereumRoutes = new MrlChainRoutes({
chain: ethereum,
routes: [
/**
* Destination Hydration
*/
{
source: {
asset: usdc,
balance: BalanceBuilder().evm().erc20(),
destinationFee: {
asset: usdc,
balance: BalanceBuilder().evm().erc20(),
},
},
destination: {
asset: usdcwh,
chain: hydration,
balance: BalanceBuilder().substrate().tokens().accounts(),
fee: {
asset: usdcwh,
amount: 0.004,
},
},
mrl: {
isAutomaticPossible: false,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: usdcwh,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
{
source: {
asset: dai,
balance: BalanceBuilder().evm().erc20(),
destinationFee: {
asset: dai,
balance: BalanceBuilder().evm().erc20(),
},
},
destination: {
asset: dai,
chain: hydration,
balance: BalanceBuilder().substrate().tokens().accounts(),
fee: {
asset: dai,
amount: 0.004,
},
},
mrl: {
isAutomaticPossible: false,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: dai,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
/**
* Destination Moonbeam
*/
{
source: {
asset: eth,
balance: BalanceBuilder().evm().native(),
destinationFee: {
asset: eth,
balance: BalanceBuilder().evm().native(),
},
},
destination: {
asset: weth,
chain: moonbeam,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: weth,
amount: 0,
},
},
mrl: {
isAutomaticPossible: true,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: weth,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
{
source: {
asset: usdc,
balance: BalanceBuilder().evm().erc20(),
destinationFee: {
asset: usdc,
balance: BalanceBuilder().evm().erc20(),
},
},
destination: {
asset: usdcwh,
chain: moonbeam,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: usdcwh,
amount: 0,
},
},
mrl: {
isAutomaticPossible: true,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: usdcwh,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
{
source: {
asset: usdt,
balance: BalanceBuilder().evm().erc20(),
destinationFee: {
asset: usdt,
balance: BalanceBuilder().evm().erc20(),
},
},
destination: {
asset: usdtwh,
chain: moonbeam,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: usdtwh,
amount: 0,
},
},
mrl: {
isAutomaticPossible: true,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: usdtwh,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
{
source: {
asset: dai,
balance: BalanceBuilder().evm().erc20(),
destinationFee: {
asset: dai,
balance: BalanceBuilder().evm().erc20(),
},
},
destination: {
asset: dai,
chain: moonbeam,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: dai,
amount: 0,
},
},
mrl: {
isAutomaticPossible: true,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: dai,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
{
source: {
asset: wbtc,
balance: BalanceBuilder().evm().erc20(),
destinationFee: {
asset: wbtc,
balance: BalanceBuilder().evm().erc20(),
},
},
destination: {
asset: wbtc,
chain: moonbeam,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: wbtc,
amount: 0,
},
},
mrl: {
isAutomaticPossible: true,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: wbtc,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
{
source: {
asset: glmr,
balance: BalanceBuilder().evm().erc20(),
destinationFee: {
asset: glmr,
balance: BalanceBuilder().evm().erc20(),
},
},
destination: {
asset: glmr,
chain: moonbeam,
balance: BalanceBuilder().evm().erc20(),
fee: {
asset: glmr,
amount: 0,
},
},
mrl: {
isAutomaticPossible: true,
transfer: MrlBuilder().wormhole().wormhole().tokenTransfer(),
moonChain: {
asset: glmr,
balance: BalanceBuilder().substrate().system().account(),
fee: {
asset: glmr,
amount: 0.15,
balance: BalanceBuilder().substrate().system().account(),
},
},
},
},
],
});
Loading
Loading