Skip to content

Commit

Permalink
Feat: added all current moonriver assets and enabled kusama
Browse files Browse the repository at this point in the history
  • Loading branch information
Anny0nn committed Mar 11, 2024
1 parent a2c2869 commit 6d9d0e4
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tinkernet/runtime/src/rings/asset_hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub struct AssetHub;
#[derive(Encode, Decode, Clone, Eq, PartialEq, MaxEncodedLen, Debug, TypeInfo)]
pub enum AssetHubAssets {
KSM,
Local(u32),
}

impl RingsChain for AssetHub {
Expand All @@ -20,6 +21,10 @@ impl RingsChain for AssetHub {
parents: 1,
interior: Junctions::Here,
},
Local(asset_id) => MultiLocation {
parents: 0,
interior: Junctions::X2(Junction::PalletKey(50), Junction::GeneralIndex(*asset_id)),
},
}
}

Expand Down
8 changes: 8 additions & 0 deletions tinkernet/runtime/src/rings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ mod karura;
use karura::Karura;
mod moonriver;
use moonriver::Moonriver;
mod kusama;
use kusama::Kusama;

parameter_types! {
pub MaxXCMCallLength: u32 = 100_000;
Expand Down Expand Up @@ -47,6 +49,7 @@ pub enum Chains {
Shiden,
Karura,
Moonriver,
Kusama,
}

#[derive(Encode, Decode, Clone, Eq, PartialEq, MaxEncodedLen, Debug, TypeInfo)]
Expand All @@ -57,6 +60,7 @@ pub enum ChainAssets {
Shiden(<Shiden as RingsChain>::Assets),
Karura(<Karura as RingsChain>::Assets),
Moonriver(<Moonriver as RingsChain>::Assets),
Kusama(<Kusama as RingsChain>::Assets),
}

impl ChainAssetsList for ChainAssets {
Expand All @@ -70,6 +74,7 @@ impl ChainAssetsList for ChainAssets {
Self::Shiden(_) => Chains::Shiden,
Self::Karura(_) => Chains::Karura,
Self::Moonriver(_) => Chains::Moonriver,
Self::Kusama(_) => Chains::Kusama,
}
}

Expand All @@ -81,6 +86,7 @@ impl ChainAssetsList for ChainAssets {
Self::Shiden(asset) => Shiden::get_asset_location(asset),
Self::Karura(asset) => Karura::get_asset_location(asset),
Self::Moonriver(asset) => Moonriver::get_asset_location(asset),
Self::Kusama(asset) => Kusama::get_asset_location(asset),
}
}
}
Expand All @@ -97,6 +103,7 @@ impl ChainList for Chains {
Self::Shiden => Shiden::get_location(),
Self::Karura => Karura::get_location(),
Self::Moonriver => Moonriver::get_location(),
Self::Kusama => Kusama::get_location(),
}
}

Expand All @@ -108,6 +115,7 @@ impl ChainList for Chains {
Self::Shiden => ChainAssets::Shiden(Shiden::get_main_asset()),
Self::Karura => ChainAssets::Karura(Karura::get_main_asset()),
Self::Moonriver => ChainAssets::Moonriver(Moonriver::get_main_asset()),
Self::Kusama => ChainAssets::Kusama(Kusama::get_main_asset()),
}
}

Expand Down
177 changes: 177 additions & 0 deletions tinkernet/runtime/src/rings/moonriver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::RingsChain;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::BoundedSlice;
use scale_info::TypeInfo;
use xcm::latest::{Junction, Junctions, MultiLocation};

