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

Upgrade 1020 #1522

Merged
merged 17 commits into from
Sep 6, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add Liquidity Pools related pallets to centrifuge runtime (#1523)
* centrifuge: Add liquidity pools pallets to runtime

* centrifuge: Add LP OutboundQueue wrapper to runtime

* taplo: Obey

* runtime: Move OutboundQueue import

* centrifuge: Allow both root and half of council as admin origins for LP pallets

* centrifuge: Add Axelar Gateway precompile

* centrifuge: Use correct HRMP encoder, update HRMP fee to 1 DOT, use XCM V3 imports

* centrifuge: Update error message for InboundQueue

* clippy: Fix warnings

* centrifuge: Rename outbound queue, fix migration import for orml asset registry
  • Loading branch information
cdamian committed Sep 4, 2023
commit 3a0bca0580147c258766e3772f701a879c61cf90
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 40 additions & 53 deletions runtime/altair/src/migrations.rs
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ mod asset_registry {
use cfg_types::{tokens as v1, tokens::CustomMetadata};
use frame_support::{pallet_prelude::OptionQuery, storage_alias, Twox64Concat};
use orml_traits::asset_registry::AssetMetadata;
use sp_std::{marker::PhantomData, vec::Vec};
use sp_std::marker::PhantomData;

use super::*;
use crate::VERSION;
@@ -254,12 +254,11 @@ mod asset_registry {
log::info!("Found {} LocationToAssetId keys ", loc_count);
log::info!("Found {} Metadata keys ", meta_count);

let assets_to_migrate;
if is_altair {
assets_to_migrate = get_altair_assets();
let assets_to_migrate = if is_altair {
get_altair_assets()
} else {
assets_to_migrate = get_algol_assets();
}
get_algol_assets()
};

assets_to_migrate
.iter()
@@ -432,122 +431,115 @@ pub fn get_algol_assets() -> Vec<(

vec![
(
CurrencyId::Tranche(3151673055, polka_jr.into()),
CurrencyId::Tranche(3151673055, polka_jr),
orml_asset_registry::AssetMetadata {
decimals: 6,
name: b"Polka Pool Junior".to_vec(),
symbol: b"PP1J".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: None,
additional: CustomMetadata {
mintable: false,
permissioned: true,
pool_currency: false,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
(
CurrencyId::Tranche(3151673055, polka_mezz_1.into()),
CurrencyId::Tranche(3151673055, polka_mezz_1),
orml_asset_registry::AssetMetadata {
decimals: 6,
name: b"Polka Pool Mezz 1".to_vec(),
symbol: b"PP1M1".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: None,
additional: CustomMetadata {
mintable: false,
permissioned: true,
pool_currency: false,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
(
CurrencyId::Tranche(3151673055, polka_mezz_2.into()),
CurrencyId::Tranche(3151673055, polka_mezz_2),
orml_asset_registry::AssetMetadata {
decimals: 6,
name: b"Polka Pool Mezz 2".to_vec(),
symbol: b"PP1M2".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: None,
additional: CustomMetadata {
mintable: false,
permissioned: true,
pool_currency: false,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
(
CurrencyId::Tranche(3151673055, polka_mezz_3.into()),
CurrencyId::Tranche(3151673055, polka_mezz_3),
orml_asset_registry::AssetMetadata {
decimals: 6,
name: b"Polka Pool Mezz 3".to_vec(),
symbol: b"PP1M3".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: None,
additional: CustomMetadata {
mintable: false,
permissioned: true,
pool_currency: false,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
(
CurrencyId::Tranche(3151673055, polka_senior.into()),
CurrencyId::Tranche(3151673055, polka_senior),
orml_asset_registry::AssetMetadata {
decimals: 6,
name: b"Polka Pool Senior".to_vec(),
symbol: b"PP1S".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: None,
additional: CustomMetadata {
mintable: false,
permissioned: true,
pool_currency: false,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
(
CurrencyId::Tranche(3581766799, just_jr.into()),
CurrencyId::Tranche(3581766799, just_jr),
orml_asset_registry::AssetMetadata {
decimals: 6,
name: b"Just Logistics Series 3 Junior".to_vec(),
symbol: b"JL3JR".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: None,
additional: CustomMetadata {
mintable: false,
permissioned: true,
pool_currency: false,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
(
CurrencyId::Tranche(3581766799, just_sr.into()),
CurrencyId::Tranche(3581766799, just_sr),
orml_asset_registry::AssetMetadata {
decimals: 6,
name: b"Just Logistics Series 3 Senior".to_vec(),
symbol: b"JL3SR".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: None,
additional: CustomMetadata {
mintable: false,
permissioned: true,
pool_currency: false,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
(
@@ -556,7 +548,7 @@ pub fn get_algol_assets() -> Vec<(
decimals: 6,
name: b"Tether USD".to_vec(),
symbol: b"USDT".to_vec(),
existential_deposit: 0u128.into(),
existential_deposit: 0u128,
location: Some(VersionedMultiLocation::V3(MultiLocation::new(
1,
Junctions::X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)),
@@ -568,8 +560,7 @@ pub fn get_algol_assets() -> Vec<(
transferability: CrossChainTransferability::Xcm(XcmMetadata {
fee_per_second: None,
}),
}
.into(),
},
},
),
(
@@ -578,7 +569,7 @@ pub fn get_algol_assets() -> Vec<(
decimals: 6,
name: b"LP Ethereum Wrapped USDC".to_vec(),
symbol: b"LpEthUSDC".to_vec(),
existential_deposit: 1_000u128.into(),
existential_deposit: 1_000u128,
location: Some(VersionedMultiLocation::V3(MultiLocation::new(
0,
Junctions::X3(
@@ -595,8 +586,7 @@ pub fn get_algol_assets() -> Vec<(
permissioned: false,
pool_currency: true,
transferability: CrossChainTransferability::LiquidityPools,
}
.into(),
},
},
),
]
@@ -622,7 +612,7 @@ pub fn get_altair_assets() -> Vec<(
decimals: 18,
name: b"Altair".to_vec(),
symbol: b"AIR".to_vec(),
existential_deposit: 1_000_000_000_000u128.into(),
existential_deposit: 1_000_000_000_000u128,
location: Some(VersionedMultiLocation::V3(MultiLocation::new(
0,
Junctions::X1(GeneralKey {
@@ -637,8 +627,7 @@ pub fn get_altair_assets() -> Vec<(
transferability: CrossChainTransferability::Xcm(XcmMetadata {
fee_per_second: None,
}),
}
.into(),
},
},
),
(
@@ -647,7 +636,7 @@ pub fn get_altair_assets() -> Vec<(
decimals: 6,
name: b"Tether USDT".to_vec(),
symbol: b"USDT".to_vec(),
existential_deposit: 10_000u128.into(),
existential_deposit: 10_000u128,
location: Some(VersionedMultiLocation::V3(MultiLocation::new(
1,
Junctions::X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)),
@@ -659,8 +648,7 @@ pub fn get_altair_assets() -> Vec<(
transferability: CrossChainTransferability::Xcm(XcmMetadata {
fee_per_second: None,
}),
}
.into(),
},
},
),
(
@@ -669,7 +657,7 @@ pub fn get_altair_assets() -> Vec<(
decimals: 12,
name: b"Acala Dollar".to_vec(),
symbol: b"aUSD".to_vec(),
existential_deposit: 10_000_000_000u128.into(),
existential_deposit: 10_000_000_000u128,
location: Some(VersionedMultiLocation::V3(MultiLocation::new(
1,
Junctions::X2(
@@ -687,8 +675,7 @@ pub fn get_altair_assets() -> Vec<(
transferability: CrossChainTransferability::Xcm(XcmMetadata {
fee_per_second: None,
}),
}
.into(),
},
},
),
(
@@ -697,7 +684,7 @@ pub fn get_altair_assets() -> Vec<(
decimals: 12,
name: b"Kusama".to_vec(),
symbol: b"KSM".to_vec(),
existential_deposit: 10_000_000_000u128.into(),
existential_deposit: 10_000_000_000u128,
location: Some(VersionedMultiLocation::V3(MultiLocation::new(
1,
Junctions::Here,
@@ -709,20 +696,20 @@ pub fn get_altair_assets() -> Vec<(
transferability: CrossChainTransferability::Xcm(XcmMetadata {
fee_per_second: None,
}),
}
.into(),
},
},
),
]
}

// Returns the count of all keys sharing the same storage prefix
#[allow(dead_code)]
pub fn count_storage_keys(prefix: &[u8]) -> u32 {
let mut count = 0;
let mut next_key = prefix.to_vec();
loop {
match sp_io::storage::next_key(&next_key) {
Some(key) if !key.starts_with(&prefix) => break count,
Some(key) if !key.starts_with(prefix) => break count,
Some(key) => {
next_key = key;
count += 1;
Loading