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

Configure and test whitelisted XCM reserve transfers #661

Merged
merged 62 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
3302020
Reorganize XCM configuration
sea212 Jun 4, 2022
2bae5e5
Comment XcmConfig and mark necessary changes
sea212 Jun 4, 2022
f172dc4
Implement and configure AssetTransactor
sea212 Jun 5, 2022
a09a350
Configure and comment XCM Barrier
sea212 Jun 16, 2022
8c5f164
Configure XCM IsReserve
sea212 Jun 16, 2022
47179af
Prepare Trader implementation for XcmConfig
sea212 Jun 16, 2022
829491a
Merge branch 'main' into sea212-integrate-aUSD
sea212 Aug 17, 2022
62c05d9
Rename Asset::Ztg -> Asset::ZTG (merge artifact)
sea212 Aug 17, 2022
a204b9a
Merge artifacts, work on XCM impl
sea212 Aug 19, 2022
c735f24
Use MultiAssetTransactor and latest orml pallets
sea212 Sep 25, 2022
15153e8
Add asset registry and AssetProcessor implementation
sea212 Sep 25, 2022
071e50d
Integrate asset-registry, implement fee structure
sea212 Sep 25, 2022
dd80b26
Finalize: XCM Weight/Fee, Trader, Treasury
sea212 Sep 26, 2022
9f2ef67
Fix key conversion & GenesisConfig
sea212 Sep 26, 2022
28517a8
Comment + Cargo fmt
sea212 Sep 26, 2022
45a887a
Merge branch 'main' into sea212-integrate-aUSD
sea212 Sep 26, 2022
49030cb
Include xTokens
sea212 Oct 11, 2022
4f5ab0f
Add integration test environment & XCM test setup
sea212 Oct 31, 2022
c1e2b96
Finalize simulated network preparation
sea212 Nov 1, 2022
49d468e
Add currency conversion tests
sea212 Nov 1, 2022
31933cd
Finalize CurrencyID<>MultiLocation tests
sea212 Nov 2, 2022
208c862
Add helper functions and sibling currency<>location conversion test
sea212 Nov 2, 2022
78b1018
Add relative view trader for ZTG
sea212 Nov 2, 2022
bb30dfa
Extend XCM transfer tests
sea212 Nov 4, 2022
b28542b
Add ZTG -> Sibling -> ZTG test
sea212 Nov 4, 2022
b6a7d92
Read ParaId from ParachainInfo + fix tests
sea212 Nov 5, 2022
5a079b6
Fix KSM <> ZTG XCM tests
sea212 Nov 5, 2022
4e67549
Fix Fee (off by 2000x)
sea212 Nov 5, 2022
a708fb1
Increase ExistentialDeposit & Add Treasury to dust whitelist
sea212 Nov 5, 2022
b7b665b
Fix custom fee calculation
sea212 Nov 5, 2022
d31dcc6
Add custom fee test
sea212 Nov 5, 2022
6cee15d
Finalize XCM integration tests
sea212 Nov 5, 2022
e914d54
Remove unused modules
sea212 Nov 7, 2022
ec00ef2
Add XCM related pallets to common runtime
sea212 Nov 7, 2022
0d460a1
Cleanup code
sea212 Nov 7, 2022
d990634
Add proper XCM configuration to Zeitgeist runtime
sea212 Nov 7, 2022
3e84785
Use ExistentialDeposit directly in integration test
sea212 Nov 8, 2022
857cf74
Add integration tests to Zeitgeist runtime
sea212 Nov 8, 2022
d6030ac
Allow only Kusama as parent on Zeitgeist + Cleanup
sea212 Nov 8, 2022
0ff4e5f
Remove dead code
sea212 Nov 9, 2022
e170adb
Update changelog_for_devs.md
sea212 Nov 9, 2022
a5ed076
Use correct treasury pallet id (as before)
sea212 Nov 17, 2022
7ebe84a
Use unambiguous names for setters
sea212 Nov 17, 2022
fc6ae19
Convert comment to docstring
sea212 Nov 17, 2022
354de95
Fix wrong comment
sea212 Nov 17, 2022
b2c1e1f
Reset emulated testnet in any case
sea212 Nov 22, 2022
0f59db0
Remove unnecessary commas
sea212 Nov 23, 2022
49b54ac
Improve readability of numbers
sea212 Nov 23, 2022
391fc02
Fix docstring
sea212 Nov 23, 2022
b6ef8cc
Remove invalid initial balance (integration test)
sea212 Nov 23, 2022
dab6d11
Improve style
sea212 Nov 24, 2022
884a32d
Use more descriptive function name
sea212 Nov 24, 2022
fdfa04b
Add additional balance guard to xcm tests
sea212 Nov 24, 2022
54d3889
Use ::parachain_id() instead of ::get()
sea212 Nov 24, 2022
37a1536
Reduce nested match depth
sea212 Nov 24, 2022
b503c34
Update changelog
sea212 Nov 24, 2022
b20e13f
Add missing crates to runtime-benchmarks feature
sea212 Nov 24, 2022
21a76e4
Merge branch 'main' into sea212-integrate-aUSD
sea212 Nov 24, 2022
77495ed
Repair build
sea212 Nov 24, 2022
1d31ae0
Satisfy cargo fmt and taplo
sea212 Nov 24, 2022
e153330
Update XCM weight in tests
sea212 Nov 24, 2022
c003dda
Satisfy Clippy
sea212 Nov 24, 2022
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
128 changes: 122 additions & 6 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ resolver = "2"
[patch."https:/purestake/moonbeam"]
pallet-author-mapping = { git = "https:/zeitgeistpm/moonbeam", branch = "downgrade-staking-and-mapping" }
parachain-staking = { git = "https:/zeitgeistpm/moonbeam", branch = "downgrade-staking-and-mapping" }

