From 37e5047292424b12bb8f6b770b121da5d04613cb Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Tue, 29 Aug 2023 16:08:19 +0300 Subject: [PATCH 01/21] Initial impl Signed-off-by: Georgi Zlatarev --- Cargo.lock | 6 +++--- node/Cargo.toml | 6 +++--- runtime/calamari/Cargo.toml | 4 ++-- runtime/calamari/src/zenlink.rs | 2 ++ runtime/manta/Cargo.toml | 4 ++-- runtime/manta/src/zenlink.rs | 2 ++ 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 533b3d9b0..c6e9b90ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15018,7 +15018,7 @@ dependencies = [ [[package]] name = "zenlink-protocol" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=polkadot-v0.9.37#c2acc36bea02e6c2aa38f3b290e255dfd5c164dd" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#42ad51efd91c870f3eff0320f154d9e6578cb07d" dependencies = [ "frame-benchmarking", "frame-support", @@ -15038,7 +15038,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-rpc" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=polkadot-v0.9.37#c2acc36bea02e6c2aa38f3b290e255dfd5c164dd" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#42ad51efd91c870f3eff0320f154d9e6578cb07d" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -15053,7 +15053,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-runtime-api" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=polkadot-v0.9.37#c2acc36bea02e6c2aa38f3b290e255dfd5c164dd" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#42ad51efd91c870f3eff0320f154d9e6578cb07d" dependencies = [ "parity-scale-codec", "sp-api", diff --git a/node/Cargo.toml b/node/Cargo.toml index 52ee47a1c..7d9d511bb 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -38,9 +38,9 @@ sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate.git", pallet-farming-rpc-api = { path = "../pallets/farming/rpc" } pallet-farming-rpc-runtime-api = { path = "../pallets/farming/rpc/runtime-api" } -zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "polkadot-v0.9.37" } -zenlink-protocol-rpc = { git = 'https://github.com/manta-network/Zenlink', branch = "polkadot-v0.9.37" } -zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "polkadot-v0.9.37" } +zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937" } +zenlink-protocol-rpc = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937" } +zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937" } # Substrate client dependencies sc-basic-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.37" } diff --git a/runtime/calamari/Cargo.toml b/runtime/calamari/Cargo.toml index d6cf61286..968efbfcb 100644 --- a/runtime/calamari/Cargo.toml +++ b/runtime/calamari/Cargo.toml @@ -110,8 +110,8 @@ session-key-primitives = { path = '../../primitives/session-keys', default-featu orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } -zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "polkadot-v0.9.37", default-features = false } -zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "polkadot-v0.9.37", default-features = false } +zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } +zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] diff --git a/runtime/calamari/src/zenlink.rs b/runtime/calamari/src/zenlink.rs index d6f80977f..108c8bd11 100644 --- a/runtime/calamari/src/zenlink.rs +++ b/runtime/calamari/src/zenlink.rs @@ -30,6 +30,7 @@ use zenlink_protocol::{ // Normal Coin AMM parameter_types! { pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); + pub const SwapFeesPotId: PalletId = PalletId(*b"/swappot"); pub SelfParaId: u32 = ParachainInfo::parachain_id().into(); pub MantaNativeAssetId: CalamariAssetId = 1; pub ZenlinkNativeAssetId: u64 = 0; @@ -41,6 +42,7 @@ impl zenlink_protocol::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiAssetsHandler = MultiAssets; type PalletId = ZenlinkPalletId; + type PotId = SwapFeesPotId; type SelfParaId = SelfParaId; type AssetId = ZenlinkAssetId; #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/runtime/manta/Cargo.toml b/runtime/manta/Cargo.toml index 0b88d3b3f..2a091f840 100644 --- a/runtime/manta/Cargo.toml +++ b/runtime/manta/Cargo.toml @@ -88,8 +88,8 @@ xcm-executor = { git = 'https://github.com/paritytech/polkadot.git', default-fea orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } -zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "polkadot-v0.9.37", default-features = false } -zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "polkadot-v0.9.37", default-features = false } +zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } +zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } # Self dependencies manta-collator-selection = { path = '../../pallets/collator-selection', default-features = false } diff --git a/runtime/manta/src/zenlink.rs b/runtime/manta/src/zenlink.rs index b59065d1a..80806c6cb 100644 --- a/runtime/manta/src/zenlink.rs +++ b/runtime/manta/src/zenlink.rs @@ -30,6 +30,7 @@ use zenlink_protocol::{ // Normal Coin AMM parameter_types! { pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); + pub const SwapFeesPotId: PalletId = PalletId(*b"/swappot"); pub SelfParaId: u32 = ParachainInfo::parachain_id().into(); pub MantaNativeAssetId: MantaAssetId = 1; pub ZenlinkNativeAssetId: u64 = 0; @@ -41,6 +42,7 @@ impl zenlink_protocol::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiAssetsHandler = MultiAssets; type PalletId = ZenlinkPalletId; + type PotId = SwapFeesPotId; type SelfParaId = SelfParaId; type AssetId = ZenlinkAssetId; #[cfg(not(feature = "runtime-benchmarks"))] From 94406224e0c6f3c63c597e742d8faa1319881043 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Wed, 30 Aug 2023 11:15:59 +0300 Subject: [PATCH 02/21] Check dex fees pot Signed-off-by: Georgi Zlatarev --- tests/tests/test-dex.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/tests/test-dex.ts b/tests/tests/test-dex.ts index 0cdacdca3..7561920d5 100644 --- a/tests/tests/test-dex.ts +++ b/tests/tests/test-dex.ts @@ -81,5 +81,24 @@ describeWithManta("Manta RPC (Dex)", (context) => { state = await api.query.assets.account(10, alice); expect(JSON.parse(JSON.stringify(state))).to.equal(null); + + callData = api.tx.zenlinkProtocol.createPair([parachainId,0,1], [parachainId,2,8]); + await executeTx(context, callData, true); + + callData = api.tx.zenlinkProtocol.addLiquidity([parachainId,0,1], [parachainId,2,8], + MANTA_1K, USDT_10M, MANTA_1K, USDT_10M, 1000); + await executeTx(context, callData); + + callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(100,10,[1,8],alice,1000000); + await executeTx(context, callData); + const swapFeesBalance = (await api.query.system.account("0x2f73776170706f74000000000000000000000000000000000000000000000000")).data.free.toString(); + console.log("Swap fees pot balance: ", swapFeesBalance); + const swapFeesBalance2 = (await api.query.system.account("0x2f73776170706f7400000000000000000000000000000000000000000000000000")).data.free.toString(); + console.log("Swap fees pot balance: ", swapFeesBalance2); + // #[pallet::compact] amount_in: AssetBalance, + // #[pallet::compact] amount_out_min: AssetBalance, + // path: Vec, + // recipient: T::AccountId, + // #[pallet::compact] deadline: T::BlockNumber, }); }); \ No newline at end of file From 0257d6f97dfe124658e54d9e54f724935b87ffda Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Wed, 30 Aug 2023 11:27:02 +0300 Subject: [PATCH 03/21] wait 24 seconds Signed-off-by: Georgi Zlatarev --- tests/tests/test-dex.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/tests/test-dex.ts b/tests/tests/test-dex.ts index 7561920d5..02c3bd059 100644 --- a/tests/tests/test-dex.ts +++ b/tests/tests/test-dex.ts @@ -12,6 +12,7 @@ import { USDT_METADATA } from "../constants"; import {BN} from "@polkadot/util"; +import { delay } from "../test-util"; describeWithManta("Manta RPC (Dex)", (context) => { step("dex add liquidity should work", async function () { @@ -91,6 +92,9 @@ describeWithManta("Manta RPC (Dex)", (context) => { callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(100,10,[1,8],alice,1000000); await executeTx(context, callData); + + await delay(24000); + const swapFeesBalance = (await api.query.system.account("0x2f73776170706f74000000000000000000000000000000000000000000000000")).data.free.toString(); console.log("Swap fees pot balance: ", swapFeesBalance); const swapFeesBalance2 = (await api.query.system.account("0x2f73776170706f7400000000000000000000000000000000000000000000000000")).data.free.toString(); From f7be6e83d3cf1750921cd54f494f112a8c21773b Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Wed, 30 Aug 2023 14:25:04 +0300 Subject: [PATCH 04/21] Use latest zenlinkprotocol pallet Signed-off-by: Georgi Zlatarev --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eb1da80dc..1bfcb0695 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6387,7 +6387,7 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#ed87ba5bb12c756b3973b3f59a430bab22fc0cc9" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#4ff694c4b1e3c4a187410dddf948d86624601a24" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6405,7 +6405,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#ed87ba5bb12c756b3973b3f59a430bab22fc0cc9" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#4ff694c4b1e3c4a187410dddf948d86624601a24" dependencies = [ "frame-support", "parity-scale-codec", @@ -15010,7 +15010,7 @@ dependencies = [ [[package]] name = "zenlink-protocol" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#42ad51efd91c870f3eff0320f154d9e6578cb07d" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#f4123e65b5157476cfda301207309652e06e710e" dependencies = [ "frame-benchmarking", "frame-support", @@ -15030,7 +15030,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-rpc" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#42ad51efd91c870f3eff0320f154d9e6578cb07d" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#f4123e65b5157476cfda301207309652e06e710e" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -15045,7 +15045,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-runtime-api" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#42ad51efd91c870f3eff0320f154d9e6578cb07d" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#f4123e65b5157476cfda301207309652e06e710e" dependencies = [ "parity-scale-codec", "sp-api", From 6696b2ee8a28b1913e6289190779357810180609 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Wed, 30 Aug 2023 14:28:51 +0300 Subject: [PATCH 05/21] Use latest zenlinkprotocol pallet Signed-off-by: Georgi Zlatarev --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1bfcb0695..16589f4a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15010,7 +15010,7 @@ dependencies = [ [[package]] name = "zenlink-protocol" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#f4123e65b5157476cfda301207309652e06e710e" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#162ff634879ac9c8195f68f13747d627d76702a2" dependencies = [ "frame-benchmarking", "frame-support", @@ -15030,7 +15030,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-rpc" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#f4123e65b5157476cfda301207309652e06e710e" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#162ff634879ac9c8195f68f13747d627d76702a2" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -15045,7 +15045,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-runtime-api" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#f4123e65b5157476cfda301207309652e06e710e" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#162ff634879ac9c8195f68f13747d627d76702a2" dependencies = [ "parity-scale-codec", "sp-api", From 02be4e6a856ecaab95f2b3dc6bdd382e4f7a7644 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Wed, 30 Aug 2023 15:58:52 +0300 Subject: [PATCH 06/21] Use rev insread of branch for orml Signed-off-by: Georgi Zlatarev --- Cargo.lock | 58 +++++++++++++++++++++------- pallets/asset-manager/Cargo.toml | 2 +- pallets/farming/Cargo.toml | 2 +- primitives/manta/Cargo.toml | 2 +- runtime/calamari/Cargo.toml | 4 +- runtime/common/Cargo.toml | 4 +- runtime/integration-tests/Cargo.toml | 4 +- runtime/manta/Cargo.toml | 4 +- 8 files changed, 56 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16589f4a1..495750034 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1121,7 +1121,7 @@ dependencies = [ "manta-collator-selection", "manta-primitives", "nimbus-primitives", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "orml-xtokens", "pallet-asset-manager", "pallet-assets", @@ -4180,7 +4180,7 @@ dependencies = [ "manta-primitives", "manta-runtime", "nimbus-primitives", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "orml-xtokens", "pallet-asset-manager", "pallet-assets", @@ -5490,7 +5490,7 @@ dependencies = [ "frame-support", "frame-system", "log", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "parity-scale-codec", "scale-info", "smallvec", @@ -5528,7 +5528,7 @@ dependencies = [ "manta-collator-selection", "manta-primitives", "nimbus-primitives", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "orml-xtokens", "pallet-asset-manager", "pallet-assets", @@ -6392,7 +6392,25 @@ dependencies = [ "frame-support", "impl-trait-for-tuples", "num-traits", - "orml-utilities", + "orml-utilities 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", +] + +[[package]] +name = "orml-traits" +version = "0.4.1-dev" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" +dependencies = [ + "frame-support", + "impl-trait-for-tuples", + "num-traits", + "orml-utilities 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "parity-scale-codec", "scale-info", "serde", @@ -6416,13 +6434,27 @@ dependencies = [ "sp-std", ] +[[package]] +name = "orml-utilities" +version = "0.4.1-dev" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "orml-xcm-support" version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#ed87ba5bb12c756b3973b3f59a430bab22fc0cc9" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" dependencies = [ "frame-support", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "parity-scale-codec", "sp-runtime", "sp-std", @@ -6433,12 +6465,12 @@ dependencies = [ [[package]] name = "orml-xtokens" version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#ed87ba5bb12c756b3973b3f59a430bab22fc0cc9" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" dependencies = [ "cumulus-primitives-core", "frame-support", "frame-system", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "orml-xcm-support", "pallet-xcm", "parity-scale-codec", @@ -6492,7 +6524,7 @@ dependencies = [ "frame-system", "log", "manta-primitives", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "pallet-assets", "pallet-balances", "parity-scale-codec", @@ -6854,7 +6886,7 @@ dependencies = [ "hex-literal", "log", "manta-primitives", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "pallet-asset-manager", "pallet-assets", "pallet-balances", @@ -10054,7 +10086,7 @@ dependencies = [ "frame-system", "lazy_static", "manta-primitives", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "orml-xtokens", "pallet-asset-manager", "pallet-assets", @@ -15016,7 +15048,7 @@ dependencies = [ "frame-support", "frame-system", "log", - "orml-traits", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", "pallet-balances", "parity-scale-codec", "scale-info", diff --git a/pallets/asset-manager/Cargo.toml b/pallets/asset-manager/Cargo.toml index a9be6f607..fa55a0530 100644 --- a/pallets/asset-manager/Cargo.toml +++ b/pallets/asset-manager/Cargo.toml @@ -21,7 +21,7 @@ sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkad xcm = { git = "https://github.com/paritytech/polkadot.git", default-features = false, branch = "release-v0.9.37" } # 3rd party dependencies -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.37" } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } [dev-dependencies] pallet-assets = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" } diff --git a/pallets/farming/Cargo.toml b/pallets/farming/Cargo.toml index ae8d1e369..115a3004d 100644 --- a/pallets/farming/Cargo.toml +++ b/pallets/farming/Cargo.toml @@ -24,7 +24,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false } manta-primitives = { path = '../../primitives/manta', default-features = false } -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37", default-features = false } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } pallet-asset-manager = { path = "../asset-manager", default-features = false, optional = true } pallet-assets = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37", default-features = false, optional = true } xcm = { git = "https://github.com/paritytech/polkadot.git", branch = "release-v0.9.37", default-features = false, optional = true } diff --git a/primitives/manta/Cargo.toml b/primitives/manta/Cargo.toml index 8b5b068ff..71a2fb056 100644 --- a/primitives/manta/Cargo.toml +++ b/primitives/manta/Cargo.toml @@ -28,7 +28,7 @@ xcm = { git = 'https://github.com/paritytech/polkadot.git', default-features = f xcm-builder = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.37" } xcm-executor = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.37" } -orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', branch = "polkadot-v0.9.37", default-features = false } +orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } [features] default = ["std"] diff --git a/runtime/calamari/Cargo.toml b/runtime/calamari/Cargo.toml index 968efbfcb..1333fffe0 100644 --- a/runtime/calamari/Cargo.toml +++ b/runtime/calamari/Cargo.toml @@ -107,8 +107,8 @@ runtime-common = { path = '../common', default-features = false } session-key-primitives = { path = '../../primitives/session-keys', default-features = false } # Third party (vendored) dependencies -orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } -orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } +orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } +orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 76a89e73a..57e782928 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -56,8 +56,8 @@ cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/cumul parachain-info = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.37" } # Orml dependencies -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } -orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } +orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } # Self dependencies pallet-asset-manager = { path = '../../pallets/asset-manager' } diff --git a/runtime/integration-tests/Cargo.toml b/runtime/integration-tests/Cargo.toml index b3d1e6b5a..5de69b405 100644 --- a/runtime/integration-tests/Cargo.toml +++ b/runtime/integration-tests/Cargo.toml @@ -52,8 +52,8 @@ cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/cumul parachain-info = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.37" } # Orml dependencies -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } -orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } +orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } # Self dependencies calamari-vesting = { path = '../../pallets/vesting' } diff --git a/runtime/manta/Cargo.toml b/runtime/manta/Cargo.toml index 2a091f840..7cb4ceea1 100644 --- a/runtime/manta/Cargo.toml +++ b/runtime/manta/Cargo.toml @@ -85,8 +85,8 @@ xcm-builder = { git = 'https://github.com/paritytech/polkadot.git', default-feat xcm-executor = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.37" } # Third party (vendored) dependencies -orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } -orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.37" } +orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } +orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } From 3eb8e4b926eb4900c7050f1f20d2026c8d7f96f5 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 05:12:46 +0300 Subject: [PATCH 07/21] Update zenlink protocol Signed-off-by: Georgi Zlatarev --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 495750034..9587d3030 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15042,7 +15042,7 @@ dependencies = [ [[package]] name = "zenlink-protocol" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#162ff634879ac9c8195f68f13747d627d76702a2" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#d822d72c85c2506bc17dcbe0fe76a9424cedc657" dependencies = [ "frame-benchmarking", "frame-support", @@ -15062,7 +15062,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-rpc" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#162ff634879ac9c8195f68f13747d627d76702a2" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#d822d72c85c2506bc17dcbe0fe76a9424cedc657" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -15077,7 +15077,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-runtime-api" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#162ff634879ac9c8195f68f13747d627d76702a2" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#d822d72c85c2506bc17dcbe0fe76a9424cedc657" dependencies = [ "parity-scale-codec", "sp-api", From 0be81451b5e1c2ecaea598757fa09c5f1c001123 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 05:14:51 +0300 Subject: [PATCH 08/21] Bump timeout for manta-integration test Signed-off-by: Georgi Zlatarev --- .github/workflows/integration_test_manta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration_test_manta.yml b/.github/workflows/integration_test_manta.yml index d03f069b8..1cb44f56d 100644 --- a/.github/workflows/integration_test_manta.yml +++ b/.github/workflows/integration_test_manta.yml @@ -91,7 +91,7 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'A-manta') needs: [build-node-current] runs-on: runtime-integration-test - timeout-minutes: 240 + timeout-minutes: 420 container: image: ubuntu:20.04 strategy: From ca05ce4b6bc61d1a9b9bbd9f4e65dcdd1c9d6fde Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 05:58:10 +0300 Subject: [PATCH 09/21] Update zenlink dep Signed-off-by: Georgi Zlatarev --- Cargo.lock | 6 +++--- runtime/calamari/src/zenlink.rs | 4 ++-- runtime/manta/src/zenlink.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9587d3030..1c6b50ad1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15042,7 +15042,7 @@ dependencies = [ [[package]] name = "zenlink-protocol" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#d822d72c85c2506bc17dcbe0fe76a9424cedc657" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#c581a0b7a1aa38451465bbb4ff82eb93f05348f2" dependencies = [ "frame-benchmarking", "frame-support", @@ -15062,7 +15062,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-rpc" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#d822d72c85c2506bc17dcbe0fe76a9424cedc657" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#c581a0b7a1aa38451465bbb4ff82eb93f05348f2" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -15077,7 +15077,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-runtime-api" version = "0.4.4" -source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#d822d72c85c2506bc17dcbe0fe76a9424cedc657" +source = "git+https://github.com/manta-network/Zenlink?branch=ghzlatarev/v0937#c581a0b7a1aa38451465bbb4ff82eb93f05348f2" dependencies = [ "parity-scale-codec", "sp-api", diff --git a/runtime/calamari/src/zenlink.rs b/runtime/calamari/src/zenlink.rs index 108c8bd11..5824dac26 100644 --- a/runtime/calamari/src/zenlink.rs +++ b/runtime/calamari/src/zenlink.rs @@ -30,7 +30,7 @@ use zenlink_protocol::{ // Normal Coin AMM parameter_types! { pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); - pub const SwapFeesPotId: PalletId = PalletId(*b"/swappot"); + pub const NativeSwapFeesPotId: PalletId = PalletId(*b"/swappot"); pub SelfParaId: u32 = ParachainInfo::parachain_id().into(); pub MantaNativeAssetId: CalamariAssetId = 1; pub ZenlinkNativeAssetId: u64 = 0; @@ -42,7 +42,7 @@ impl zenlink_protocol::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiAssetsHandler = MultiAssets; type PalletId = ZenlinkPalletId; - type PotId = SwapFeesPotId; + type NativeSwapFeesPotId = NativeSwapFeesPotId; type SelfParaId = SelfParaId; type AssetId = ZenlinkAssetId; #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/runtime/manta/src/zenlink.rs b/runtime/manta/src/zenlink.rs index 80806c6cb..229180169 100644 --- a/runtime/manta/src/zenlink.rs +++ b/runtime/manta/src/zenlink.rs @@ -30,7 +30,7 @@ use zenlink_protocol::{ // Normal Coin AMM parameter_types! { pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); - pub const SwapFeesPotId: PalletId = PalletId(*b"/swappot"); + pub const NativeSwapFeesPotId: PalletId = PalletId(*b"/swappot"); pub SelfParaId: u32 = ParachainInfo::parachain_id().into(); pub MantaNativeAssetId: MantaAssetId = 1; pub ZenlinkNativeAssetId: u64 = 0; @@ -42,7 +42,7 @@ impl zenlink_protocol::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiAssetsHandler = MultiAssets; type PalletId = ZenlinkPalletId; - type PotId = SwapFeesPotId; + type NativeSwapFeesPotId = NativeSwapFeesPotId; type SelfParaId = SelfParaId; type AssetId = ZenlinkAssetId; #[cfg(not(feature = "runtime-benchmarks"))] From 31a3e6f9f49904d708a6cb0fb13f12f51843864d Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 06:02:30 +0300 Subject: [PATCH 10/21] set fee factor in test Signed-off-by: Georgi Zlatarev --- tests/tests/test-dex.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/tests/test-dex.ts b/tests/tests/test-dex.ts index 02c3bd059..15269ed45 100644 --- a/tests/tests/test-dex.ts +++ b/tests/tests/test-dex.ts @@ -83,6 +83,11 @@ describeWithManta("Manta RPC (Dex)", (context) => { state = await api.query.assets.account(10, alice); expect(JSON.parse(JSON.stringify(state))).to.equal(null); + callData = api.tx.zenlinkProtocol.setNativeSwapFeesFactor(200); + await executeTx(context, callData, true); + + await delay(12000); + callData = api.tx.zenlinkProtocol.createPair([parachainId,0,1], [parachainId,2,8]); await executeTx(context, callData, true); From 8405bf990a531fc6ddea1860698b0c616b8d143d Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 07:36:49 +0300 Subject: [PATCH 11/21] udpate orml branch Signed-off-by: Georgi Zlatarev --- Cargo.lock | 49 ++++++++++++++++++++++++---- runtime/integration-tests/Cargo.toml | 4 +-- runtime/manta/Cargo.toml | 4 +-- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c6b50ad1..1e7e458ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1122,7 +1122,7 @@ dependencies = [ "manta-primitives", "nimbus-primitives", "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xtokens", + "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "pallet-asset-manager", "pallet-assets", "pallet-aura", @@ -4180,8 +4180,8 @@ dependencies = [ "manta-primitives", "manta-runtime", "nimbus-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xtokens", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", "pallet-asset-manager", "pallet-assets", "pallet-balances", @@ -5528,8 +5528,8 @@ dependencies = [ "manta-collator-selection", "manta-primitives", "nimbus-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xtokens", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", "pallet-asset-manager", "pallet-assets", "pallet-aura", @@ -6448,6 +6448,20 @@ dependencies = [ "sp-std", ] +[[package]] +name = "orml-xcm-support" +version = "0.4.1-dev" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#9a1b0f1cf1835225b638311971eba5f30a1187c8" +dependencies = [ + "frame-support", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "parity-scale-codec", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + [[package]] name = "orml-xcm-support" version = "0.4.1-dev" @@ -6462,6 +6476,27 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "orml-xtokens" +version = "0.4.1-dev" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#9a1b0f1cf1835225b638311971eba5f30a1187c8" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-xcm-support 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "pallet-xcm", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + [[package]] name = "orml-xtokens" version = "0.4.1-dev" @@ -6471,7 +6506,7 @@ dependencies = [ "frame-support", "frame-system", "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xcm-support", + "orml-xcm-support 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "pallet-xcm", "parity-scale-codec", "scale-info", @@ -10087,7 +10122,7 @@ dependencies = [ "lazy_static", "manta-primitives", "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xtokens", + "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", "pallet-asset-manager", "pallet-assets", "pallet-balances", diff --git a/runtime/integration-tests/Cargo.toml b/runtime/integration-tests/Cargo.toml index 5de69b405..b3d1e6b5a 100644 --- a/runtime/integration-tests/Cargo.toml +++ b/runtime/integration-tests/Cargo.toml @@ -52,8 +52,8 @@ cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/cumul parachain-info = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.37" } # Orml dependencies -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } -orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } +orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } # Self dependencies calamari-vesting = { path = '../../pallets/vesting' } diff --git a/runtime/manta/Cargo.toml b/runtime/manta/Cargo.toml index 7cb4ceea1..576f2380a 100644 --- a/runtime/manta/Cargo.toml +++ b/runtime/manta/Cargo.toml @@ -85,8 +85,8 @@ xcm-builder = { git = 'https://github.com/paritytech/polkadot.git', default-feat xcm-executor = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.37" } # Third party (vendored) dependencies -orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } -orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } +orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', branch = "polkadot-v0.9.37", default-features = false } +orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', branch = "polkadot-v0.9.37", default-features = false } zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } From 623726d4dafb796d8a510604a09510a827228be9 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 07:41:16 +0300 Subject: [PATCH 12/21] Fix tx-fee-diff test Signed-off-by: Georgi Zlatarev --- runtime/calamari/src/diff_tx_fees.rs | 14 ++++++++++++++ runtime/manta/src/diff_tx_fees.rs | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/runtime/calamari/src/diff_tx_fees.rs b/runtime/calamari/src/diff_tx_fees.rs index 86cc09aeb..28079283d 100644 --- a/runtime/calamari/src/diff_tx_fees.rs +++ b/runtime/calamari/src/diff_tx_fees.rs @@ -3167,6 +3167,20 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( dispatch_info, call_len, )); + + // set_native_swap_fee_factor + let call = crate::RuntimeCall::ZenlinkProtocol( + zenlink_protocol::Call::set_native_swap_fee_factor { + set_native_swap_fee_factor: 200u128, + }, + ); + let (dispatch_info, call_len) = get_call_details(&call); + calamari_runtime_calls.push(( + "zenlink_protocol", + "set_native_swap_fee_factor", + dispatch_info, + call_len, + )); } (calamari_runtime_calls, t) diff --git a/runtime/manta/src/diff_tx_fees.rs b/runtime/manta/src/diff_tx_fees.rs index 9a97ebbc7..e87684ff1 100644 --- a/runtime/manta/src/diff_tx_fees.rs +++ b/runtime/manta/src/diff_tx_fees.rs @@ -2910,7 +2910,7 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( use zenlink_protocol::AssetId as ZenlinkAssetId; assert_eq!( crate::RuntimeCall::get_call_names("ZenlinkProtocol").len(), - 16, + 17, "Please update new extrinsic here." ); // set_fee_receiver @@ -3154,6 +3154,20 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( dispatch_info, call_len, )); + + // set_native_swap_fee_factor + let call = crate::RuntimeCall::ZenlinkProtocol( + zenlink_protocol::Call::set_native_swap_fee_factor { + set_native_swap_fee_factor: 200u128, + }, + ); + let (dispatch_info, call_len) = get_call_details(&call); + calamari_runtime_calls.push(( + "zenlink_protocol", + "set_native_swap_fee_factor", + dispatch_info, + call_len, + )); } (calamari_runtime_calls, t) From 576960529e8268094b55d6064114cf153a5fe4d3 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 08:25:10 +0300 Subject: [PATCH 13/21] Fix toml file Signed-off-by: Georgi Zlatarev --- Cargo.lock | 34 +++++++++++++++++++++++++++++++- pallets/asset-manager/Cargo.toml | 2 +- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e7e458ba..03797e56b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6384,6 +6384,24 @@ dependencies = [ "num-traits", ] +[[package]] +name = "orml-traits" +version = "0.4.1-dev" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37#22a90420f4517a4b9fab81d2ee3937991dc1db54" +dependencies = [ + "frame-support", + "impl-trait-for-tuples", + "num-traits", + "orml-utilities 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37)", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", +] + [[package]] name = "orml-traits" version = "0.4.1-dev" @@ -6420,6 +6438,20 @@ dependencies = [ "xcm", ] +[[package]] +name = "orml-utilities" +version = "0.4.1-dev" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37#22a90420f4517a4b9fab81d2ee3937991dc1db54" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "orml-utilities" version = "0.4.1-dev" @@ -6559,7 +6591,7 @@ dependencies = [ "frame-system", "log", "manta-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37)", "pallet-assets", "pallet-balances", "parity-scale-codec", diff --git a/pallets/asset-manager/Cargo.toml b/pallets/asset-manager/Cargo.toml index fa55a0530..2c12f6a79 100644 --- a/pallets/asset-manager/Cargo.toml +++ b/pallets/asset-manager/Cargo.toml @@ -21,7 +21,7 @@ sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkad xcm = { git = "https://github.com/paritytech/polkadot.git", default-features = false, branch = "release-v0.9.37" } # 3rd party dependencies -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "ghzlatarev/polkadot-v0.9.37", default-features = false } [dev-dependencies] pallet-assets = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" } From 29d17ea032ea0535d8094c296e4098536cbd1bf7 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 09:21:41 +0300 Subject: [PATCH 14/21] Fix commits and compilaiton Signed-off-by: Georgi Zlatarev --- Cargo.lock | 135 ++++----------------------- pallets/asset-manager/Cargo.toml | 2 +- pallets/farming/Cargo.toml | 2 +- primitives/manta/Cargo.toml | 2 +- runtime/calamari/Cargo.toml | 4 +- runtime/calamari/src/diff_tx_fees.rs | 4 +- runtime/common/Cargo.toml | 4 +- runtime/manta/src/diff_tx_fees.rs | 2 +- 8 files changed, 28 insertions(+), 127 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 03797e56b..43df6d392 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1121,8 +1121,8 @@ dependencies = [ "manta-collator-selection", "manta-primitives", "nimbus-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-traits", + "orml-xtokens", "pallet-asset-manager", "pallet-assets", "pallet-aura", @@ -4180,8 +4180,8 @@ dependencies = [ "manta-primitives", "manta-runtime", "nimbus-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-traits", + "orml-xtokens", "pallet-asset-manager", "pallet-assets", "pallet-balances", @@ -5490,7 +5490,7 @@ dependencies = [ "frame-support", "frame-system", "log", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-traits", "parity-scale-codec", "scale-info", "smallvec", @@ -5528,8 +5528,8 @@ dependencies = [ "manta-collator-selection", "manta-primitives", "nimbus-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-traits", + "orml-xtokens", "pallet-asset-manager", "pallet-assets", "pallet-aura", @@ -6387,48 +6387,12 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37#22a90420f4517a4b9fab81d2ee3937991dc1db54" -dependencies = [ - "frame-support", - "impl-trait-for-tuples", - "num-traits", - "orml-utilities 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37)", - "parity-scale-codec", - "scale-info", - "serde", - "sp-io", - "sp-runtime", - "sp-std", - "xcm", -] - -[[package]] -name = "orml-traits" -version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#4ff694c4b1e3c4a187410dddf948d86624601a24" -dependencies = [ - "frame-support", - "impl-trait-for-tuples", - "num-traits", - "orml-utilities 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "parity-scale-codec", - "scale-info", - "serde", - "sp-io", - "sp-runtime", - "sp-std", - "xcm", -] - -[[package]] -name = "orml-traits" -version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#9a1b0f1cf1835225b638311971eba5f30a1187c8" dependencies = [ "frame-support", "impl-trait-for-tuples", "num-traits", - "orml-utilities 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-utilities", "parity-scale-codec", "scale-info", "serde", @@ -6441,35 +6405,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37#22a90420f4517a4b9fab81d2ee3937991dc1db54" -dependencies = [ - "frame-support", - "parity-scale-codec", - "scale-info", - "serde", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "orml-utilities" -version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#4ff694c4b1e3c4a187410dddf948d86624601a24" -dependencies = [ - "frame-support", - "parity-scale-codec", - "scale-info", - "serde", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "orml-utilities" -version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" +source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#9a1b0f1cf1835225b638311971eba5f30a1187c8" dependencies = [ "frame-support", "parity-scale-codec", @@ -6486,21 +6422,7 @@ version = "0.4.1-dev" source = "git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37#9a1b0f1cf1835225b638311971eba5f30a1187c8" dependencies = [ "frame-support", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "parity-scale-codec", - "sp-runtime", - "sp-std", - "xcm", - "xcm-executor", -] - -[[package]] -name = "orml-xcm-support" -version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" -dependencies = [ - "frame-support", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-traits", "parity-scale-codec", "sp-runtime", "sp-std", @@ -6516,29 +6438,8 @@ dependencies = [ "cumulus-primitives-core", "frame-support", "frame-system", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "orml-xcm-support 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "pallet-xcm", - "parity-scale-codec", - "scale-info", - "serde", - "sp-io", - "sp-runtime", - "sp-std", - "xcm", - "xcm-executor", -] - -[[package]] -name = "orml-xtokens" -version = "0.4.1-dev" -source = "git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2#2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" -dependencies = [ - "cumulus-primitives-core", - "frame-support", - "frame-system", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xcm-support 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-traits", + "orml-xcm-support", "pallet-xcm", "parity-scale-codec", "scale-info", @@ -6591,7 +6492,7 @@ dependencies = [ "frame-system", "log", "manta-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=ghzlatarev/polkadot-v0.9.37)", + "orml-traits", "pallet-assets", "pallet-balances", "parity-scale-codec", @@ -6953,7 +6854,7 @@ dependencies = [ "hex-literal", "log", "manta-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-traits", "pallet-asset-manager", "pallet-assets", "pallet-balances", @@ -10153,8 +10054,8 @@ dependencies = [ "frame-system", "lazy_static", "manta-primitives", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", - "orml-xtokens 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?rev=2f31315b2c2997acd2f6e35c0bb406d91bb40fc2)", + "orml-traits", + "orml-xtokens", "pallet-asset-manager", "pallet-assets", "pallet-balances", @@ -15115,7 +15016,7 @@ dependencies = [ "frame-support", "frame-system", "log", - "orml-traits 0.4.1-dev (git+https://github.com/manta-network/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-traits", "pallet-balances", "parity-scale-codec", "scale-info", diff --git a/pallets/asset-manager/Cargo.toml b/pallets/asset-manager/Cargo.toml index 2c12f6a79..2f1e516f2 100644 --- a/pallets/asset-manager/Cargo.toml +++ b/pallets/asset-manager/Cargo.toml @@ -21,7 +21,7 @@ sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkad xcm = { git = "https://github.com/paritytech/polkadot.git", default-features = false, branch = "release-v0.9.37" } # 3rd party dependencies -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "ghzlatarev/polkadot-v0.9.37", default-features = false } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37", default-features = false } [dev-dependencies] pallet-assets = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" } diff --git a/pallets/farming/Cargo.toml b/pallets/farming/Cargo.toml index 115a3004d..ae8d1e369 100644 --- a/pallets/farming/Cargo.toml +++ b/pallets/farming/Cargo.toml @@ -24,7 +24,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false } manta-primitives = { path = '../../primitives/manta', default-features = false } -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37", default-features = false } pallet-asset-manager = { path = "../asset-manager", default-features = false, optional = true } pallet-assets = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37", default-features = false, optional = true } xcm = { git = "https://github.com/paritytech/polkadot.git", branch = "release-v0.9.37", default-features = false, optional = true } diff --git a/primitives/manta/Cargo.toml b/primitives/manta/Cargo.toml index 71a2fb056..8b5b068ff 100644 --- a/primitives/manta/Cargo.toml +++ b/primitives/manta/Cargo.toml @@ -28,7 +28,7 @@ xcm = { git = 'https://github.com/paritytech/polkadot.git', default-features = f xcm-builder = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.37" } xcm-executor = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.37" } -orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } +orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', branch = "polkadot-v0.9.37", default-features = false } [features] default = ["std"] diff --git a/runtime/calamari/Cargo.toml b/runtime/calamari/Cargo.toml index 1333fffe0..f4caac5b5 100644 --- a/runtime/calamari/Cargo.toml +++ b/runtime/calamari/Cargo.toml @@ -107,8 +107,8 @@ runtime-common = { path = '../common', default-features = false } session-key-primitives = { path = '../../primitives/session-keys', default-features = false } # Third party (vendored) dependencies -orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } -orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2", default-features = false } +orml-traits = { git = 'https://github.com/manta-network/open-runtime-module-library.git', branch = "polkadot-v0.9.37", default-features = false } +orml-xtokens = { git = 'https://github.com/manta-network/open-runtime-module-library.git', branch = "polkadot-v0.9.37", default-features = false } zenlink-protocol = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } zenlink-protocol-runtime-api = { git = 'https://github.com/manta-network/Zenlink', branch = "ghzlatarev/v0937", default-features = false } diff --git a/runtime/calamari/src/diff_tx_fees.rs b/runtime/calamari/src/diff_tx_fees.rs index 28079283d..e75f7de79 100644 --- a/runtime/calamari/src/diff_tx_fees.rs +++ b/runtime/calamari/src/diff_tx_fees.rs @@ -2923,7 +2923,7 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( use zenlink_protocol::AssetId as ZenlinkAssetId; assert_eq!( crate::RuntimeCall::get_call_names("ZenlinkProtocol").len(), - 16, + 17, "Please update new extrinsic here." ); // set_fee_receiver @@ -3171,7 +3171,7 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( // set_native_swap_fee_factor let call = crate::RuntimeCall::ZenlinkProtocol( zenlink_protocol::Call::set_native_swap_fee_factor { - set_native_swap_fee_factor: 200u128, + native_swap_fees_factor: 200u128, }, ); let (dispatch_info, call_len) = get_call_details(&call); diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 57e782928..76a89e73a 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -56,8 +56,8 @@ cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/cumul parachain-info = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.37" } # Orml dependencies -orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } -orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", rev = "2f31315b2c2997acd2f6e35c0bb406d91bb40fc2" } +orml-traits = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } +orml-xtokens = { git = "https://github.com/manta-network/open-runtime-module-library.git", branch = "polkadot-v0.9.37" } # Self dependencies pallet-asset-manager = { path = '../../pallets/asset-manager' } diff --git a/runtime/manta/src/diff_tx_fees.rs b/runtime/manta/src/diff_tx_fees.rs index e87684ff1..8c9f9b4aa 100644 --- a/runtime/manta/src/diff_tx_fees.rs +++ b/runtime/manta/src/diff_tx_fees.rs @@ -3158,7 +3158,7 @@ fn calculate_all_current_extrinsic_tx_fee() -> ( // set_native_swap_fee_factor let call = crate::RuntimeCall::ZenlinkProtocol( zenlink_protocol::Call::set_native_swap_fee_factor { - set_native_swap_fee_factor: 200u128, + native_swap_fees_factor: 200u128, }, ); let (dispatch_info, call_len) = get_call_details(&call); From b5ed51ed691f685204cdd1ec599cb973a5966648 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 09:24:32 +0300 Subject: [PATCH 15/21] Fix mocha test Signed-off-by: Georgi Zlatarev --- tests/tests/test-dex.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/test-dex.ts b/tests/tests/test-dex.ts index 15269ed45..e129ba9d6 100644 --- a/tests/tests/test-dex.ts +++ b/tests/tests/test-dex.ts @@ -83,7 +83,7 @@ describeWithManta("Manta RPC (Dex)", (context) => { state = await api.query.assets.account(10, alice); expect(JSON.parse(JSON.stringify(state))).to.equal(null); - callData = api.tx.zenlinkProtocol.setNativeSwapFeesFactor(200); + callData = api.tx.zenlinkProtocol.setNativeSwapFeeFactor(200); await executeTx(context, callData, true); await delay(12000); From 6328dd38c8046e5930e9f4fa836e7a3a299611b3 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 16:12:24 +0300 Subject: [PATCH 16/21] Use swapExacgtAssetsForAssets correctly in mocha test Signed-off-by: Georgi Zlatarev --- tests/tests/test-dex.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/test-dex.ts b/tests/tests/test-dex.ts index e129ba9d6..ccbf7f571 100644 --- a/tests/tests/test-dex.ts +++ b/tests/tests/test-dex.ts @@ -95,7 +95,7 @@ describeWithManta("Manta RPC (Dex)", (context) => { MANTA_1K, USDT_10M, MANTA_1K, USDT_10M, 1000); await executeTx(context, callData); - callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(100,10,[1,8],alice,1000000); + callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(100,10,[[parachainId,0,1],[parachainId,2,8],alice,1000000); await executeTx(context, callData); await delay(24000); From 8f5cf3b870af16e3352afeebf7579e786019cd56 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Thu, 31 Aug 2023 20:21:28 +0300 Subject: [PATCH 17/21] Use swapExacgtAssetsForAssets correctly in mocha test Signed-off-by: Georgi Zlatarev --- tests/tests/test-dex.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/test-dex.ts b/tests/tests/test-dex.ts index ccbf7f571..a618751c7 100644 --- a/tests/tests/test-dex.ts +++ b/tests/tests/test-dex.ts @@ -95,7 +95,7 @@ describeWithManta("Manta RPC (Dex)", (context) => { MANTA_1K, USDT_10M, MANTA_1K, USDT_10M, 1000); await executeTx(context, callData); - callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(100,10,[[parachainId,0,1],[parachainId,2,8],alice,1000000); + callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(100,10,[[parachainId,0,1],[parachainId,2,8]],alice,1000000); await executeTx(context, callData); await delay(24000); From fbe80e79e2f0720164938b7af39e366a35f00bd6 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Sun, 10 Sep 2023 12:01:32 +0300 Subject: [PATCH 18/21] Add a CI test for dex swap fees Signed-off-by: Georgi Zlatarev --- tests/constants.ts | 13 +++++++++++++ tests/tests/test-dex.ts | 32 +++++++++++++++----------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/tests/constants.ts b/tests/constants.ts index 67ad95a23..1a89c5b86 100644 --- a/tests/constants.ts +++ b/tests/constants.ts @@ -2,6 +2,8 @@ import {BN} from "@polkadot/util"; export const MANTA_1B = "1000000000000000000000000000"; export const MANTA_1K = new BN("1000000000000000000000"); +export const MANTA_1M = new BN("1000000000000000000000000"); +export const MANTA_10M = new BN("10000000000000000000000000"); export const LP_1K = "1000000000000000"; export const LP_2K = "2000000000000000"; export const USDT_10M = new BN("10000000000000"); @@ -89,4 +91,15 @@ export const LP_USDT_USDC_METADATA = { }, minBalance: 1, isSufficient: true +}; + +export const LP_NATIVE_USDT_METADATA = { + metadata: { + name: "LP-NATIVE-USDT", + symbol: "LP", + decimals: 12, + isFrozen: false + }, + minBalance: 1, + isSufficient: true }; \ No newline at end of file diff --git a/tests/tests/test-dex.ts b/tests/tests/test-dex.ts index a618751c7..73cc4aa5c 100644 --- a/tests/tests/test-dex.ts +++ b/tests/tests/test-dex.ts @@ -4,7 +4,8 @@ import {describeWithManta, executeTx, remark} from "./util"; import '@polkadot/api-augment'; import { LP_1K, LP_2K, - LP_USDT_USDC_METADATA, MANTA_1K, USDC_10M, USDC_20M, + LP_USDT_USDC_METADATA, LP_NATIVE_USDT_METADATA, + MANTA_1K, MANTA_1M, MANTA_10M, USDC_10M, USDC_20M, USDC_LOCATION, USDC_METADATA, USDT_10M, USDT_20M, @@ -83,31 +84,28 @@ describeWithManta("Manta RPC (Dex)", (context) => { state = await api.query.assets.account(10, alice); expect(JSON.parse(JSON.stringify(state))).to.equal(null); - callData = api.tx.zenlinkProtocol.setNativeSwapFeeFactor(200); + let fees_factor = 200; // 0.5% + callData = api.tx.zenlinkProtocol.setNativeSwapFeeFactor(fees_factor); await executeTx(context, callData, true); - await delay(12000); + callData = api.tx.assetManager.registerLpAsset(1, 8, LP_NATIVE_USDT_METADATA); + await executeTx(context, callData, true); + + await new Promise((res) => setTimeout(res, 2000)); - callData = api.tx.zenlinkProtocol.createPair([parachainId,0,1], [parachainId,2,8]); + callData = api.tx.zenlinkProtocol.createPair([parachainId,0,0], [parachainId,2,8]); await executeTx(context, callData, true); - callData = api.tx.zenlinkProtocol.addLiquidity([parachainId,0,1], [parachainId,2,8], - MANTA_1K, USDT_10M, MANTA_1K, USDT_10M, 1000); + callData = api.tx.zenlinkProtocol.addLiquidity([parachainId,0,0], [parachainId,2,8], + MANTA_10M, USDT_10M, MANTA_10M, USDT_10M, 1000); await executeTx(context, callData); - callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(100,10,[[parachainId,0,1],[parachainId,2,8]],alice,1000000); + callData = api.tx.zenlinkProtocol.swapExactAssetsForAssets(MANTA_1M,100,[[parachainId,0,0],[parachainId,2,8]],alice,1000); await executeTx(context, callData); - await delay(24000); - - const swapFeesBalance = (await api.query.system.account("0x2f73776170706f74000000000000000000000000000000000000000000000000")).data.free.toString(); + const expectedSwapFee = new BN("5000000000000000000000"); + const swapFeesBalance = (await api.query.system.account("dfZ2W8UP6LNgBri4nYSZaXXLUpXbvZM6KhpxPQnFJiKkdVvZi")).data.free.toString(); console.log("Swap fees pot balance: ", swapFeesBalance); - const swapFeesBalance2 = (await api.query.system.account("0x2f73776170706f7400000000000000000000000000000000000000000000000000")).data.free.toString(); - console.log("Swap fees pot balance: ", swapFeesBalance2); - // #[pallet::compact] amount_in: AssetBalance, - // #[pallet::compact] amount_out_min: AssetBalance, - // path: Vec, - // recipient: T::AccountId, - // #[pallet::compact] deadline: T::BlockNumber, + expect(swapFeesBalance).to.equal(expectedSwapFee.toString()) }); }); \ No newline at end of file From 4c563fc435b9bf99b12a8dde0520ba9ea88c7046 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Sun, 10 Sep 2023 16:03:29 +0300 Subject: [PATCH 19/21] Update linter CI Signed-off-by: Georgi Zlatarev --- .github/workflows/run_linters.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_linters.yml b/.github/workflows/run_linters.yml index f31a36fd3..f7c2ad7de 100644 --- a/.github/workflows/run_linters.yml +++ b/.github/workflows/run_linters.yml @@ -53,8 +53,8 @@ jobs: protoc --version curl -s https://sh.rustup.rs -sSf | sh -s -- -y source ${HOME}/.cargo/env - rustup toolchain install nightly-2023-03-13 - rustup default nightly-2023-03-13 + rustup toolchain install nightly-2023-09-01 + rustup default nightly-2023-09-01 cargo install taplo-cli - name: cache cargo uses: Swatinem/rust-cache@v2 From e26fb0b8f3935036c4b6c8c415c57d5304af76f6 Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Sun, 10 Sep 2023 16:26:34 +0300 Subject: [PATCH 20/21] Fix taplo-cli install dependencies issue with --locked Signed-off-by: Georgi Zlatarev --- .github/workflows/run_linters.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_linters.yml b/.github/workflows/run_linters.yml index f7c2ad7de..865714013 100644 --- a/.github/workflows/run_linters.yml +++ b/.github/workflows/run_linters.yml @@ -53,9 +53,9 @@ jobs: protoc --version curl -s https://sh.rustup.rs -sSf | sh -s -- -y source ${HOME}/.cargo/env - rustup toolchain install nightly-2023-09-01 - rustup default nightly-2023-09-01 - cargo install taplo-cli + rustup toolchain install nightly-2023-06-01 + rustup default nightly-2023-06-01 + cargo install taplo-cli --locked - name: cache cargo uses: Swatinem/rust-cache@v2 - name: Check Formatting From d74de75cd637c5b51961d78c97b30c8266cb1b9e Mon Sep 17 00:00:00 2001 From: Georgi Zlatarev Date: Sun, 10 Sep 2023 17:06:24 +0300 Subject: [PATCH 21/21] Use 03.03 nightly Signed-off-by: Georgi Zlatarev --- .github/workflows/run_linters.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_linters.yml b/.github/workflows/run_linters.yml index 865714013..9664c5316 100644 --- a/.github/workflows/run_linters.yml +++ b/.github/workflows/run_linters.yml @@ -53,8 +53,8 @@ jobs: protoc --version curl -s https://sh.rustup.rs -sSf | sh -s -- -y source ${HOME}/.cargo/env - rustup toolchain install nightly-2023-06-01 - rustup default nightly-2023-06-01 + rustup toolchain install nightly-2023-03-03 + rustup default nightly-2023-03-03 cargo install taplo-cli --locked - name: cache cargo uses: Swatinem/rust-cache@v2