From cb28f977ed03a58c8822f483158f8241572db5fb Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Thu, 5 Dec 2024 09:58:23 +0300 Subject: [PATCH 1/7] add check for depth --- runtime/src/lib.rs | 3 +- runtime/src/xor_fee_impls.rs | 191 ++++++++++++++++++++++++++++++++--- 2 files changed, 181 insertions(+), 13 deletions(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 5eb860b1ee..2ded09ba64 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -376,7 +376,8 @@ pub struct BaseCallFilter; impl Contains for BaseCallFilter { fn contains(call: &RuntimeCall) -> bool { - if call.swap_count() > 1 { + let depth_result = call.swap_count_and_depth(0); + if depth_result.swap_count > 1 || depth_result.depth > 1 { return false; } if matches!( diff --git a/runtime/src/xor_fee_impls.rs b/runtime/src/xor_fee_impls.rs index e0ba392998..3fbebb7b79 100644 --- a/runtime/src/xor_fee_impls.rs +++ b/runtime/src/xor_fee_impls.rs @@ -46,6 +46,18 @@ use sp_runtime::FixedU128; use vested_rewards::vesting_currencies::VestingSchedule; use vested_rewards::{Config, WeightInfo}; +#[derive(Debug, PartialEq)] +pub struct CallDepth { + pub swap_count: u32, + pub depth: u32, +} + +impl From<(u32, u32)> for CallDepth { + fn from((swap_count, depth): (u32, u32)) -> Self { + CallDepth { swap_count, depth } + } +} + impl RuntimeCall { #[cfg(feature = "wip")] // EVM bridge pub fn withdraw_evm_fee(&self, who: &AccountId) -> DispatchResult { @@ -92,20 +104,49 @@ impl RuntimeCall { Ok(()) } - pub fn swap_count(&self) -> u32 { + /// `vested_transfer` may be called only through `xorless_call` or manually + /// so for other extrinsics depth is 2 or more + pub fn swap_count_and_depth(&self, depth: u32) -> CallDepth { match self { Self::Multisig(pallet_multisig::Call::as_multi_threshold_1 { call, .. }) | Self::Multisig(pallet_multisig::Call::as_multi { call, .. }) - | Self::Utility(UtilityCall::as_derivative { call, .. }) => call.swap_count(), + | Self::Utility(UtilityCall::as_derivative { call, .. }) => { + call.swap_count_and_depth(depth.saturating_add(2)) + } Self::Utility(UtilityCall::batch { calls }) | Self::Utility(UtilityCall::batch_all { calls }) - | Self::Utility(UtilityCall::force_batch { calls }) => { - calls.iter().map(|call| call.swap_count()).sum() - } + | Self::Utility(UtilityCall::force_batch { calls }) => calls + .iter() + .map(|call| call.swap_count_and_depth(depth.saturating_add(2))) + .fold( + CallDepth { + swap_count: 0, + depth: 0, + }, + |acc, call_depth| CallDepth { + swap_count: acc.swap_count.saturating_add(call_depth.swap_count), + depth: acc.depth.max(call_depth.depth), + }, + ), Self::LiquidityProxy(liquidity_proxy::Call::swap { .. }) | Self::LiquidityProxy(liquidity_proxy::Call::swap_transfer { .. }) - | Self::LiquidityProxy(liquidity_proxy::Call::swap_transfer_batch { .. }) => 1, - _ => 0, + | Self::LiquidityProxy(liquidity_proxy::Call::swap_transfer_batch { .. }) => { + CallDepth { + depth: 0, + swap_count: 1, + } + } + Self::XorFee(xor_fee::Call::xorless_call { call, .. }) => { + call.swap_count_and_depth(depth.saturating_add(1)) + } + Self::VestedRewards(vested_rewards::Call::vested_transfer { .. }) => CallDepth { + depth, + swap_count: 0, + }, + _ => CallDepth { + depth: 0, + swap_count: 0, + }, } } @@ -521,9 +562,11 @@ impl xor_fee::CalculateMultiplier, DispatchError> for #[cfg(test)] mod tests { + use crate::xor_fee_impls::CallDepth; use pallet_utility::Call as UtilityCall; use sp_core::H256; use sp_runtime::AccountId32; + use vested_rewards::vesting_currencies::{LinearVestingSchedule, VestingScheduleVariant}; use common::{balance, VAL, XOR}; @@ -569,7 +612,34 @@ mod tests { amount: balance!(100), }); - assert_eq!(call.swap_count(), 0); + assert_eq!( + call.swap_count_and_depth(0), + CallDepth { + swap_count: 0, + depth: 0, + } + ); + + let schedule = VestingScheduleVariant::LinearVestingSchedule(LinearVestingSchedule { + asset_id: DOT, + start: 0u32, + period: 10u32, + period_count: 2u32, + per_period: 10, + remainder_amount: 0, + }); + let call = RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { + dest: From::from([1; 32]), + schedule: schedule.clone(), + }); + + assert_eq!( + call.swap_count_and_depth(0), + CallDepth { + swap_count: 0, + depth: 0, + } + ); } #[test] @@ -594,8 +664,93 @@ mod tests { }); let call_batch_all = RuntimeCall::Utility(UtilityCall::batch_all { calls: batch_calls }); - assert_eq!(call_batch.swap_count(), 0); - assert_eq!(call_batch_all.swap_count(), 0); + assert_eq!( + call_batch.swap_count_and_depth(0), + CallDepth { + swap_count: 0, + depth: 0, + } + ); + assert_eq!( + call_batch_all.swap_count_and_depth(0), + CallDepth { + swap_count: 0, + depth: 0, + } + ); + } + + #[test] + fn regular_batch_should_not_pass_for_vesting() { + let schedule = VestingScheduleVariant::LinearVestingSchedule(LinearVestingSchedule { + asset_id: DOT, + start: 0u32, + period: 10u32, + period_count: 2u32, + per_period: 10, + remainder_amount: 0, + }); + let call = RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { + dest: From::from([1; 32]), + schedule: schedule.clone(), + }); + let batch_calls = vec![ + call, + assets::Call::transfer { + asset_id: GetBaseAssetId::get(), + to: From::from([1; 32]), + amount: balance!(100), + } + .into(), + ]; + + let call_batch = RuntimeCall::Utility(UtilityCall::batch { + calls: batch_calls.clone(), + }); + let call_batch_all = RuntimeCall::Utility(UtilityCall::batch_all { calls: batch_calls }); + + assert_eq!( + call_batch.swap_count_and_depth(0), + CallDepth { + swap_count: 0, + depth: 2, + } + ); + assert_eq!( + call_batch_all.swap_count_and_depth(0), + CallDepth { + swap_count: 0, + depth: 2, + } + ); + } + + #[test] + fn no_direct_call_not_work_for_vesting() { + let schedule = VestingScheduleVariant::LinearVestingSchedule(LinearVestingSchedule { + asset_id: DOT, + start: 0u32, + period: 10u32, + period_count: 2u32, + per_period: 10, + remainder_amount: 0, + }); + let call = Box::new(RuntimeCall::VestedRewards( + vested_rewards::Call::vested_transfer { + dest: From::from([1; 32]), + schedule: schedule.clone(), + }, + )); + + let utility_call = RuntimeCall::Utility(UtilityCall::as_derivative { index: 0, call }); + + assert_eq!( + utility_call.swap_count_and_depth(0), + CallDepth { + depth: 2, + swap_count: 0 + } + ); } fn test_swap_in_batch(call: RuntimeCall) { @@ -614,8 +769,20 @@ mod tests { }); let call_batch_all = RuntimeCall::Utility(UtilityCall::batch_all { calls: batch_calls }); - assert_eq!(call_batch.swap_count(), 1); - assert_eq!(call_batch_all.swap_count(), 1); + assert_eq!( + call_batch.swap_count_and_depth(0), + CallDepth { + swap_count: 1, + depth: 0, + } + ); + assert_eq!( + call_batch_all.swap_count_and_depth(0), + CallDepth { + swap_count: 1, + depth: 0, + } + ); assert!(crate::BaseCallFilter::contains(&call_batch)); assert!(crate::BaseCallFilter::contains(&call_batch_all)); From 4e26f92f7489c4ce3a1ca729853a79738694fa67 Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Thu, 5 Dec 2024 09:58:49 +0300 Subject: [PATCH 2/7] change assets in migration --- pallets/xor-fee/src/migrations.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pallets/xor-fee/src/migrations.rs b/pallets/xor-fee/src/migrations.rs index 2149e4bedd..a857ccc26d 100644 --- a/pallets/xor-fee/src/migrations.rs +++ b/pallets/xor-fee/src/migrations.rs @@ -82,10 +82,8 @@ pub mod add_white_listed_assets_for_xorless_fee { where T: Config, { - // TODO: change assets fn on_runtime_upgrade() -> Weight { let assets: Vec> = vec![ - KXOR.into(), ETH.into(), KUSD.into(), APOLLO_ASSET_ID.into(), @@ -96,21 +94,11 @@ pub mod add_white_listed_assets_for_xorless_fee { .into(), // LLD PSWAP.into(), DAI.into(), - AssetId32::from_bytes(hex!( - "002d4e9e03f192cc33b128319a049f353db98fbf4d98f717fd0b7f66a0462142" - )) - .into(), // HMX - XSTUSD.into(), AssetId32::from_bytes(hex!( "0003b1dbee890acfb1b3bc12d1bb3b4295f52755423f84d1751b2545cebf000b" )) .into(), //DOT - AssetId32::from_bytes(hex!( - "00f2f4fda40a4bf1fc3769d156fa695532eec31e265d75068524462c0b80f674" - )) - .into(), //DEO KSM.into(), - TBCD.into(), AssetId32::from_bytes(hex!( "00ab83f36ff0cbbdd12fd88a094818820eaf155c08c4159969f1fb21534c1eb0" )) From 5aa10ee102993c07631b3bcc8c5370dd3f3f6766 Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Thu, 5 Dec 2024 12:19:01 +0300 Subject: [PATCH 3/7] compute fee for order book and vested transfer --- runtime/src/xor_fee_impls.rs | 197 ++++++++++++++++++++++++++++++----- 1 file changed, 173 insertions(+), 24 deletions(-) diff --git a/runtime/src/xor_fee_impls.rs b/runtime/src/xor_fee_impls.rs index 3fbebb7b79..b579a938de 100644 --- a/runtime/src/xor_fee_impls.rs +++ b/runtime/src/xor_fee_impls.rs @@ -268,26 +268,35 @@ impl xor_fee::ApplyCustomFees for CustomFees { fn compute_fee(call: &RuntimeCall) -> Option<(Balance, CustomFeeDetails)> { let mut fee = Self::base_fee(call)?; - let details = match call { - RuntimeCall::OrderBook(order_book::Call::place_limit_order { lifespan, .. }) => { - CustomFeeDetails::LimitOrderLifetime(*lifespan) - } - RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { - schedule, .. - }) => { - let claim_fee = pallet_transaction_payment::Pallet::::weight_to_fee( - ::WeightInfo::claim_unlocked(), - ); - let whole_claims_fee = claim_fee.saturating_mul(schedule.claims_count() as Balance); - let fee_vested_transfer_weight = - pallet_transaction_payment::Pallet::::weight_to_fee( - ::WeightInfo::vested_transfer(), + let mut compute_details = |call: &RuntimeCall| -> CustomFeeDetails { + match call { + RuntimeCall::OrderBook(order_book::Call::place_limit_order { + lifespan, .. + }) => CustomFeeDetails::LimitOrderLifetime(*lifespan), + RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { + schedule, + .. + }) => { + let claim_fee = pallet_transaction_payment::Pallet::::weight_to_fee( + ::WeightInfo::claim_unlocked(), ); - let fee_without_claims = fee.saturating_add(fee_vested_transfer_weight); - fee = fee_without_claims.saturating_add(whole_claims_fee); - CustomFeeDetails::VestedTransferClaims((fee, fee_without_claims)) + let whole_claims_fee = + claim_fee.saturating_mul(schedule.claims_count() as Balance); + let fee_vested_transfer_weight = + pallet_transaction_payment::Pallet::::weight_to_fee( + ::WeightInfo::vested_transfer(), + ); + let fee_without_claims = fee.saturating_add(fee_vested_transfer_weight); + fee = fee_without_claims.saturating_add(whole_claims_fee); + CustomFeeDetails::VestedTransferClaims((fee, fee_without_claims)) + } + _ => CustomFeeDetails::Regular(fee), } - _ => CustomFeeDetails::Regular(fee), + }; + + let details = match call { + RuntimeCall::XorFee(xor_fee::Call::xorless_call { call, .. }) => compute_details(call), + call => compute_details(call), }; Some((fee, details)) @@ -562,15 +571,20 @@ impl xor_fee::CalculateMultiplier, DispatchError> for #[cfg(test)] mod tests { - use crate::xor_fee_impls::CallDepth; use pallet_utility::Call as UtilityCall; use sp_core::H256; use sp_runtime::AccountId32; - use vested_rewards::vesting_currencies::{LinearVestingSchedule, VestingScheduleVariant}; - - use common::{balance, VAL, XOR}; - - use crate::{xor_fee_impls::CustomFees, *}; + use vested_rewards::vesting_currencies::{ + LinearVestingSchedule, VestingSchedule, VestingScheduleVariant, + }; + use vested_rewards::{Config, WeightInfo}; + + use crate::{ + xor_fee_impls::{CallDepth, CustomFeeDetails, CustomFees}, + *, + }; + use common::{balance, PriceVariant, VAL, XOR}; + use order_book::OrderBookId; use xor_fee::ApplyCustomFees; #[test] @@ -642,6 +656,35 @@ mod tests { ); } + #[test] + fn xorless_call_vesting_should_pass() { + let schedule = VestingScheduleVariant::LinearVestingSchedule(LinearVestingSchedule { + asset_id: DOT, + start: 0u32, + period: 10u32, + period_count: 2u32, + per_period: 10, + remainder_amount: 0, + }); + let call = RuntimeCall::XorFee(xor_fee::Call::xorless_call { + call: Box::new(RuntimeCall::VestedRewards( + vested_rewards::Call::vested_transfer { + dest: From::from([1; 32]), + schedule: schedule.clone(), + }, + )), + asset_id: None, + }); + + assert_eq!( + call.swap_count_and_depth(0), + CallDepth { + swap_count: 0, + depth: 1, + } + ); + } + #[test] fn regular_batch_should_pass() { let batch_calls = vec![ @@ -824,4 +867,110 @@ mod tests { .into(), ); } + + #[test] + fn compute_fee_works_fine() { + // compute fee works fine for vested transfer + + let schedule = VestingScheduleVariant::LinearVestingSchedule(LinearVestingSchedule { + asset_id: DOT, + start: 0u32, + period: 10u32, + period_count: 2u32, + per_period: 10, + remainder_amount: 0, + }); + + let mut fee = SMALL_FEE; + let claim_fee = pallet_transaction_payment::Pallet::::weight_to_fee( + ::WeightInfo::claim_unlocked(), + ); + let whole_claims_fee = claim_fee.saturating_mul(schedule.claims_count() as Balance); + let fee_vested_transfer_weight = + pallet_transaction_payment::Pallet::::weight_to_fee( + ::WeightInfo::vested_transfer(), + ); + let fee_without_claims = fee.saturating_add(fee_vested_transfer_weight); + fee = fee_without_claims.saturating_add(whole_claims_fee); + + let vesting_call = RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { + dest: From::from([1; 32]), + schedule, + }); + let xorless_call_vesting = RuntimeCall::XorFee(xor_fee::Call::xorless_call { + call: Box::new(vesting_call.clone()), + asset_id: None, + }); + assert_eq!( + CustomFees::compute_fee(&xorless_call_vesting), + Some(( + fee, + CustomFeeDetails::VestedTransferClaims((fee, fee_without_claims)) + )) + ); + assert_eq!( + CustomFees::compute_fee(&vesting_call), + Some(( + fee, + CustomFeeDetails::VestedTransferClaims((fee, fee_without_claims)) + )) + ); + + // compute fee works fine for order book + + let order_book_id = OrderBookId { + dex_id: common::DEXId::Polkaswap.into(), + base: VAL.into(), + quote: XOR.into(), + }; + let order_call = RuntimeCall::OrderBook(order_book::Call::place_limit_order { + order_book_id, + price: balance!(11), + amount: balance!(100), + side: PriceVariant::Sell, + lifespan: None, + }); + let xorless_call = RuntimeCall::XorFee(xor_fee::Call::xorless_call { + call: Box::new(order_call.clone()), + asset_id: None, + }); + assert_eq!( + CustomFees::compute_fee(&xorless_call), + Some((SMALL_FEE, CustomFeeDetails::LimitOrderLifetime(None))) + ); + assert_eq!( + CustomFees::compute_fee(&order_call), + Some((SMALL_FEE, CustomFeeDetails::LimitOrderLifetime(None))) + ); + + // compute fee works fine for Some predefined fee + + let transfer_call = RuntimeCall::Assets(assets::Call::transfer { + asset_id: GetBaseAssetId::get(), + to: From::from([1; 32]), + amount: balance!(100), + }); + let xorless_call = RuntimeCall::XorFee(xor_fee::Call::xorless_call { + call: Box::new(transfer_call.clone()), + asset_id: None, + }); + assert_eq!( + CustomFees::compute_fee(&transfer_call), + Some((SMALL_FEE, CustomFeeDetails::Regular(SMALL_FEE))) + ); + assert_eq!( + CustomFees::compute_fee(&xorless_call), + Some((SMALL_FEE, CustomFeeDetails::Regular(SMALL_FEE))) + ); + + // compute fee works fine for others + + let set_call = RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: 1_u64 }); + let xorless_call = RuntimeCall::XorFee(xor_fee::Call::xorless_call { + call: Box::new(set_call.clone()), + asset_id: None, + }); + assert_eq!(CustomFees::compute_fee(&set_call), None); + assert_eq!(CustomFees::compute_fee(&xorless_call), None); + } } From a8ae1f1595c6826925f4a4da0bbb79bd15b5869d Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Thu, 5 Dec 2024 12:19:21 +0300 Subject: [PATCH 4/7] update Carrgo.lock --- Cargo.lock | 192 ++++++++++++++++++++++++++++------------------------- 1 file changed, 100 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be55677e63..59bd211306 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -356,7 +356,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 1.0.60", + "thiserror 1.0.64", "time", ] @@ -372,7 +372,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 1.0.60", + "thiserror 1.0.64", "time", ] @@ -811,7 +811,7 @@ dependencies = [ "sp-mmr-primitives", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasm-timer", ] @@ -831,7 +831,7 @@ dependencies = [ "sp-beefy", "sp-core", "sp-runtime", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -2911,7 +2911,7 @@ dependencies = [ "serde", "serde_json", "sha3 0.10.8", - "thiserror 1.0.60", + "thiserror 1.0.64", "uint", ] @@ -3372,7 +3372,7 @@ dependencies = [ "sp-std", "sp-storage", "sp-trie", - "thiserror 1.0.60", + "thiserror 1.0.64", "thousands", ] @@ -4134,7 +4134,7 @@ dependencies = [ "pest_derive", "serde", "serde_json", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -4579,7 +4579,7 @@ dependencies = [ "rand 0.8.5", "rtcp", "rtp", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "waitgroup", "webrtc-srtp", @@ -4771,7 +4771,7 @@ dependencies = [ "pin-project", "rustls-native-certs", "soketto", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "tokio-rustls 0.24.1", "tokio-util", @@ -4802,7 +4802,7 @@ dependencies = [ "serde", "serde_json", "soketto", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "tracing", ] @@ -4852,7 +4852,7 @@ dependencies = [ "beef", "serde", "serde_json", - "thiserror 1.0.60", + "thiserror 1.0.64", "tracing", ] @@ -5123,7 +5123,7 @@ dependencies = [ "sec1", "sha2 0.10.8", "smallvec", - "thiserror 1.0.60", + "thiserror 1.0.64", "unsigned-varint", "void", "zeroize", @@ -5152,7 +5152,7 @@ dependencies = [ "rand 0.8.5", "rw-stream-sink", "smallvec", - "thiserror 1.0.60", + "thiserror 1.0.64", "unsigned-varint", "void", ] @@ -5188,7 +5188,7 @@ dependencies = [ "prost-build", "prost-codec", "smallvec", - "thiserror 1.0.60", + "thiserror 1.0.64", "void", ] @@ -5206,7 +5206,7 @@ dependencies = [ "quick-protobuf", "rand 0.8.5", "sha2 0.10.8", - "thiserror 1.0.60", + "thiserror 1.0.64", "zeroize", ] @@ -5232,7 +5232,7 @@ dependencies = [ "rand 0.8.5", "sha2 0.10.8", "smallvec", - "thiserror 1.0.60", + "thiserror 1.0.64", "uint", "unsigned-varint", "void", @@ -5308,7 +5308,7 @@ dependencies = [ "sha2 0.10.8", "snow", "static_assertions", - "thiserror 1.0.60", + "thiserror 1.0.64", "x25519-dalek 1.1.1", "zeroize", ] @@ -5346,7 +5346,7 @@ dependencies = [ "quinn-proto", "rand 0.8.5", "rustls 0.20.9", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", ] @@ -5385,7 +5385,7 @@ dependencies = [ "pin-project", "rand 0.8.5", "smallvec", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "void", ] @@ -5430,7 +5430,7 @@ dependencies = [ "rcgen 0.10.0", "ring 0.16.20", "rustls 0.20.9", - "thiserror 1.0.60", + "thiserror 1.0.64", "webpki 0.22.4", "x509-parser 0.14.0", "yasna", @@ -5474,7 +5474,7 @@ dependencies = [ "rcgen 0.9.3", "serde", "stun", - "thiserror 1.0.60", + "thiserror 1.0.64", "tinytemplate", "tokio", "tokio-util", @@ -5510,7 +5510,7 @@ dependencies = [ "libp2p-core 0.38.0", "log", "parking_lot 0.12.3", - "thiserror 1.0.60", + "thiserror 1.0.64", "yamux", ] @@ -6279,7 +6279,7 @@ dependencies = [ "anyhow", "byteorder", "paste", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -6293,7 +6293,7 @@ dependencies = [ "log", "netlink-packet-core", "netlink-sys", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", ] @@ -7441,7 +7441,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror 1.0.60", + "thiserror 1.0.64", "ucd-trie", ] @@ -7829,7 +7829,7 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" dependencies = [ - "thiserror 1.0.60", + "thiserror 1.0.64", "toml", ] @@ -7886,7 +7886,7 @@ dependencies = [ "lazy_static", "memchr", "parking_lot 0.12.3", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -7953,7 +7953,7 @@ dependencies = [ "asynchronous-codec", "bytes", "prost", - "thiserror 1.0.60", + "thiserror 1.0.64", "unsigned-varint", ] @@ -8146,7 +8146,7 @@ dependencies = [ "rustc-hash", "rustls 0.20.9", "slab", - "thiserror 1.0.60", + "thiserror 1.0.64", "tinyvec", "tracing", "webpki 0.22.4", @@ -8334,7 +8334,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", "libredox", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -8595,7 +8595,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" dependencies = [ "bytes", - "thiserror 1.0.60", + "thiserror 1.0.64", "webrtc-util", ] @@ -8610,7 +8610,7 @@ dependencies = [ "netlink-packet-route", "netlink-proto", "nix 0.24.3", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", ] @@ -8634,7 +8634,7 @@ dependencies = [ "bytes", "rand 0.8.5", "serde", - "thiserror 1.0.60", + "thiserror 1.0.64", "webrtc-util", ] @@ -8827,7 +8827,7 @@ dependencies = [ "log", "sp-core", "sp-wasm-interface", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -8930,7 +8930,7 @@ dependencies = [ "sp-panic-handler", "sp-runtime", "sp-version", - "thiserror 1.0.60", + "thiserror 1.0.64", "tiny-bip39", "tokio", ] @@ -9009,7 +9009,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9038,7 +9038,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9076,7 +9076,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9147,7 +9147,7 @@ dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", "sp-wasm-interface", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasm-instrument", "wasmi", ] @@ -9219,7 +9219,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9249,7 +9249,7 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-keystore", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9289,7 +9289,7 @@ dependencies = [ "sp-core", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", "unsigned-varint", "zeroize", ] @@ -9309,7 +9309,7 @@ dependencies = [ "sc-network-common 0.10.0-dev (git+https://github.com/sora-xor/substrate.git?branch=polkadot-v0.9.38)", "sp-blockchain", "sp-runtime", - "thiserror 1.0.60", + "thiserror 1.0.64", "unsigned-varint", ] @@ -9336,7 +9336,7 @@ dependencies = [ "sp-finality-grandpa", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9362,7 +9362,7 @@ dependencies = [ "sp-finality-grandpa", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9401,7 +9401,7 @@ dependencies = [ "sp-blockchain", "sp-core", "sp-runtime", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9433,7 +9433,7 @@ dependencies = [ "sp-finality-grandpa", "sp-runtime", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9596,7 +9596,7 @@ dependencies = [ "sp-rpc", "sp-runtime", "sp-version", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9636,7 +9636,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-version", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio-stream", ] @@ -9700,7 +9700,7 @@ dependencies = [ "static_init", "substrate-prometheus-endpoint", "tempfile", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "tracing", "tracing-futures", @@ -9729,7 +9729,7 @@ dependencies = [ "sc-client-db", "sc-utils 4.0.0-dev (git+https://github.com/sora-xor/substrate.git?branch=polkadot-v0.9.38)", "sp-core", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", ] @@ -9767,7 +9767,7 @@ dependencies = [ "sc-utils 4.0.0-dev (git+https://github.com/sora-xor/substrate.git?branch=polkadot-v0.9.38)", "serde", "serde_json", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasm-timer", ] @@ -9796,7 +9796,7 @@ dependencies = [ "sp-rpc", "sp-runtime", "sp-tracing", - "thiserror 1.0.60", + "thiserror 1.0.64", "tracing", "tracing-log", "tracing-subscriber", @@ -9837,7 +9837,7 @@ dependencies = [ "sp-tracing", "sp-transaction-pool", "substrate-prometheus-endpoint", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9851,7 +9851,7 @@ dependencies = [ "serde", "sp-blockchain", "sp-runtime", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -9986,7 +9986,7 @@ checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" dependencies = [ "rand 0.8.5", "substring", - "thiserror 1.0.60", + "thiserror 1.0.64", "url", ] @@ -10391,7 +10391,7 @@ dependencies = [ "sp-std", "sp-trie", "sp-version", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -10477,7 +10477,7 @@ dependencies = [ "sp-database", "sp-runtime", "sp-state-machine", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -10495,7 +10495,7 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-version", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -10601,7 +10601,7 @@ dependencies = [ "sp-storage", "ss58-registry", "substrate-bip39", - "thiserror 1.0.60", + "thiserror 1.0.64", "tiny-bip39", "zeroize", ] @@ -10700,7 +10700,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-std", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -10753,7 +10753,7 @@ dependencies = [ "serde", "sp-core", "sp-externalities", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -10761,7 +10761,7 @@ name = "sp-maybe-compressed-blob" version = "4.1.0-dev" source = "git+https://github.com/sora-xor/substrate.git?branch=polkadot-v0.9.38#b12c8d200054c92586ec33f5dfc5d0e109958004" dependencies = [ - "thiserror 1.0.60", + "thiserror 1.0.64", "zstd", ] @@ -10780,7 +10780,7 @@ dependencies = [ "sp-debug-derive 5.0.0 (git+https://github.com/sora-xor/substrate.git?branch=polkadot-v0.9.38)", "sp-runtime", "sp-std", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -10921,7 +10921,7 @@ dependencies = [ "sp-panic-handler", "sp-std", "sp-trie", - "thiserror 1.0.60", + "thiserror 1.0.64", "tracing", ] @@ -10955,7 +10955,7 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-std", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -11012,7 +11012,7 @@ dependencies = [ "schnellru", "sp-core", "sp-std", - "thiserror 1.0.60", + "thiserror 1.0.64", "tracing", "trie-db", "trie-root", @@ -11032,7 +11032,7 @@ dependencies = [ "sp-runtime", "sp-std", "sp-version-proc-macro", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -11252,7 +11252,7 @@ dependencies = [ "rand 0.8.5", "ring 0.16.20", "subtle", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "url", "webrtc-util", @@ -11354,7 +11354,7 @@ dependencies = [ "hyper", "log", "prometheus", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", ] @@ -11528,7 +11528,7 @@ version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ - "thiserror-impl 1.0.60", + "thiserror-impl 1.0.64", ] [[package]] @@ -11639,7 +11639,7 @@ dependencies = [ "rand 0.8.5", "rustc-hash", "sha2 0.10.8", - "thiserror 1.0.60", + "thiserror 1.0.64", "unicode-normalization", "wasm-bindgen", "zeroize", @@ -11997,7 +11997,7 @@ dependencies = [ "rand 0.8.5", "smallvec", "socket2 0.4.10", - "thiserror 1.0.60", + "thiserror 1.0.64", "tinyvec", "tokio", "tracing", @@ -12018,7 +12018,7 @@ dependencies = [ "parking_lot 0.12.3", "resolv-conf", "smallvec", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "tracing", "trust-dns-proto", @@ -12081,7 +12081,7 @@ dependencies = [ "rand 0.8.5", "ring 0.16.20", "stun", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "webrtc-util", ] @@ -12449,7 +12449,7 @@ dependencies = [ "strum 0.24.1", "strum_macros 0.24.3", "tempfile", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasm-opt-cxx-sys", "wasm-opt-sys", ] @@ -12609,7 +12609,7 @@ dependencies = [ "log", "object 0.29.0", "target-lexicon", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasmparser", "wasmtime-environ", ] @@ -12628,7 +12628,7 @@ dependencies = [ "object 0.29.0", "serde", "target-lexicon", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasmparser", "wasmtime-types", ] @@ -12651,7 +12651,7 @@ dependencies = [ "rustix 0.35.16", "serde", "target-lexicon", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-runtime", @@ -12687,7 +12687,7 @@ dependencies = [ "paste", "rand 0.8.5", "rustix 0.35.16", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", @@ -12702,7 +12702,7 @@ checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" dependencies = [ "cranelift-entity", "serde", - "thiserror 1.0.60", + "thiserror 1.0.64", "wasmparser", ] @@ -12776,7 +12776,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "stun", - "thiserror 1.0.60", + "thiserror 1.0.64", "time", "tokio", "turn", @@ -12801,7 +12801,7 @@ dependencies = [ "bytes", "derive_builder", "log", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "webrtc-sctp", "webrtc-util", @@ -12839,7 +12839,7 @@ dependencies = [ "sha2 0.10.8", "signature 1.6.4", "subtle", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "webpki 0.21.4", "webrtc-util", @@ -12861,7 +12861,7 @@ dependencies = [ "serde", "serde_json", "stun", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "turn", "url", @@ -12879,7 +12879,7 @@ checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" dependencies = [ "log", "socket2 0.4.10", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "webrtc-util", ] @@ -12894,7 +12894,7 @@ dependencies = [ "bytes", "rand 0.8.5", "rtp", - "thiserror 1.0.60", + "thiserror 1.0.64", ] [[package]] @@ -12909,7 +12909,7 @@ dependencies = [ "crc", "log", "rand 0.8.5", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "webrtc-util", ] @@ -12933,7 +12933,7 @@ dependencies = [ "rtp", "sha-1", "subtle", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "webrtc-util", ] @@ -12954,7 +12954,7 @@ dependencies = [ "log", "nix 0.24.3", "rand 0.8.5", - "thiserror 1.0.60", + "thiserror 1.0.64", "tokio", "winapi", ] @@ -13350,7 +13350,7 @@ dependencies = [ "oid-registry 0.4.0", "ring 0.16.20", "rusticata-macros", - "thiserror 1.0.60", + "thiserror 1.0.64", "time", ] @@ -13368,7 +13368,7 @@ dependencies = [ "nom", "oid-registry 0.6.1", "rusticata-macros", - "thiserror 1.0.60", + "thiserror 1.0.64", "time", ] @@ -13404,7 +13404,10 @@ name = "xor-fee" version = "0.1.0" dependencies = [ "assets", + "ceres-liquidity-locker", "common", + "demeter-farming-platform", + "dex-manager", "frame-benchmarking", "frame-support", "frame-system", @@ -13418,6 +13421,9 @@ dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "permissions", + "pool-xyk", + "price-tools", + "pswap-distribution", "scale-info", "smallvec", "sp-arithmetic", @@ -13426,6 +13432,8 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-std", + "technical", + "trading-pair", ] [[package]] From f281a70c01f6ce374f26b104ebba570b3890aa70 Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Thu, 5 Dec 2024 13:33:01 +0300 Subject: [PATCH 5/7] add set referrer --- runtime/src/xor_fee_impls.rs | 85 +++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/runtime/src/xor_fee_impls.rs b/runtime/src/xor_fee_impls.rs index b579a938de..8a217c8713 100644 --- a/runtime/src/xor_fee_impls.rs +++ b/runtime/src/xor_fee_impls.rs @@ -463,13 +463,19 @@ impl xor_fee::ApplyCustomFees for CustomFees { } fn get_fee_source(who: &AccountId, call: &RuntimeCall, _fee: Balance) -> AccountId { - match call { - RuntimeCall::Referrals(referrals::Call::set_referrer { .. }) - if Referrals::can_set_referrer(who) => - { - ReferralsReservesAcc::get() + let fee_source = |call: &RuntimeCall| -> AccountId { + match call { + RuntimeCall::Referrals(referrals::Call::set_referrer { .. }) + if Referrals::can_set_referrer(who) => + { + ReferralsReservesAcc::get() + } + _ => who.clone(), } - _ => who.clone(), + }; + match call { + RuntimeCall::XorFee(xor_fee::Call::xorless_call { call, .. }) => fee_source(call), + call => fee_source(call), } } } @@ -491,7 +497,6 @@ impl xor_fee::WithdrawFee for WithdrawFee { DispatchError, > { match call { - // TODO: remake for xorless RuntimeCall::Referrals(referrals::Call::set_referrer { referrer }) // Fee source should be set to referrer by `get_fee_source` method, if not // it means that user can't set referrer @@ -500,38 +505,48 @@ impl xor_fee::WithdrawFee for WithdrawFee { Referrals::withdraw_fee(referrer, fee)?; } #[allow(unused_variables)] // Xorless fee - RuntimeCall::XorFee(xor_fee::Call::xorless_call {call: _, asset_id}) => { + RuntimeCall::XorFee(xor_fee::Call::xorless_call {call, asset_id}) => { #[cfg(feature = "wip")] // Xorless fee - match *asset_id { - None => {}, - Some(asset_id) if XorFee::whitelist_tokens().contains(&asset_id) => { - let asset_fee = FixedWrapper::from( - PriceTools::get_average_price( - &GetXorAssetId::get(), - &asset_id, - PriceVariant::Buy)? - ) * fee; - let asset_fee = asset_fee.into_balance(); - if asset_fee.lt(&MinimalFeeInAsset::get()) { - return Err(xor_fee::Error::::FeeCalculationFailed.into()) - }; - return Ok(( - fee_source.clone(), - Some(Tokens::withdraw( - asset_id, - fee_source, - asset_fee, - ).map(|_| { - NegativeImbalanceOf::::new(asset_fee) - })?), - Some(asset_id), - )) + match call.as_ref() { + RuntimeCall::Referrals(referrals::Call::set_referrer { referrer }) + // Fee source should be set to referrer by `get_fee_source` method, if not + // it means that user can't set referrer + if Referrals::can_set_referrer(who) => + { + Referrals::withdraw_fee(referrer, fee)?; + } + _ => { + match *asset_id { + None => {}, + Some(asset_id) if XorFee::whitelist_tokens().contains(&asset_id) => { + let asset_fee = FixedWrapper::from( + PriceTools::get_average_price( + &GetXorAssetId::get(), + &asset_id, + PriceVariant::Buy)? + ) * fee; + let asset_fee = asset_fee.into_balance(); + if asset_fee.lt(&MinimalFeeInAsset::get()) { + return Err(xor_fee::Error::::FeeCalculationFailed.into()) + }; + return Ok(( + fee_source.clone(), + Some(Tokens::withdraw( + asset_id, + fee_source, + asset_fee, + ).map(|_| { + NegativeImbalanceOf::::new(asset_fee) + })?), + Some(asset_id), + )) + } + _ => { return Err(xor_fee::Error::::AssetNotFound.into()) } + } } - _ => { return Err(xor_fee::Error::::AssetNotFound.into()) } } } - _ => { - } + _ => {} } #[cfg(feature = "wip")] // EVM bridge call.withdraw_evm_fee_nested(who)?; From a2108edaff12fb9aa51f900110bb3a8e840598fc Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Tue, 17 Dec 2024 10:17:39 +0300 Subject: [PATCH 6/7] fix import issue --- runtime/src/xor_fee_impls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/xor_fee_impls.rs b/runtime/src/xor_fee_impls.rs index 8a217c8713..4861c236df 100644 --- a/runtime/src/xor_fee_impls.rs +++ b/runtime/src/xor_fee_impls.rs @@ -598,8 +598,8 @@ mod tests { xor_fee_impls::{CallDepth, CustomFeeDetails, CustomFees}, *, }; + use common::OrderBookId; use common::{balance, PriceVariant, VAL, XOR}; - use order_book::OrderBookId; use xor_fee::ApplyCustomFees; #[test] From 1ac07dba943b4b126c998041cdd9a72d6015ba5e Mon Sep 17 00:00:00 2001 From: Taras Rusakovich Date: Fri, 20 Dec 2024 09:43:06 +0300 Subject: [PATCH 7/7] fix merge and test --- runtime/src/xor_fee_impls.rs | 53 +++++++++++++++++------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/runtime/src/xor_fee_impls.rs b/runtime/src/xor_fee_impls.rs index 1fc4b7b492..3aac0ddc40 100644 --- a/runtime/src/xor_fee_impls.rs +++ b/runtime/src/xor_fee_impls.rs @@ -268,20 +268,29 @@ impl xor_fee::ApplyCustomFees for CustomFees { fn compute_fee(call: &RuntimeCall) -> Option<(Balance, CustomFeeDetails)> { let mut fee = Self::base_fee(call)?; - let details = match call { - RuntimeCall::OrderBook(order_book::Call::place_limit_order { lifespan, .. }) => { - CustomFeeDetails::LimitOrderLifetime(*lifespan) - } - RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { - schedule, .. - }) => { - // claim fee = SMALL_FEE - let whole_claims_fee = SMALL_FEE.saturating_mul(schedule.claims_count() as Balance); - let fee_without_claims = fee; - fee = fee.saturating_add(whole_claims_fee); - CustomFeeDetails::VestedTransferClaims((fee, fee_without_claims)) + let mut compute_details = |call: &RuntimeCall| -> CustomFeeDetails { + match call { + RuntimeCall::OrderBook(order_book::Call::place_limit_order { + lifespan, .. + }) => CustomFeeDetails::LimitOrderLifetime(*lifespan), + RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { + schedule, + .. + }) => { + // claim fee = SMALL_FEE + let whole_claims_fee = + SMALL_FEE.saturating_mul(schedule.claims_count() as Balance); + let fee_without_claims = fee; + fee = fee.saturating_add(whole_claims_fee); + CustomFeeDetails::VestedTransferClaims((fee, fee_without_claims)) + } + _ => CustomFeeDetails::Regular(fee), } - _ => CustomFeeDetails::Regular(fee), + }; + + let details = match call { + RuntimeCall::XorFee(xor_fee::Call::xorless_call { call, .. }) => compute_details(call), + call => compute_details(call), }; Some((fee, details)) @@ -574,10 +583,7 @@ mod tests { use pallet_utility::Call as UtilityCall; use sp_core::H256; use sp_runtime::AccountId32; - use vested_rewards::vesting_currencies::{ - LinearVestingSchedule, VestingSchedule, VestingScheduleVariant, - }; - use vested_rewards::{Config, WeightInfo}; + use vested_rewards::vesting_currencies::{LinearVestingSchedule, VestingScheduleVariant}; use crate::{ xor_fee_impls::{CallDepth, CustomFeeDetails, CustomFees}, @@ -881,17 +887,8 @@ mod tests { remainder_amount: 0, }); - let mut fee = SMALL_FEE; - let claim_fee = pallet_transaction_payment::Pallet::::weight_to_fee( - ::WeightInfo::claim_unlocked(), - ); - let whole_claims_fee = claim_fee.saturating_mul(schedule.claims_count() as Balance); - let fee_vested_transfer_weight = - pallet_transaction_payment::Pallet::::weight_to_fee( - ::WeightInfo::vested_transfer(), - ); - let fee_without_claims = fee.saturating_add(fee_vested_transfer_weight); - fee = fee_without_claims.saturating_add(whole_claims_fee); + let fee = 3 * SMALL_FEE; + let fee_without_claims = SMALL_FEE; let vesting_call = RuntimeCall::VestedRewards(vested_rewards::Call::vested_transfer { dest: From::from([1; 32]),