diff --git a/Cargo.lock b/Cargo.lock index 074de802cc..d951ca9b15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3739,6 +3739,8 @@ dependencies = [ "testnet-kintsugi-runtime-parachain", "try-runtime-cli", "vault-registry-rpc-runtime-api", + "zenlink-protocol-runtime-api", + "zenlink-stable-amm-runtime-api", ] [[package]] @@ -3785,6 +3787,10 @@ dependencies = [ "substrate-frame-rpc-system", "vault-registry", "vault-registry-rpc", + "zenlink-protocol-rpc", + "zenlink-protocol-runtime-api", + "zenlink-stable-amm-rpc", + "zenlink-stable-amm-runtime-api", ] [[package]] @@ -3880,6 +3886,9 @@ dependencies = [ "vault-registry", "vault-registry-rpc-runtime-api", "xcm-builder", + "zenlink-protocol", + "zenlink-protocol-runtime-api", + "zenlink-stable-amm-runtime-api", ] [[package]] @@ -4029,6 +4038,9 @@ dependencies = [ "xcm", "xcm-builder", "xcm-executor", + "zenlink-protocol", + "zenlink-protocol-runtime-api", + "zenlink-stable-amm-runtime-api", ] [[package]] @@ -4419,6 +4431,9 @@ dependencies = [ "xcm", "xcm-builder", "xcm-executor", + "zenlink-protocol", + "zenlink-protocol-runtime-api", + "zenlink-stable-amm-runtime-api", ] [[package]] @@ -12478,6 +12493,11 @@ dependencies = [ "xcm", "xcm-builder", "xcm-executor", + "zenlink-protocol", + "zenlink-protocol-runtime-api", + "zenlink-stable-amm", + "zenlink-stable-amm-runtime-api", + "zenlink-swap-router", ] [[package]] @@ -13083,7 +13103,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.6", - "rand 0.8.5", + "rand 0.6.5", "static_assertions", ] @@ -14177,7 +14197,7 @@ dependencies = [ [[package]] name = "zenlink-protocol" version = "0.4.4" -source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=8d120c4a41e977892b8e4e6067c7832973048341#8d120c4a41e977892b8e4e6067c7832973048341" +source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=1d286f77d8fe38f3a437d35a0600081c2f5b5a00#1d286f77d8fe38f3a437d35a0600081c2f5b5a00" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14197,10 +14217,25 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "zenlink-protocol-rpc" +version = "0.4.4" +source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=1d286f77d8fe38f3a437d35a0600081c2f5b5a00#1d286f77d8fe38f3a437d35a0600081c2f5b5a00" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sp-api", + "sp-blockchain", + "sp-rpc", + "sp-runtime", + "zenlink-protocol", + "zenlink-protocol-runtime-api", +] + [[package]] name = "zenlink-protocol-runtime-api" version = "0.4.4" -source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=8d120c4a41e977892b8e4e6067c7832973048341#8d120c4a41e977892b8e4e6067c7832973048341" +source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=1d286f77d8fe38f3a437d35a0600081c2f5b5a00#1d286f77d8fe38f3a437d35a0600081c2f5b5a00" dependencies = [ "parity-scale-codec", "sp-api", @@ -14211,7 +14246,7 @@ dependencies = [ [[package]] name = "zenlink-stable-amm" version = "0.1.0" -source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=8d120c4a41e977892b8e4e6067c7832973048341#8d120c4a41e977892b8e4e6067c7832973048341" +source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=1d286f77d8fe38f3a437d35a0600081c2f5b5a00#1d286f77d8fe38f3a437d35a0600081c2f5b5a00" dependencies = [ "frame-support", "frame-system", @@ -14225,10 +14260,24 @@ dependencies = [ "sp-std", ] +[[package]] +name = "zenlink-stable-amm-rpc" +version = "0.1.0" +source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=1d286f77d8fe38f3a437d35a0600081c2f5b5a00#1d286f77d8fe38f3a437d35a0600081c2f5b5a00" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sp-api", + "sp-blockchain", + "sp-rpc", + "sp-runtime", + "zenlink-stable-amm-runtime-api", +] + [[package]] name = "zenlink-stable-amm-runtime-api" version = "0.1.0" -source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=8d120c4a41e977892b8e4e6067c7832973048341#8d120c4a41e977892b8e4e6067c7832973048341" +source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=1d286f77d8fe38f3a437d35a0600081c2f5b5a00#1d286f77d8fe38f3a437d35a0600081c2f5b5a00" dependencies = [ "parity-scale-codec", "sp-api", @@ -14239,7 +14288,7 @@ dependencies = [ [[package]] name = "zenlink-swap-router" version = "0.1.0" -source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=8d120c4a41e977892b8e4e6067c7832973048341#8d120c4a41e977892b8e4e6067c7832973048341" +source = "git+https://github.com/interlay/Zenlink-DEX-Module?rev=1d286f77d8fe38f3a437d35a0600081c2f5b5a00#1d286f77d8fe38f3a437d35a0600081c2f5b5a00" dependencies = [ "frame-support", "frame-system", diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index a0e249f19c..7186253e00 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -46,6 +46,10 @@ redeem-rpc-runtime-api = { path = "../crates/redeem/rpc/runtime-api" } replace-rpc-runtime-api = { path = "../crates/replace/rpc/runtime-api" } loans-rpc-runtime-api = { path = "../crates/loans/rpc/runtime-api" } +# Zenlink dependencies +zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00" } +zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00" } + # Substrate dependencies sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } diff --git a/parachain/runtime/interlay/Cargo.toml b/parachain/runtime/interlay/Cargo.toml index 36219c95f3..a32563d013 100644 --- a/parachain/runtime/interlay/Cargo.toml +++ b/parachain/runtime/interlay/Cargo.toml @@ -121,6 +121,11 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } orml-asset-registry= { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } +# Zenlink dependencies +zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } + [dev-dependencies] hex = '0.4.2' mocktopus = "0.8.0" @@ -238,6 +243,10 @@ std = [ "orml-xcm-support/std", "orml-unknown-tokens/std", "orml-asset-registry/std", + + "zenlink-protocol/std", + "zenlink-protocol-runtime-api/std", + "zenlink-stable-amm-runtime-api/std", ] runtime-benchmarks = [ "frame-benchmarking", @@ -316,5 +325,6 @@ try-runtime = [ "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-dmp-queue/try-runtime", "orml-xtokens/try-runtime", - "orml-unknown-tokens/try-runtime" + "orml-unknown-tokens/try-runtime", + "zenlink-protocol/try-runtime", ] \ No newline at end of file diff --git a/parachain/runtime/interlay/src/lib.rs b/parachain/runtime/interlay/src/lib.rs index d40d9c98fb..f4e30d977e 100644 --- a/parachain/runtime/interlay/src/lib.rs +++ b/parachain/runtime/interlay/src/lib.rs @@ -69,7 +69,7 @@ pub use security::StatusCode; pub use primitives::{ self, AccountId, Balance, BlockNumber, CurrencyInfo, Hash, Liquidity, Moment, Nonce, Rate, Ratio, Shortfall, - Signature, SignedFixedPoint, SignedInner, UnsignedFixedPoint, UnsignedInner, + Signature, SignedFixedPoint, SignedInner, StablePoolId, UnsignedFixedPoint, UnsignedInner, }; // XCM imports @@ -1413,6 +1413,111 @@ impl_runtime_apis! { } } + impl zenlink_protocol_runtime_api::ZenlinkProtocolApi for Runtime { + fn get_balance( + _asset_id: CurrencyId, + _owner: AccountId + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_sovereigns_info( + _asset_id: CurrencyId + ) -> Vec<(u32, AccountId, zenlink_protocol::AssetBalance)> { + Default::default() + } + + fn get_pair_by_asset_id( + _asset_0: CurrencyId, + _asset_1: CurrencyId + ) -> Option> { + Default::default() + } + + fn get_amount_in_price( + _supply: zenlink_protocol::AssetBalance, + _path: Vec + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_amount_out_price( + _supply: zenlink_protocol::AssetBalance, + _path: Vec + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_estimate_lptoken( + _asset_0: CurrencyId, + _asset_1: CurrencyId, + _amount_0_desired: zenlink_protocol::AssetBalance, + _amount_1_desired: zenlink_protocol::AssetBalance, + _amount_0_min: zenlink_protocol::AssetBalance, + _amount_1_min: zenlink_protocol::AssetBalance, + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + } + + impl zenlink_stable_amm_runtime_api::StableAmmApi for Runtime { + fn get_virtual_price(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_a(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_a_precise(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_currencies(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_currency(_pool_id: StablePoolId, _index: u32) -> Option { + Default::default() + } + + fn get_lp_currency(_pool_id: StablePoolId) -> Option { + Default::default() + } + + fn get_currency_precision_multipliers(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_currency_balances(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_number_of_currencies(_pool_id: StablePoolId) -> u32 { + Default::default() + } + + fn get_admin_balances(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn calculate_currency_amount(_pool_id: StablePoolId, _amounts: Vec, _deposit: bool) -> Balance { + Default::default() + } + + fn calculate_swap(_pool_id: StablePoolId, _in_index: u32, _out_index: u32, _in_amount: Balance) -> Balance { + Default::default() + } + + fn calculate_remove_liquidity(_pool_id: StablePoolId, _amount: Balance) -> Vec { + Default::default() + } + + fn calculate_remove_liquidity_one_currency(_pool_id: StablePoolId, _amount: Balance, _index: u32) -> Balance { + Default::default() + } + } + #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { fn benchmark_metadata(extra: bool) -> ( diff --git a/parachain/runtime/kintsugi/Cargo.toml b/parachain/runtime/kintsugi/Cargo.toml index bda9c6f6cb..70d39543a8 100644 --- a/parachain/runtime/kintsugi/Cargo.toml +++ b/parachain/runtime/kintsugi/Cargo.toml @@ -122,6 +122,11 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } orml-asset-registry= { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } +# Zenlink dependencies +zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } + [dev-dependencies] hex = '0.4.2' mocktopus = "0.8.0" @@ -244,6 +249,10 @@ std = [ "orml-xtokens/std", "orml-xcm-support/std", "orml-unknown-tokens/std", + + "zenlink-protocol/std", + "zenlink-protocol-runtime-api/std", + "zenlink-stable-amm-runtime-api/std", ] runtime-benchmarks = [ "frame-benchmarking", @@ -320,5 +329,6 @@ try-runtime = [ "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-dmp-queue/try-runtime", "orml-xtokens/try-runtime", - "orml-unknown-tokens/try-runtime" + "orml-unknown-tokens/try-runtime", + "zenlink-protocol/try-runtime", ] diff --git a/parachain/runtime/kintsugi/src/lib.rs b/parachain/runtime/kintsugi/src/lib.rs index 9fa1d6e773..da453ed576 100644 --- a/parachain/runtime/kintsugi/src/lib.rs +++ b/parachain/runtime/kintsugi/src/lib.rs @@ -67,7 +67,7 @@ pub use security::StatusCode; pub use primitives::{ self, AccountId, Balance, BlockNumber, CurrencyInfo, Hash, Liquidity, Moment, Nonce, Rate, Ratio, Shortfall, - Signature, SignedFixedPoint, SignedInner, UnsignedFixedPoint, UnsignedInner, + Signature, SignedFixedPoint, SignedInner, StablePoolId, UnsignedFixedPoint, UnsignedInner, }; // XCM imports @@ -1672,6 +1672,111 @@ impl_runtime_apis! { } } + impl zenlink_protocol_runtime_api::ZenlinkProtocolApi for Runtime { + fn get_balance( + _asset_id: CurrencyId, + _owner: AccountId + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_sovereigns_info( + _asset_id: CurrencyId + ) -> Vec<(u32, AccountId, zenlink_protocol::AssetBalance)> { + Default::default() + } + + fn get_pair_by_asset_id( + _asset_0: CurrencyId, + _asset_1: CurrencyId + ) -> Option> { + Default::default() + } + + fn get_amount_in_price( + _supply: zenlink_protocol::AssetBalance, + _path: Vec + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_amount_out_price( + _supply: zenlink_protocol::AssetBalance, + _path: Vec + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_estimate_lptoken( + _asset_0: CurrencyId, + _asset_1: CurrencyId, + _amount_0_desired: zenlink_protocol::AssetBalance, + _amount_1_desired: zenlink_protocol::AssetBalance, + _amount_0_min: zenlink_protocol::AssetBalance, + _amount_1_min: zenlink_protocol::AssetBalance, + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + } + + impl zenlink_stable_amm_runtime_api::StableAmmApi for Runtime { + fn get_virtual_price(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_a(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_a_precise(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_currencies(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_currency(_pool_id: StablePoolId, _index: u32) -> Option { + Default::default() + } + + fn get_lp_currency(_pool_id: StablePoolId) -> Option { + Default::default() + } + + fn get_currency_precision_multipliers(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_currency_balances(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_number_of_currencies(_pool_id: StablePoolId) -> u32 { + Default::default() + } + + fn get_admin_balances(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn calculate_currency_amount(_pool_id: StablePoolId, _amounts: Vec, _deposit: bool) -> Balance { + Default::default() + } + + fn calculate_swap(_pool_id: StablePoolId, _in_index: u32, _out_index: u32, _in_amount: Balance) -> Balance { + Default::default() + } + + fn calculate_remove_liquidity(_pool_id: StablePoolId, _amount: Balance) -> Vec { + Default::default() + } + + fn calculate_remove_liquidity_one_currency(_pool_id: StablePoolId, _amount: Balance, _index: u32) -> Balance { + Default::default() + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { diff --git a/parachain/runtime/testnet-interlay/Cargo.toml b/parachain/runtime/testnet-interlay/Cargo.toml index 2288d9e196..dde08582de 100644 --- a/parachain/runtime/testnet-interlay/Cargo.toml +++ b/parachain/runtime/testnet-interlay/Cargo.toml @@ -123,6 +123,13 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } orml-asset-registry= { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } +# Zenlink dependencies +zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-stable-amm = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-swap-router = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } + [dev-dependencies] hex = '0.4.2' mocktopus = "0.8.0" @@ -245,6 +252,12 @@ std = [ "orml-xtokens/std", "orml-xcm-support/std", "orml-unknown-tokens/std", + + "zenlink-protocol/std", + "zenlink-protocol-runtime-api/std", + "zenlink-stable-amm/std", + "zenlink-stable-amm-runtime-api/std", + "zenlink-swap-router/std", ] runtime-benchmarks = [ "frame-benchmarking", @@ -327,5 +340,8 @@ try-runtime = [ "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-dmp-queue/try-runtime", "orml-xtokens/try-runtime", - "orml-unknown-tokens/try-runtime" + "orml-unknown-tokens/try-runtime", + "zenlink-protocol/try-runtime", + "zenlink-stable-amm/try-runtime", + "zenlink-swap-router/try-runtime", ] \ No newline at end of file diff --git a/parachain/runtime/testnet-interlay/src/lib.rs b/parachain/runtime/testnet-interlay/src/lib.rs index 4f0552c72a..610e7b4915 100644 --- a/parachain/runtime/testnet-interlay/src/lib.rs +++ b/parachain/runtime/testnet-interlay/src/lib.rs @@ -70,7 +70,7 @@ pub use primitives::{ self, AccountId, Balance, BlockNumber, CurrencyId::{ForeignAsset, LendToken, Token}, CurrencyInfo, Hash, Liquidity, Moment, Nonce, Rate, Ratio, Shortfall, Signature, SignedFixedPoint, SignedInner, - UnsignedFixedPoint, UnsignedInner, + StablePoolId, UnsignedFixedPoint, UnsignedInner, }; // XCM imports @@ -81,6 +81,8 @@ use xcm_config::ParentLocation; pub mod constants; pub mod xcm_config; +mod zenlink; + type VaultId = primitives::VaultId; impl_opaque_keys! { @@ -1208,8 +1210,11 @@ construct_runtime! { XTokens: orml_xtokens::{Pallet, Storage, Call, Event} = 94, UnknownTokens: orml_unknown_tokens::{Pallet, Storage, Event} = 95, - // # Lending + // # Lending & AMM Loans: loans::{Pallet, Call, Storage, Event, Config} = 100, + ZenlinkProtocol: zenlink_protocol::{Pallet, Call, Storage, Event} = 101, + ZenlinkStableAmm: zenlink_stable_amm::{Pallet, Call, Storage, Event} = 102, + ZenlinkSwapRouter: zenlink_swap_router::{Pallet, Call, Event} = 103, } } @@ -1628,6 +1633,123 @@ impl_runtime_apis! { } } + impl zenlink_protocol_runtime_api::ZenlinkProtocolApi for Runtime { + fn get_balance( + asset_id: CurrencyId, + owner: AccountId + ) -> zenlink::AssetBalance { + use zenlink_protocol::MultiAssetsHandler; + ::MultiAssetsHandler::balance_of(asset_id, &owner) + } + + fn get_sovereigns_info( + asset_id: CurrencyId + ) -> Vec<(u32, AccountId, zenlink::AssetBalance)> { + ZenlinkProtocol::get_sovereigns_info(&asset_id) + } + + fn get_pair_by_asset_id( + asset_0: CurrencyId, + asset_1: CurrencyId + ) -> Option> { + ZenlinkProtocol::get_pair_by_asset_id(asset_0, asset_1) + } + + fn get_amount_in_price( + supply: zenlink::AssetBalance, + path: Vec + ) -> zenlink::AssetBalance { + ZenlinkProtocol::desired_in_amount(supply, path) + } + + fn get_amount_out_price( + supply: zenlink::AssetBalance, + path: Vec + ) -> zenlink::AssetBalance { + ZenlinkProtocol::supply_out_amount(supply, path) + } + + fn get_estimate_lptoken( + asset_0: CurrencyId, + asset_1: CurrencyId, + amount_0_desired: zenlink::AssetBalance, + amount_1_desired: zenlink::AssetBalance, + amount_0_min: zenlink::AssetBalance, + amount_1_min: zenlink::AssetBalance, + ) -> zenlink::AssetBalance{ + ZenlinkProtocol::get_estimate_lptoken( + asset_0, + asset_1, + amount_0_desired, + amount_1_desired, + amount_0_min, + amount_1_min + ) + } + } + + impl zenlink_stable_amm_runtime_api::StableAmmApi for Runtime { + fn get_virtual_price(pool_id: StablePoolId) -> Balance { + ZenlinkStableAmm::get_virtual_price(pool_id) + } + + fn get_a(pool_id: StablePoolId) -> Balance { + ZenlinkStableAmm::get_a(pool_id) + } + + fn get_a_precise(pool_id: StablePoolId) -> Balance { + ZenlinkStableAmm::get_a(pool_id) * 100 + } + + fn get_currencies(pool_id: StablePoolId) -> Vec { + ZenlinkStableAmm::get_currencies(pool_id) + } + + fn get_currency(pool_id: StablePoolId, index: u32) -> Option { + ZenlinkStableAmm::get_currency(pool_id, index) + } + + fn get_lp_currency(pool_id: StablePoolId) -> Option { + ZenlinkStableAmm::get_lp_currency(pool_id) + } + + fn get_currency_precision_multipliers(pool_id: StablePoolId) -> Vec { + ZenlinkStableAmm::get_currency_precision_multipliers(pool_id) + } + + fn get_currency_balances(pool_id: StablePoolId) -> Vec { + ZenlinkStableAmm::get_currency_balances(pool_id) + } + + fn get_number_of_currencies(pool_id: StablePoolId) -> u32 { + ZenlinkStableAmm::get_number_of_currencies(pool_id) + } + + fn get_admin_balances(pool_id: StablePoolId) -> Vec { + ZenlinkStableAmm::get_admin_balances(pool_id) + } + + fn calculate_currency_amount(pool_id: StablePoolId, amounts: Vec, deposit: bool) -> Balance { + use zenlink_stable_amm::traits::StableAmmApi; + ZenlinkStableAmm::stable_amm_calculate_currency_amount(pool_id, &amounts, deposit).unwrap_or_default() + } + + fn calculate_swap(pool_id: StablePoolId, in_index: u32, out_index: u32, in_amount: Balance) -> Balance { + use zenlink_stable_amm::traits::StableAmmApi; + ZenlinkStableAmm::stable_amm_calculate_swap_amount(pool_id, in_index as usize, out_index as usize, in_amount).unwrap_or_default() + } + + fn calculate_remove_liquidity(pool_id: StablePoolId, amount: Balance) -> Vec { + use zenlink_stable_amm::traits::StableAmmApi; + ZenlinkStableAmm::stable_amm_calculate_remove_liquidity(pool_id, amount).unwrap_or_default() + } + + fn calculate_remove_liquidity_one_currency(pool_id: StablePoolId, amount: Balance, index: u32) -> Balance { + use zenlink_stable_amm::traits::StableAmmApi; + ZenlinkStableAmm::stable_amm_calculate_remove_liquidity_one_currency(pool_id, amount, index).unwrap_or_default() + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { diff --git a/parachain/runtime/testnet-interlay/src/zenlink.rs b/parachain/runtime/testnet-interlay/src/zenlink.rs new file mode 100644 index 0000000000..7e492cddab --- /dev/null +++ b/parachain/runtime/testnet-interlay/src/zenlink.rs @@ -0,0 +1,133 @@ +use super::{ + parameter_types, AccountId, Balance, CurrencyId, Get, PalletId, ParachainInfo, Runtime, RuntimeEvent, StablePoolId, + Timestamp, Tokens, ZenlinkProtocol, ZenlinkStableAmm, +}; +use frame_support::dispatch::DispatchError; +use orml_traits::MultiCurrency; +use sp_std::{marker::PhantomData, vec, vec::Vec}; +use xcm::latest::prelude::*; + +use zenlink_protocol::ConvertMultiLocation; +pub use zenlink_protocol::{ + make_x2_location, AssetBalance, GenerateLpAssetId, MultiAssetsHandler, PairInfo, TransactorAdaptor, TrustedParas, + ZenlinkMultiAssets, LIQUIDITY, LOCAL, +}; + +pub use zenlink_stable_amm::traits::{StablePoolLpCurrencyIdGenerate, ValidateCurrency}; + +parameter_types! { + pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); + pub const StableAmmPalletId: PalletId = PalletId(*b"stbl/amm"); + pub const StringLimit: u32 = 50; + + // XCM + pub SelfParaId: u32 = ParachainInfo::get().into(); + pub ZenlinkRegisteredParaChains: Vec<(MultiLocation, u128)> = vec![]; +} + +pub struct MultiAssetsAdaptor(PhantomData); + +impl MultiAssetsHandler for MultiAssetsAdaptor +where + Tokens: MultiCurrency, +{ + fn balance_of(asset_id: CurrencyId, who: &AccountId) -> AssetBalance { + Tokens::free_balance(asset_id, who) + } + + fn total_supply(asset_id: CurrencyId) -> AssetBalance { + Tokens::total_issuance(asset_id) + } + + fn is_exists(asset_id: CurrencyId) -> bool { + Tokens::total_issuance(asset_id) > AssetBalance::default() + } + + fn deposit(asset_id: CurrencyId, target: &AccountId, amount: AssetBalance) -> Result { + Tokens::deposit(asset_id, target, amount)?; + Ok(amount) + } + + fn withdraw(asset_id: CurrencyId, origin: &AccountId, amount: AssetBalance) -> Result { + Tokens::withdraw(asset_id, origin, amount)?; + Ok(amount) + } +} + +pub struct PairLpIdentity; +impl GenerateLpAssetId for PairLpIdentity { + fn generate_lp_asset_id(asset_0: CurrencyId, asset_1: CurrencyId) -> Option { + CurrencyId::join_lp_token(asset_0, asset_1) + } +} + +pub struct NoConvert; +impl ConvertMultiLocation for NoConvert { + fn chain_id(_asset_id: &AssetId) -> u32 { + 0 + } + fn make_x3_location(_asset_id: &AssetId) -> MultiLocation { + Default::default() + } +} + +impl zenlink_protocol::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MultiAssetsHandler = MultiAssetsAdaptor; + type PalletId = ZenlinkPalletId; + type AssetId = CurrencyId; + type LpGenerate = PairLpIdentity; + // NOTE: XCM not supported + type XcmExecutor = (); + type SelfParaId = SelfParaId; + type TargetChains = ZenlinkRegisteredParaChains; + type AccountIdConverter = (); + // no-op since XCM is disabled + type AssetIdConverter = NoConvert; + type WeightInfo = (); +} + +pub struct PoolLpGenerate; +impl StablePoolLpCurrencyIdGenerate for PoolLpGenerate { + fn generate_by_pool_id(pool_id: StablePoolId) -> CurrencyId { + CurrencyId::StableLpToken(pool_id) + } +} + +pub struct StableAmmVerifyPoolAsset; +impl ValidateCurrency for StableAmmVerifyPoolAsset { + fn validate_pooled_currency(_currencies: &[CurrencyId]) -> bool { + true + } + + fn validate_pool_lp_currency(currency_id: CurrencyId) -> bool { + if Tokens::total_issuance(currency_id) > 0 { + return false; + } + true + } +} + +impl zenlink_stable_amm::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type CurrencyId = CurrencyId; + type MultiCurrency = Tokens; + type PoolId = StablePoolId; + type TimeProvider = Timestamp; + type EnsurePoolAsset = StableAmmVerifyPoolAsset; + type LpGenerate = PoolLpGenerate; + type PoolCurrencySymbolLimit = StringLimit; + type PalletId = StableAmmPalletId; + type WeightInfo = (); +} + +impl zenlink_swap_router::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StablePoolId = StablePoolId; + type Balance = Balance; + type StableCurrencyId = CurrencyId; + type NormalCurrencyId = CurrencyId; + type NormalAmm = ZenlinkProtocol; + type StableAMM = ZenlinkStableAmm; + type WeightInfo = (); +} diff --git a/parachain/runtime/testnet-kintsugi/Cargo.toml b/parachain/runtime/testnet-kintsugi/Cargo.toml index c2e0bdfaf8..7e7a17f09a 100644 --- a/parachain/runtime/testnet-kintsugi/Cargo.toml +++ b/parachain/runtime/testnet-kintsugi/Cargo.toml @@ -125,11 +125,11 @@ orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-m orml-asset-registry= { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } # Zenlink dependencies -zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "8d120c4a41e977892b8e4e6067c7832973048341", default-features = false } -zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "8d120c4a41e977892b8e4e6067c7832973048341", default-features = false } -zenlink-stable-amm = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "8d120c4a41e977892b8e4e6067c7832973048341", default-features = false } -zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "8d120c4a41e977892b8e4e6067c7832973048341", default-features = false } -zenlink-swap-router = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "8d120c4a41e977892b8e4e6067c7832973048341", default-features = false } +zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-stable-amm = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-swap-router = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } [dev-dependencies] hex = '0.4.2' @@ -259,7 +259,7 @@ std = [ "zenlink-protocol-runtime-api/std", "zenlink-stable-amm/std", "zenlink-stable-amm-runtime-api/std", - "zenlink-swap-router/std" + "zenlink-swap-router/std", ] runtime-benchmarks = [ "frame-benchmarking", @@ -347,5 +347,5 @@ try-runtime = [ "orml-unknown-tokens/try-runtime", "zenlink-protocol/try-runtime", "zenlink-stable-amm/try-runtime", - "zenlink-swap-router/try-runtime" + "zenlink-swap-router/try-runtime", ] diff --git a/parachain/runtime/testnet-kintsugi/src/zenlink.rs b/parachain/runtime/testnet-kintsugi/src/zenlink.rs index b121311850..7e492cddab 100644 --- a/parachain/runtime/testnet-kintsugi/src/zenlink.rs +++ b/parachain/runtime/testnet-kintsugi/src/zenlink.rs @@ -17,7 +17,7 @@ pub use zenlink_stable_amm::traits::{StablePoolLpCurrencyIdGenerate, ValidateCur parameter_types! { pub const ZenlinkPalletId: PalletId = PalletId(*b"/zenlink"); - pub const StableAmmPalletId: PalletId = PalletId(*b"bf/stamm"); + pub const StableAmmPalletId: PalletId = PalletId(*b"stbl/amm"); pub const StringLimit: u32 = 50; // XCM diff --git a/parachain/src/service.rs b/parachain/src/service.rs index 7ca3f0e2f2..59f20f8348 100644 --- a/parachain/src/service.rs +++ b/parachain/src/service.rs @@ -28,6 +28,9 @@ use sp_runtime::traits::BlakeTwo256; use std::{sync::Arc, time::Duration}; use substrate_prometheus_endpoint::Registry; +use zenlink_protocol_runtime_api::ZenlinkProtocolApi as ZenlinkProtocolRuntimeApi; +use zenlink_stable_amm_runtime_api::StableAmmApi as ZenlinkStableAmmRuntimeApi; + macro_rules! new_runtime_executor { ($name:ident,$runtime:ident) => { pub struct $name; @@ -102,6 +105,8 @@ pub trait RuntimeApiCollection: BlockNumber, UnsignedFixedPoint, > + loans_rpc_runtime_api::LoansApi + + ZenlinkProtocolRuntimeApi + + ZenlinkStableAmmRuntimeApi where >::StateBackend: sp_api::StateBackend, { @@ -151,7 +156,9 @@ where Balance, BlockNumber, UnsignedFixedPoint, - > + loans_rpc_runtime_api::LoansApi, + > + loans_rpc_runtime_api::LoansApi + + ZenlinkProtocolRuntimeApi + + ZenlinkStableAmmRuntimeApi, >::StateBackend: sp_api::StateBackend, { } diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index a3f7bf8012..586eb13d3d 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -19,7 +19,7 @@ xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.3 bitcoin = { path = "../crates/bitcoin", default-features = false } # Zenlink dependencies -zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "8d120c4a41e977892b8e4e6067c7832973048341", default-features = false } +zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } [features] default = ["std"] diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 64e2fc447d..d3af717b6a 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -22,6 +22,12 @@ loans-rpc = { path = "../crates/loans/rpc" } vault-registry = { path = "../crates/vault-registry" } primitives = { package = "interbtc-primitives", path = "../primitives" } +# Zenlink dependencies +zenlink-protocol-rpc = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00" } +zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00" } +zenlink-stable-amm-rpc = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00" } +zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00" } + # Substrate dependencies sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index b4621ffdc5..d1a62b3018 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -7,7 +7,7 @@ use primitives::{ issue::IssueRequest, redeem::RedeemRequest, replace::ReplaceRequest, AccountId, Balance, Block, BlockNumber, - CurrencyId, H256Le, Hash, Nonce, VaultId, + CurrencyId, H256Le, Hash, Nonce, StablePoolId, VaultId, }; use sc_consensus_manual_seal::rpc::{EngineCommand, ManualSeal, ManualSealApiServer}; pub use sc_rpc_api::DenyUnsafe; @@ -19,6 +19,9 @@ use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; use sp_core::H256; use std::sync::Arc; +use zenlink_protocol_runtime_api::ZenlinkProtocolApi as ZenlinkProtocolRuntimeApi; +use zenlink_stable_amm_runtime_api::StableAmmApi as ZenlinkStableAmmRuntimeApi; + pub use jsonrpsee; /// A type representing all RPC extensions. @@ -79,6 +82,8 @@ where FixedU128, >, C::Api: loans_rpc::LoansRuntimeApi, + C::Api: ZenlinkProtocolRuntimeApi, + C::Api: ZenlinkStableAmmRuntimeApi, C::Api: BlockBuilder, P: TransactionPool + 'static, { @@ -93,6 +98,8 @@ where use reward_rpc::{Reward, RewardApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; use vault_registry_rpc::{VaultRegistry, VaultRegistryApiServer}; + use zenlink_protocol_rpc::{ZenlinkProtocol, ZenlinkProtocolApiServer}; + use zenlink_stable_amm_rpc::{StableAmm as ZenlinkStableAmm, StableAmmApiServer as ZenlinkStableAmmApiServer}; let mut module = RpcExtension::new(()); let FullDeps { @@ -130,7 +137,11 @@ where module.merge(Replace::new(client.clone()).into_rpc())?; - module.merge(Loans::new(client).into_rpc())?; + module.merge(Loans::new(client.clone()).into_rpc())?; + + module.merge(ZenlinkProtocol::new(client.clone()).into_rpc())?; + + module.merge(ZenlinkStableAmm::new(client).into_rpc())?; Ok(module) } diff --git a/standalone/runtime/Cargo.toml b/standalone/runtime/Cargo.toml index b73da44f9b..710aef5383 100644 --- a/standalone/runtime/Cargo.toml +++ b/standalone/runtime/Cargo.toml @@ -100,6 +100,11 @@ orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-li orml-vesting = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } orml-asset-registry = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "dc39cfddefb10ef0de23655e2c3dcdab66a19404", default-features = false } +# Zenlink dependencies +zenlink-protocol = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-protocol-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } +zenlink-stable-amm-runtime-api = { git = "https://github.com/interlay/Zenlink-DEX-Module", rev = "1d286f77d8fe38f3a437d35a0600081c2f5b5a00", default-features = false } + xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.31", default-features = false } [dev-dependencies] @@ -206,6 +211,10 @@ std = [ "orml-traits/std", "orml-vesting/std", + "zenlink-protocol/std", + "zenlink-protocol-runtime-api/std", + "zenlink-stable-amm-runtime-api/std", + "xcm-builder/std", "currency/testing-utils", diff --git a/standalone/runtime/src/lib.rs b/standalone/runtime/src/lib.rs index 17fc9d129a..9641045e3e 100644 --- a/standalone/runtime/src/lib.rs +++ b/standalone/runtime/src/lib.rs @@ -71,7 +71,7 @@ pub use primitives::{ self, AccountId, Balance, BlockNumber, CurrencyId, CurrencyId::{ForeignAsset, LendToken, Token}, CurrencyInfo, Hash, Liquidity, Moment, Nonce, PriceDetail, Rate, Ratio, Shortfall, Signature, SignedFixedPoint, - SignedInner, TokenSymbol, UnsignedFixedPoint, UnsignedInner, DOT, IBTC, INTR, KBTC, KINT, KSM, + SignedInner, StablePoolId, TokenSymbol, UnsignedFixedPoint, UnsignedInner, DOT, IBTC, INTR, KBTC, KINT, KSM, }; type VaultId = primitives::VaultId; @@ -1617,4 +1617,109 @@ impl_runtime_apis! { .and_then(|liquidity| liquidity.to_rpc_tuple()) } } + + impl zenlink_protocol_runtime_api::ZenlinkProtocolApi for Runtime { + fn get_balance( + _asset_id: CurrencyId, + _owner: AccountId + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_sovereigns_info( + _asset_id: CurrencyId + ) -> Vec<(u32, AccountId, zenlink_protocol::AssetBalance)> { + Default::default() + } + + fn get_pair_by_asset_id( + _asset_0: CurrencyId, + _asset_1: CurrencyId + ) -> Option> { + Default::default() + } + + fn get_amount_in_price( + _supply: zenlink_protocol::AssetBalance, + _path: Vec + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_amount_out_price( + _supply: zenlink_protocol::AssetBalance, + _path: Vec + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + + fn get_estimate_lptoken( + _asset_0: CurrencyId, + _asset_1: CurrencyId, + _amount_0_desired: zenlink_protocol::AssetBalance, + _amount_1_desired: zenlink_protocol::AssetBalance, + _amount_0_min: zenlink_protocol::AssetBalance, + _amount_1_min: zenlink_protocol::AssetBalance, + ) -> zenlink_protocol::AssetBalance { + Default::default() + } + } + + impl zenlink_stable_amm_runtime_api::StableAmmApi for Runtime { + fn get_virtual_price(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_a(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_a_precise(_pool_id: StablePoolId) -> Balance { + Default::default() + } + + fn get_currencies(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_currency(_pool_id: StablePoolId, _index: u32) -> Option { + Default::default() + } + + fn get_lp_currency(_pool_id: StablePoolId) -> Option { + Default::default() + } + + fn get_currency_precision_multipliers(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_currency_balances(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn get_number_of_currencies(_pool_id: StablePoolId) -> u32 { + Default::default() + } + + fn get_admin_balances(_pool_id: StablePoolId) -> Vec { + Default::default() + } + + fn calculate_currency_amount(_pool_id: StablePoolId, _amounts: Vec, _deposit: bool) -> Balance { + Default::default() + } + + fn calculate_swap(_pool_id: StablePoolId, _in_index: u32, _out_index: u32, _in_amount: Balance) -> Balance { + Default::default() + } + + fn calculate_remove_liquidity(_pool_id: StablePoolId, _amount: Balance) -> Vec { + Default::default() + } + + fn calculate_remove_liquidity_one_currency(_pool_id: StablePoolId, _amount: Balance, _index: u32) -> Balance { + Default::default() + } + } }