[patch."https:/shaunxw/xcm-simulator"]
xcm-emulator = { git = "https:/sea212/xcm-simulator", branch = "polkadot-v0.9.19-moonbeam" }
5 changes: 5 additions & 0 deletions docs/changelog_for_devs.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v0.3.7
- Added xTokens pallet to transfer tokens accross chains
- Added AssetRegistry pallet to register foreign asset
- Asset UnknownTokens pallet to handle unknown foreign assets

# v0.3.5

- Added `Initialized` status for pools. A pool now starts in `Initialized`
Expand Down
2 changes: 1 addition & 1 deletion misc/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ScalarOutcome": "(MarketId, ScalarPosition)",
"CombinatorialOutcome": null,
"PoolShare": "u128",
"Ztg": null
"ZTG": null
}
},
"AuthorId": "AccountId",
Expand Down
10 changes: 8 additions & 2 deletions node/src/chain_spec/battery_station.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use zeitgeist_primitives::{
ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD},
BASE,
},
types::AccountId,
types::{AccountId, Asset::ForeignAsset},
};

#[cfg(feature = "parachain")]
Expand Down Expand Up @@ -115,7 +115,13 @@ pub(super) fn get_wasm() -> Result<&'static [u8], String> {

generate_generic_genesis_function!(
battery_station_runtime,
sudo: battery_station_runtime::SudoConfig { key: Some(root_key_staging_battery_station()) },
asset_registry: battery_station_runtime::AssetRegistryConfig {
assets: vec![],
last_asset_id: ForeignAsset(0),
vivekvpandya marked this conversation as resolved.
Show resolved Hide resolved
},
sudo: battery_station_runtime::SudoConfig {
key: Some(root_key_staging_battery_station()),
},
);

pub fn battery_station_staging_config(
Expand Down
13 changes: 10 additions & 3 deletions node/src/chain_spec/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use sc_service::ChainType;
use sp_core::sr25519;
use zeitgeist_primitives::{
constants::ztg::{LIQUIDITY_MINING, LIQUIDITY_MINING_PTD},
types::Balance,
types::{Asset::ForeignAsset, Balance},
};

const INITIAL_BALANCE: Balance = Balance::MAX >> 4;
Expand All @@ -44,8 +44,15 @@ fn authority_keys_from_seed(
)
}

generate_generic_genesis_function! {battery_station_runtime,
sudo: battery_station_runtime::SudoConfig { key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")) },
generate_generic_genesis_function! {
battery_station_runtime,
asset_registry: battery_station_runtime::AssetRegistryConfig {
assets: vec![],
last_asset_id: ForeignAsset(0),
},
sudo: battery_station_runtime::SudoConfig {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
}

// Dev currently uses battery station runtime for the following reasons:
Expand Down
7 changes: 4 additions & 3 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[dependencies]
arbitrary = { default-features = false, optional = true, version = "1.0" }
bstringify = "0.1.2"
frame-support = { branch = "moonbeam-polkadot-v0.9.19", default-features = false, git = "https:/purestake/substrate" }
frame-system = { branch = "moonbeam-polkadot-v0.9.19", default-features = false, git = "https:/purestake/substrate" }
orml-currencies = { branch = "2022-06-v0.9.19", default-features = false, git = "https:/zeitgeistpm/open-runtime-module-library" }
orml-tokens = { branch = "2022-06-v0.9.19", default-features = false, git = "https:/zeitgeistpm/open-runtime-module-library" }
orml-traits = { branch = "2022-06-v0.9.19", default-features = false, git = "https:/zeitgeistpm/open-runtime-module-library" }
orml-currencies = { branch = "7e1123e-v0.9.19", default-features = false, git = "https:/zeitgeistpm/open-runtime-module-library" }
orml-tokens = { branch = "7e1123e-v0.9.19", default-features = false, git = "https:/zeitgeistpm/open-runtime-module-library" }
orml-traits = { branch = "7e1123e-v0.9.19", default-features = false, git = "https:/zeitgeistpm/open-runtime-module-library" }
parity-scale-codec = { default-features = false, features = ["derive", "max-encoded-len"], version = "3.0.0" }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
serde = { default-features = false, features = ["derive"], optional = true, version = "1.0.136" }
Expand Down
15 changes: 14 additions & 1 deletion primitives/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,27 @@ use scale_info::TypeInfo;
#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[derive(
Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, Ord, PartialEq, PartialOrd, TypeInfo,
Clone,
Copy,
Debug,
Decode,
Default,
Eq,
Encode,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
)]
pub enum Asset<MI: MaxEncodedLen> {
CategoricalOutcome(MI, CategoryIndex),
ScalarOutcome(MI, ScalarPosition),
CombinatorialOutcome,
PoolShare(SerdeWrapper<PoolId>),
#[default]
Ztg,
ForeignAsset(u32),
}

/// In a scalar market, users can either choose a `Long` position,
Expand Down
4 changes: 4 additions & 0 deletions primitives/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,7 @@ pub const SD_PALLET_ID: PalletId = PalletId(*b"zge/sedp");
pub const MAX_ASSETS: u16 = MAX_CATEGORIES + 1;
/// Pallet identifier, mainly used for named balance reserves.
pub const SWAPS_PALLET_ID: PalletId = PalletId(*b"zge/swap");

// Treasury
/// Pallet identifier, used to derive treasury account
pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"zge/tsry");
3 changes: 2 additions & 1 deletion primitives/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ pub use crate::{
};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Result, Unstructured};
use frame_support::dispatch::{Decode, Encode, Weight};
use frame_support::dispatch::Weight;
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_runtime::{
generic,
Expand Down
Loading