Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
68 changes: 50 additions & 18 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion pallets/asset-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion pallets/farming/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion primitives/manta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
8 changes: 4 additions & 4 deletions runtime/calamari/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ 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 = "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']
Expand Down
2 changes: 2 additions & 0 deletions runtime/calamari/src/zenlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"))]
Expand Down
4 changes: 2 additions & 2 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
4 changes: 2 additions & 2 deletions runtime/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
8 changes: 4 additions & 4 deletions runtime/manta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ 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 = "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 }
Expand Down
2 changes: 2 additions & 0 deletions runtime/manta/src/zenlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"))]
Expand Down
23 changes: 23 additions & 0 deletions tests/tests/test-dex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -81,5 +82,27 @@ 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);

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();
console.log("Swap fees pot balance: ", swapFeesBalance2);
// #[pallet::compact] amount_in: AssetBalance,
// #[pallet::compact] amount_out_min: AssetBalance,
// path: Vec<T::AssetId>,
// recipient: T::AccountId,
// #[pallet::compact] deadline: T::BlockNumber,
});
});