Expand All @@ -8,9 +9,56 @@ pub struct Moonriver;
#[allow(non_camel_case_types)]
#[derive(Encode, Decode, Clone, Eq, PartialEq, MaxEncodedLen, Debug, TypeInfo)]
pub enum MoonriverAssets {
/// Moonriver main asset.
MOVR,
/// KSM.
xcKSM,
/// TNKR.
xcTNKR,
/// Tether USD on asset hub.
xcUSDT,
/// RMRK on asset hub.
xcRMRK,
/// Karura aSEED (aUSD).
xcaSeed,
/// Karura.
xcKAR,
/// Bifrost Voucher KSM.
xcvKSM,
/// Bifrost Voucher BNC.
xcvBNC,
/// Bifrost Voucher MOVR.
xcvMOVR,
/// Bifrost.
xcBNC,
/// Phala.
xcPHA,
/// Shiden.
xcSDN,
/// Crust Shadow Native Token.
xcCSM,
/// Integritee.
xcTEER,
/// Robonomics Native Token
xcXRT,
/// Calamari.
xcKMA,
/// Parallel Heiko.
xcHKO,
/// Picasso.
xcPICA,
/// Kintsugi Wrapped BTC.
xcKBTC,
/// Kintsugi Native Token.
xcKINT,
/// Crab Parachain Token.
xcCRAB,
/// Litmus.
xcLIT,
/// Mangata X Native Token.
xcMGX,
/// Turing Network.
xcTUR,
Erc20([u8; 20]),
}

Expand All @@ -32,6 +80,135 @@ impl RingsChain for Moonriver {
parents: 1,
interior: Junctions::X2(Junction::Parachain(2125), Junction::GeneralIndex(0)),
},
xcUSDT => MultiLocation {
parents: 1,
interior: Junctions::X3(
Junction::Parachain(1000),
Junction::PalletInstance(50),
Junction::GeneralIndex(1984),
),
},
xcRMRK => MultiLocation {
parents: 1,
interior: Junctions::X3(
Junction::Parachain(1000),
Junction::PalletInstance(50),
Junction::GeneralIndex(8),
),
},
xcaSeed => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2000),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("0081"))),
),
},
xcKAR => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2000),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("0080"))),
),
},
xcvKSM => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2001),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("0104"))),
),
},
xcvBNC => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2001),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("0101"))),
),
},
xcvMOVR => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2001),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("010a"))),
),
},
xcBNC => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2001),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("0001"))),
),
},
xcPHA => MultiLocation {
parents: 1,
interior: Junctions::X1(Junction::Parachain(2004)),
},
xcSDN => MultiLocation {
parents: 1,
interior: Junctions::X1(Junction::Parachain(2007)),
},
xcCSM => MultiLocation {
parents: 1,
interior: Junctions::X1(Junction::Parachain(2012)),
},
xcTEER => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2015),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("54454552"))),
),
},
xcXRT => MultiLocation {
parents: 1,
interior: Junctions::X1(Junction::Parachain(2048)),
},
xcKMA => MultiLocation {
parents: 1,
interior: Junctions::X1(Junction::Parachain(2084)),
},
xcHKO => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2085),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("484b4f"))),
),
},
xcPICA => MultiLocation {
parents: 1,
interior: Junctions::X1(Junction::Parachain(2087)),
},
xcKBTC => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2092),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("000b"))),
),
},
xcKINT => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junction::Parachain(2092),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("000c"))),
),
},
xcCRAB => MultiLocation {
parents: 1,
interior: Junctions::X2(Junction::Parachain(2105), Junction::PalletInstance(5)),
},
xcLIT => MultiLocation {
parents: 1,
interior: Junctions::X2(Junction::Parachain(2106), Junction::PalletInstance(10)),
},
xcMGX => MultiLocation {
parents: 1,
interior: Junctions::X2(
Junsction::Parachain(2110),
Junction::from(BoundedSlice::truncate_from(&hex_literal::hex!("00000000"))),
),
},
xcTUR => MultiLocation {
parents: 1,
interior: Junctions::X1(Junction::Parachain(2114)),
},
Erc20(address) => MultiLocation {
parents: 0,
interior: Junctions::X2(
Expand Down

0 comments on commit 6d9d0e4

Please sign in to comment.