From cada2ad9676a67991e514c3f7ff09863679be7cc Mon Sep 17 00:00:00 2001 From: nuno Date: Wed, 25 Oct 2023 11:12:54 +0200 Subject: [PATCH] fmt --- libs/mock-builder/tests/pallet.rs | 4 +- libs/mocks/src/change_guard.rs | 2 +- libs/mocks/src/data.rs | 2 +- libs/mocks/src/fees.rs | 2 +- libs/mocks/src/liquidity_pools.rs | 2 +- .../src/liquidity_pools_gateway_routers.rs | 2 +- libs/mocks/src/permissions.rs | 2 +- libs/mocks/src/pools.rs | 2 +- libs/mocks/src/rewards.rs | 2 +- libs/mocks/src/template.rs | 2 +- libs/mocks/src/time.rs | 2 +- libs/mocks/src/try_convert.rs | 2 +- libs/mocks/src/write_off_policy.rs | 2 +- libs/test-utils/src/mocks/order_manager.rs | 2 +- pallets/block-rewards/src/lib.rs | 8 ++- pallets/block-rewards/src/mock.rs | 14 +++-- pallets/block-rewards/src/tests.rs | 2 - pallets/bridge/src/lib.rs | 2 +- pallets/bridge/src/mock.rs | 9 ++-- pallets/claims/src/lib.rs | 2 +- pallets/claims/src/tests.rs | 6 ++- pallets/crowdloan-claim/src/lib.rs | 2 +- pallets/data-collector/src/lib.rs | 2 +- pallets/ethereum-transaction/src/mock.rs | 4 +- pallets/interest-accrual/src/lib.rs | 1 - pallets/investments/src/lib.rs | 10 ++-- pallets/investments/src/mock.rs | 54 +++++++++++++++---- pallets/investments/src/tests.rs | 19 ++++--- .../axelar-gateway-precompile/src/lib.rs | 3 +- .../routers/src/tests.rs | 5 +- pallets/liquidity-pools-gateway/src/mock.rs | 2 +- pallets/liquidity-rewards/src/lib.rs | 2 +- pallets/loans/src/lib.rs | 2 +- pallets/nft/src/lib.rs | 2 +- pallets/order-book/src/lib.rs | 2 +- pallets/order-book/src/mock.rs | 2 +- pallets/order-book/src/tests.rs | 2 +- pallets/permissions/src/lib.rs | 2 +- pallets/permissions/src/mock.rs | 2 +- pallets/pool-registry/src/lib.rs | 2 +- pallets/pool-system/src/lib.rs | 2 +- .../restricted-tokens/src/impl_fungible.rs | 7 +-- pallets/restricted-tokens/src/lib.rs | 2 +- pallets/restricted-tokens/src/mock.rs | 3 +- pallets/restricted-tokens/src/tests.rs | 5 +- pallets/rewards/src/lib.rs | 2 +- pallets/rewards/src/mechanism/deferred.rs | 2 +- pallets/rewards/src/mechanism/gap.rs | 2 +- pallets/transfer-allowlist/src/lib.rs | 2 +- runtime/altair/src/lib.rs | 2 +- runtime/centrifuge/src/lib.rs | 2 +- runtime/development/src/lib.rs | 2 +- 52 files changed, 143 insertions(+), 83 deletions(-) diff --git a/libs/mock-builder/tests/pallet.rs b/libs/mock-builder/tests/pallet.rs index 7bacbaa1a0..ae2184dbfc 100644 --- a/libs/mock-builder/tests/pallet.rs +++ b/libs/mock-builder/tests/pallet.rs @@ -24,7 +24,7 @@ pub mod pallet_mock_test { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< @@ -117,7 +117,7 @@ pub mod my_pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); impl Pallet { pub fn my_call(name: &str, value: u64) -> Result<(), String> { diff --git a/libs/mocks/src/change_guard.rs b/libs/mocks/src/change_guard.rs index 3103949765..889f2c82ec 100644 --- a/libs/mocks/src/change_guard.rs +++ b/libs/mocks/src/change_guard.rs @@ -12,7 +12,7 @@ pub mod pallet_mock_change_guard { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/data.rs b/libs/mocks/src/data.rs index 978303d209..a3e4b711f0 100644 --- a/libs/mocks/src/data.rs +++ b/libs/mocks/src/data.rs @@ -17,7 +17,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/fees.rs b/libs/mocks/src/fees.rs index 21a2409c25..dc67d8de6a 100644 --- a/libs/mocks/src/fees.rs +++ b/libs/mocks/src/fees.rs @@ -11,7 +11,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/liquidity_pools.rs b/libs/mocks/src/liquidity_pools.rs index daff6ab20d..1c1fec3ee0 100644 --- a/libs/mocks/src/liquidity_pools.rs +++ b/libs/mocks/src/liquidity_pools.rs @@ -49,7 +49,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/liquidity_pools_gateway_routers.rs b/libs/mocks/src/liquidity_pools_gateway_routers.rs index a8c1c2614b..709a2e2e65 100644 --- a/libs/mocks/src/liquidity_pools_gateway_routers.rs +++ b/libs/mocks/src/liquidity_pools_gateway_routers.rs @@ -13,7 +13,7 @@ pub mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/permissions.rs b/libs/mocks/src/permissions.rs index fa1e7d5c93..f35d74407f 100644 --- a/libs/mocks/src/permissions.rs +++ b/libs/mocks/src/permissions.rs @@ -11,7 +11,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/pools.rs b/libs/mocks/src/pools.rs index 1906ce9ba1..3e6a19f3f5 100644 --- a/libs/mocks/src/pools.rs +++ b/libs/mocks/src/pools.rs @@ -27,7 +27,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/rewards.rs b/libs/mocks/src/rewards.rs index 2353a6578d..33c4e2ff13 100644 --- a/libs/mocks/src/rewards.rs +++ b/libs/mocks/src/rewards.rs @@ -12,7 +12,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/template.rs b/libs/mocks/src/template.rs index 4fcc98d9b6..e58151a246 100644 --- a/libs/mocks/src/template.rs +++ b/libs/mocks/src/template.rs @@ -7,7 +7,7 @@ pub mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/time.rs b/libs/mocks/src/time.rs index 92dce36de7..41e46835c9 100644 --- a/libs/mocks/src/time.rs +++ b/libs/mocks/src/time.rs @@ -10,7 +10,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/mocks/src/try_convert.rs b/libs/mocks/src/try_convert.rs index f4df43f458..11fe3771b3 100644 --- a/libs/mocks/src/try_convert.rs +++ b/libs/mocks/src/try_convert.rs @@ -14,7 +14,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds, I: 'static = ()> = StorageMap< diff --git a/libs/mocks/src/write_off_policy.rs b/libs/mocks/src/write_off_policy.rs index a1478dba5f..38f8612ddd 100644 --- a/libs/mocks/src/write_off_policy.rs +++ b/libs/mocks/src/write_off_policy.rs @@ -11,7 +11,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type CallIds = StorageMap< diff --git a/libs/test-utils/src/mocks/order_manager.rs b/libs/test-utils/src/mocks/order_manager.rs index 2cbd70aac6..5b1c3b0984 100644 --- a/libs/test-utils/src/mocks/order_manager.rs +++ b/libs/test-utils/src/mocks/order_manager.rs @@ -81,7 +81,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::genesis_config] pub struct GenesisConfig diff --git a/pallets/block-rewards/src/lib.rs b/pallets/block-rewards/src/lib.rs index fcb1bd8ca9..bc4d4bfaec 100644 --- a/pallets/block-rewards/src/lib.rs +++ b/pallets/block-rewards/src/lib.rs @@ -202,7 +202,7 @@ pub mod pallet { } #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); /// Data associated to the current session. @@ -361,7 +361,11 @@ impl Pallet { /// * deposit_stake (4 reads, 4 writes): Currency, Group, StakeAccount, /// Account pub(crate) fn do_init_collator(who: &T::AccountId) -> DispatchResult { - T::Currency::mint_into(T::StakeCurrencyId::get(), who, T::StakeAmount::get() + T::ExistentialDeposit::get())?; + T::Currency::mint_into( + T::StakeCurrencyId::get(), + who, + T::StakeAmount::get() + T::ExistentialDeposit::get(), + )?; T::Rewards::deposit_stake(T::StakeCurrencyId::get(), who, T::StakeAmount::get()) } diff --git a/pallets/block-rewards/src/mock.rs b/pallets/block-rewards/src/mock.rs index 3f32c66682..b7d144f322 100644 --- a/pallets/block-rewards/src/mock.rs +++ b/pallets/block-rewards/src/mock.rs @@ -242,10 +242,10 @@ impl pallet_block_rewards::Config for Test { type AdminOrigin = EnsureRoot; type AuthorityId = UintAuthorityId; type Balance = Balance; - type ExistentialDeposit = ExistentialDeposit; type Beneficiary = RewardRemainderMock; type Currency = Tokens; type CurrencyId = CurrencyId; + type ExistentialDeposit = ExistentialDeposit; type MaxChangesPerSession = MaxChangesPerSession; type MaxCollators = MaxCollators; type Rewards = Rewards; @@ -264,7 +264,11 @@ pub(crate) fn assert_staked(who: &AccountId) { ExistentialDeposit::get() ); assert_eq!( - ::Currency::can_withdraw(::StakeCurrencyId::get(), who, ExistentialDeposit::get() * 2), + ::Currency::can_withdraw( + ::StakeCurrencyId::get(), + who, + ExistentialDeposit::get() * 2 + ), WithdrawConsequence::BalanceLow ); } @@ -277,7 +281,11 @@ pub(crate) fn assert_not_staked(who: &AccountId, was_before: bool) { .is_zero()); assert_eq!( ::Currency::balance(::StakeCurrencyId::get(), who), - if was_before { ExistentialDeposit::get() } else { 0 } + if was_before { + ExistentialDeposit::get() + } else { + 0 + } ); } diff --git a/pallets/block-rewards/src/tests.rs b/pallets/block-rewards/src/tests.rs index cb82992c20..79b6be6794 100644 --- a/pallets/block-rewards/src/tests.rs +++ b/pallets/block-rewards/src/tests.rs @@ -274,8 +274,6 @@ fn single_claim_reward() { Ok(REWARD) ); - - assert_ok!(BlockRewards::claim_reward(RuntimeOrigin::signed(2), 1)); System::assert_last_event(mock::RuntimeEvent::Rewards( pallet_rewards::Event::RewardClaimed { diff --git a/pallets/bridge/src/lib.rs b/pallets/bridge/src/lib.rs index a02add4394..f07204c214 100644 --- a/pallets/bridge/src/lib.rs +++ b/pallets/bridge/src/lib.rs @@ -72,7 +72,7 @@ pub mod pallet { // This structure is a placeholder for traits and functions implementation // for the pallet. #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); // ------------------------------------------------------------------------ // Pallet configuration diff --git a/pallets/bridge/src/mock.rs b/pallets/bridge/src/mock.rs index 655749cfde..ca9d409386 100644 --- a/pallets/bridge/src/mock.rs +++ b/pallets/bridge/src/mock.rs @@ -35,9 +35,8 @@ use sp_core::{blake2_128, ConstU64, H256}; use sp_io::TestExternalities; use sp_runtime::{ testing::Header, - traits::{BlakeTwo256, IdentityLookup}, + traits::{BlakeTwo256, ConstU128, IdentityLookup}, }; -use sp_runtime::traits::ConstU128; use crate::{self as pallet_bridge, Config as BridgePalletConfig}; @@ -56,8 +55,10 @@ pub(crate) const RELAYER_A: u64 = 0x2; pub(crate) const RELAYER_B: u64 = 0x3; pub(crate) const RELAYER_C: u64 = 0x4; pub(crate) const ENDOWED_BALANCE: Balance = 10000 * CFG; -//todo(nuno): if we AllowDeath in Fees::withdraw_fee, we don't need to add the ED here -pub(crate) const RELAYER_B_INITIAL_BALANCE: Balance = NATIVE_TOKEN_TRANSFER_FEE + ExistentialDeposit::get(); +//todo(nuno): if we AllowDeath in Fees::withdraw_fee, we don't need to add the +// ED here +pub(crate) const RELAYER_B_INITIAL_BALANCE: Balance = + NATIVE_TOKEN_TRANSFER_FEE + ExistentialDeposit::get(); pub(crate) const TEST_RELAYER_VOTE_THRESHOLD: u32 = 2; // ---------------------------------------------------------------------------- diff --git a/pallets/claims/src/lib.rs b/pallets/claims/src/lib.rs index b7ea158cbe..e87776d98e 100644 --- a/pallets/claims/src/lib.rs +++ b/pallets/claims/src/lib.rs @@ -118,7 +118,7 @@ pub mod pallet { // This structure is a placeholder for traits and functions implementation // for the pallet. #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); // ------------------------------------------------------------------------ // Pallet configuration diff --git a/pallets/claims/src/tests.rs b/pallets/claims/src/tests.rs index 463b88685d..b8e860f031 100644 --- a/pallets/claims/src/tests.rs +++ b/pallets/claims/src/tests.rs @@ -22,8 +22,10 @@ use frame_support::{assert_noop, assert_ok}; use sp_core::H256; -use sp_runtime::TokenError; -use sp_runtime::traits::{BadOrigin, Hash}; +use sp_runtime::{ + traits::{BadOrigin, Hash}, + TokenError, +}; use crate::{mock::*, *}; diff --git a/pallets/crowdloan-claim/src/lib.rs b/pallets/crowdloan-claim/src/lib.rs index 1ef86e9713..76ee27ab2a 100644 --- a/pallets/crowdloan-claim/src/lib.rs +++ b/pallets/crowdloan-claim/src/lib.rs @@ -176,7 +176,7 @@ pub mod pallet { // This structure is a placeholder for traits and functions implementation // for the pallet. #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); // ------------------------------------------------------------------------ // Pallet configuration diff --git a/pallets/data-collector/src/lib.rs b/pallets/data-collector/src/lib.rs index 4b457b58ba..5c6a1d02dc 100644 --- a/pallets/data-collector/src/lib.rs +++ b/pallets/data-collector/src/lib.rs @@ -39,7 +39,7 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::config] diff --git a/pallets/ethereum-transaction/src/mock.rs b/pallets/ethereum-transaction/src/mock.rs index 5431a9079d..9244dc0f32 100644 --- a/pallets/ethereum-transaction/src/mock.rs +++ b/pallets/ethereum-transaction/src/mock.rs @@ -8,7 +8,9 @@ use pallet_evm::{ FixedGasWeightMapping, IsPrecompileResult, PrecompileHandle, PrecompileSet, SubstrateBlockHashMapping, }; -use sp_core::{crypto::AccountId32, ByteArray, ConstU16, ConstU32, ConstU64, H160, H256, U256, ConstU128}; +use sp_core::{ + crypto::AccountId32, ByteArray, ConstU128, ConstU16, ConstU32, ConstU64, H160, H256, U256, +}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, diff --git a/pallets/interest-accrual/src/lib.rs b/pallets/interest-accrual/src/lib.rs index 6e90ef3c22..13fa556d9f 100644 --- a/pallets/interest-accrual/src/lib.rs +++ b/pallets/interest-accrual/src/lib.rs @@ -177,7 +177,6 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/pallets/investments/src/lib.rs b/pallets/investments/src/lib.rs index 7b5af11b51..7fdb27be91 100644 --- a/pallets/investments/src/lib.rs +++ b/pallets/investments/src/lib.rs @@ -205,7 +205,6 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); @@ -620,11 +619,10 @@ where // Remove order from storage if empty if amount == T::Amount::zero() { *maybe_order = None; - } - else { - // nuno: check that this is ok. Amount == 0 removes the order, so there's - // no point in processing a transfer of 0 which fails because it would - // kill the account (< ED) + } else { + // nuno: check that this is ok. Amount == 0 removes the order, so + // there's no point in processing a transfer of 0 which fails because it + // would kill the account (< ED) Self::do_update_redeem_order( total_order, &who, diff --git a/pallets/investments/src/mock.rs b/pallets/investments/src/mock.rs index 278a4ea114..a6ef4cb0f2 100644 --- a/pallets/investments/src/mock.rs +++ b/pallets/investments/src/mock.rs @@ -284,15 +284,51 @@ impl TestExternalitiesBuilder { orml_tokens::GenesisConfig:: { balances: vec![ // Owner holds enough capital to satisfy redemptions - (Owner::get(), AUSD_CURRENCY_ID, OWNER_START_BALANCE + ExistentialDeposit::get()), - (InvestorA::get(), AUSD_CURRENCY_ID, 100 * CURRENCY + ExistentialDeposit::get()), - (InvestorB::get(), AUSD_CURRENCY_ID, 100 * CURRENCY + ExistentialDeposit::get()), - (InvestorC::get(), AUSD_CURRENCY_ID, 100 * CURRENCY + ExistentialDeposit::get()), - (InvestorD::get(), AUSD_CURRENCY_ID, 100 * CURRENCY + ExistentialDeposit::get()), - (TrancheHolderA::get(), INVESTMENT_0_0.into(), 100 * CURRENCY + ExistentialDeposit::get()), - (TrancheHolderB::get(), INVESTMENT_0_0.into(), 100 * CURRENCY + ExistentialDeposit::get()), - (TrancheHolderC::get(), INVESTMENT_0_0.into(), 100 * CURRENCY + ExistentialDeposit::get()), - (TrancheHolderD::get(), INVESTMENT_0_0.into(), 100 * CURRENCY + ExistentialDeposit::get()), + ( + Owner::get(), + AUSD_CURRENCY_ID, + OWNER_START_BALANCE + ExistentialDeposit::get(), + ), + ( + InvestorA::get(), + AUSD_CURRENCY_ID, + 100 * CURRENCY + ExistentialDeposit::get(), + ), + ( + InvestorB::get(), + AUSD_CURRENCY_ID, + 100 * CURRENCY + ExistentialDeposit::get(), + ), + ( + InvestorC::get(), + AUSD_CURRENCY_ID, + 100 * CURRENCY + ExistentialDeposit::get(), + ), + ( + InvestorD::get(), + AUSD_CURRENCY_ID, + 100 * CURRENCY + ExistentialDeposit::get(), + ), + ( + TrancheHolderA::get(), + INVESTMENT_0_0.into(), + 100 * CURRENCY + ExistentialDeposit::get(), + ), + ( + TrancheHolderB::get(), + INVESTMENT_0_0.into(), + 100 * CURRENCY + ExistentialDeposit::get(), + ), + ( + TrancheHolderC::get(), + INVESTMENT_0_0.into(), + 100 * CURRENCY + ExistentialDeposit::get(), + ), + ( + TrancheHolderD::get(), + INVESTMENT_0_0.into(), + 100 * CURRENCY + ExistentialDeposit::get(), + ), ], } .assimilate_storage(&mut storage) diff --git a/pallets/investments/src/tests.rs b/pallets/investments/src/tests.rs index 5fc9e20d6a..2d8b6a87ac 100644 --- a/pallets/investments/src/tests.rs +++ b/pallets/investments/src/tests.rs @@ -92,7 +92,10 @@ fn update_invest_works() { free_balance_of(investment_account(INVESTMENT_0_0), AUSD_CURRENCY_ID), 2 * amount ); - assert_eq!(free_balance_of(InvestorA::get(), AUSD_CURRENCY_ID), ExistentialDeposit::get()); + assert_eq!( + free_balance_of(InvestorA::get(), AUSD_CURRENCY_ID), + ExistentialDeposit::get() + ); assert_eq!( last_event(), Event::InvestOrderUpdated { @@ -164,7 +167,10 @@ fn update_invest_works() { free_balance_of(investment_account(INVESTMENT_0_0), AUSD_CURRENCY_ID), amount ); - assert_eq!(free_balance_of(InvestorA::get(), AUSD_CURRENCY_ID), amount + ExistentialDeposit::get()); + assert_eq!( + free_balance_of(InvestorA::get(), AUSD_CURRENCY_ID), + amount + ExistentialDeposit::get() + ); assert_eq!( last_event(), Event::InvestOrderUpdated { @@ -704,7 +710,7 @@ fn fulfillment_flow_for_everything_works() { ); assert_eq!( free_balance_of(investment_account(INVESTMENT_0_0), AUSD_CURRENCY_ID), - 0 + 0 ); assert_eq!( free_balance_of(investment_account(INVESTMENT_0_0), INVESTMENT_0_0.into()), @@ -791,7 +797,6 @@ fn fulfillment_flow_for_everything_works() { - PRICE .checked_mul_int(TOTAL_REDEEM_AMOUNT) .expect("Unwrapping test checked_mul_int must work") - ); assert_eq!( free_balance_of(investment_account(INVESTMENT_0_0), AUSD_CURRENCY_ID), @@ -926,7 +931,8 @@ fn fulfillment_partially_works_low_price() { .checked_mul_int(PERC_REDEEM_FULFILL.mul_floor(TOTAL_REDEEM_AMOUNT)) .expect("Unwrapping checked_mul_int must work") ) - .expect("Unwrapping checked_sub must work") + ExistentialDeposit::get() + .expect("Unwrapping checked_sub must work") + + ExistentialDeposit::get() ); assert_eq!(free_balance_of(Owner::get(), INVESTMENT_0_0.into()), 0); } @@ -1611,7 +1617,8 @@ fn fulfillment_partially_works_high_price() { .checked_mul_int(PERC_REDEEM_FULFILL.mul_floor(TOTAL_REDEEM_AMOUNT)) .expect("Unwrapping checked_mul_int must work") ) - .expect("Unwrapping checked_sub must work") + ExistentialDeposit::get() + .expect("Unwrapping checked_sub must work") + + ExistentialDeposit::get() ); assert_eq!(free_balance_of(Owner::get(), INVESTMENT_0_0.into()), 0); } diff --git a/pallets/liquidity-pools-gateway/axelar-gateway-precompile/src/lib.rs b/pallets/liquidity-pools-gateway/axelar-gateway-precompile/src/lib.rs index 75e5312b60..c7e4befb12 100644 --- a/pallets/liquidity-pools-gateway/axelar-gateway-precompile/src/lib.rs +++ b/pallets/liquidity-pools-gateway/axelar-gateway-precompile/src/lib.rs @@ -12,7 +12,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use cfg_types::domain_address::{Domain, DomainAddress}; -use fp_evm::PrecompileHandle; +use fp_evm::{ExitError, PrecompileFailure, PrecompileHandle}; use frame_support::ensure; use precompile_utils::prelude::*; use sp_core::{bounded::BoundedVec, ConstU32, H256, U256}; @@ -20,7 +20,6 @@ use sp_runtime::{ traits::{BlakeTwo256, Hash}, DispatchError, }; -use fp_evm::{ExitError, PrecompileFailure}; use sp_std::vec::Vec; pub use crate::weights::WeightInfo; diff --git a/pallets/liquidity-pools-gateway/routers/src/tests.rs b/pallets/liquidity-pools-gateway/routers/src/tests.rs index 3ec7e7bef5..82d021ff5e 100644 --- a/pallets/liquidity-pools-gateway/routers/src/tests.rs +++ b/pallets/liquidity-pools-gateway/routers/src/tests.rs @@ -436,7 +436,10 @@ mod axelar_evm { new_test_ext().execute_with(|| { let mut test_data = get_test_data(); - assert_ok!(Balances::mint_into(&test_data.derived_sender.clone(), 1_000_000 * CFG)); + assert_ok!(Balances::mint_into( + &test_data.derived_sender.clone(), + 1_000_000 * CFG + )); let transaction_call_cost = ::config().gas_transaction_call; diff --git a/pallets/liquidity-pools-gateway/src/mock.rs b/pallets/liquidity-pools-gateway/src/mock.rs index 551580f7e1..92093c6544 100644 --- a/pallets/liquidity-pools-gateway/src/mock.rs +++ b/pallets/liquidity-pools-gateway/src/mock.rs @@ -4,7 +4,7 @@ use cfg_mocks::{ }; use cfg_types::domain_address::DomainAddress; use frame_system::EnsureRoot; -use sp_core::{crypto::AccountId32, ConstU16, ConstU32, ConstU64, H256, ConstU128}; +use sp_core::{crypto::AccountId32, ConstU128, ConstU16, ConstU32, ConstU64, H256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, diff --git a/pallets/liquidity-rewards/src/lib.rs b/pallets/liquidity-rewards/src/lib.rs index 44aad4f8ce..e4d6f23019 100644 --- a/pallets/liquidity-rewards/src/lib.rs +++ b/pallets/liquidity-rewards/src/lib.rs @@ -162,7 +162,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); /// Contains the timestamp when the current epoch is finalized. // diff --git a/pallets/loans/src/lib.rs b/pallets/loans/src/lib.rs index 9aba88ff07..89eec5695a 100644 --- a/pallets/loans/src/lib.rs +++ b/pallets/loans/src/lib.rs @@ -118,7 +118,7 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::config] diff --git a/pallets/nft/src/lib.rs b/pallets/nft/src/lib.rs index 07942f9230..bf8f8b7153 100644 --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -71,7 +71,7 @@ pub mod pallet { // This structure is a placeholder for traits and functions implementation // for the pallet. #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); // ------------------------------------------------------------------------ // Pallet configuration diff --git a/pallets/order-book/src/lib.rs b/pallets/order-book/src/lib.rs index e277f84074..16d7973f3b 100644 --- a/pallets/order-book/src/lib.rs +++ b/pallets/order-book/src/lib.rs @@ -80,7 +80,7 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::config] diff --git a/pallets/order-book/src/mock.rs b/pallets/order-book/src/mock.rs index be42c56d5a..60d93d99be 100644 --- a/pallets/order-book/src/mock.rs +++ b/pallets/order-book/src/mock.rs @@ -20,7 +20,7 @@ use cfg_types::{ use frame_support::{ pallet_prelude::DispatchResult, parameter_types, - traits::{ConstU64, ConstU32, GenesisBuild}, + traits::{ConstU32, ConstU64, GenesisBuild}, }; use frame_system::EnsureRoot; use orml_traits::{asset_registry::AssetMetadata, parameter_type_with_key}; diff --git a/pallets/order-book/src/tests.rs b/pallets/order-book/src/tests.rs index a59f9e1706..9cfab39ef7 100644 --- a/pallets/order-book/src/tests.rs +++ b/pallets/order-book/src/tests.rs @@ -10,6 +10,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. +use cfg_primitives::CFG; use cfg_types::tokens::CurrencyId; use frame_support::{ assert_err, assert_noop, assert_ok, @@ -21,7 +22,6 @@ use sp_runtime::{ traits::{BadOrigin, Zero}, DispatchError, FixedPointNumber, FixedU128, }; -use cfg_primitives::CFG; use super::*; use crate::mock::*; diff --git a/pallets/permissions/src/lib.rs b/pallets/permissions/src/lib.rs index 0f8349c6d3..4a31981702 100644 --- a/pallets/permissions/src/lib.rs +++ b/pallets/permissions/src/lib.rs @@ -72,7 +72,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] #[pallet::getter(fn permission)] diff --git a/pallets/permissions/src/mock.rs b/pallets/permissions/src/mock.rs index 058b3f9969..71ce857bb9 100644 --- a/pallets/permissions/src/mock.rs +++ b/pallets/permissions/src/mock.rs @@ -192,7 +192,7 @@ mod dummy { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::call] impl Pallet { diff --git a/pallets/pool-registry/src/lib.rs b/pallets/pool-registry/src/lib.rs index bd1e26882b..5cfd97404a 100644 --- a/pallets/pool-registry/src/lib.rs +++ b/pallets/pool-registry/src/lib.rs @@ -162,7 +162,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] #[pallet::getter(fn get_pool_metadata)] diff --git a/pallets/pool-system/src/lib.rs b/pallets/pool-system/src/lib.rs index dc52c24c89..fa9f63e955 100644 --- a/pallets/pool-system/src/lib.rs +++ b/pallets/pool-system/src/lib.rs @@ -371,7 +371,7 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::storage] diff --git a/pallets/restricted-tokens/src/impl_fungible.rs b/pallets/restricted-tokens/src/impl_fungible.rs index 7877c3ba9e..07aacd7bdd 100644 --- a/pallets/restricted-tokens/src/impl_fungible.rs +++ b/pallets/restricted-tokens/src/impl_fungible.rs @@ -133,12 +133,13 @@ impl InspectHold for Pallet { todo!("nuno") } - // fn can_hold(reason: &Self::Reason, who: &T::AccountId, amount: Self::Balance) -> bool { + // fn can_hold(reason: &Self::Reason, who: &T::AccountId, amount: Self::Balance) + // -> bool { // T::PreFungibleInspectHold::check(FungibleInspectHoldEffects::CanHold( // who.clone(), // amount, - // >::can_hold(reason, who, amount), - // )) + // >::can_hold(reason, who, + // amount), )) // } fn can_hold(reason: &Self::Reason, who: &T::AccountId, amount: Self::Balance) -> bool { diff --git a/pallets/restricted-tokens/src/lib.rs b/pallets/restricted-tokens/src/lib.rs index 6f021772e3..8c7828fbae 100644 --- a/pallets/restricted-tokens/src/lib.rs +++ b/pallets/restricted-tokens/src/lib.rs @@ -216,7 +216,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] diff --git a/pallets/restricted-tokens/src/mock.rs b/pallets/restricted-tokens/src/mock.rs index a2b9d367c9..d2fa399a65 100644 --- a/pallets/restricted-tokens/src/mock.rs +++ b/pallets/restricted-tokens/src/mock.rs @@ -416,8 +416,7 @@ impl pallet_balances::Config for Runtime { type WeightInfo = (); } -parameter_types! { -} +parameter_types! {} impl orml_tokens::Config for Runtime { type Amount = i64; diff --git a/pallets/restricted-tokens/src/tests.rs b/pallets/restricted-tokens/src/tests.rs index 6cb8c1804c..01f196aeb3 100644 --- a/pallets/restricted-tokens/src/tests.rs +++ b/pallets/restricted-tokens/src/tests.rs @@ -160,7 +160,10 @@ fn transfer_all_works() { 2, CurrencyId::AUSD, )); - assert_eq!(orml_tokens::Pallet::::accounts(2, CurrencyId::AUSD).free, 2000); + assert_eq!( + orml_tokens::Pallet::::accounts(2, CurrencyId::AUSD).free, + 2000 + ); assert_ok!(pallet_restricted_tokens::Pallet::::transfer_all( RuntimeOrigin::signed(1), 2, diff --git a/pallets/rewards/src/lib.rs b/pallets/rewards/src/lib.rs index 793e39ca10..ac8fcaf725 100644 --- a/pallets/rewards/src/lib.rs +++ b/pallets/rewards/src/lib.rs @@ -144,7 +144,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::genesis_config] pub struct GenesisConfig, I: 'static = ()>(core::marker::PhantomData<(T, I)>); diff --git a/pallets/rewards/src/mechanism/deferred.rs b/pallets/rewards/src/mechanism/deferred.rs index 82e868041e..fab7f5e6c9 100644 --- a/pallets/rewards/src/mechanism/deferred.rs +++ b/pallets/rewards/src/mechanism/deferred.rs @@ -163,7 +163,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type LastDistributionId = StorageValue<_, T::DistributionId, ValueQuery>; diff --git a/pallets/rewards/src/mechanism/gap.rs b/pallets/rewards/src/mechanism/gap.rs index b6d9fc3722..a7dc53f115 100644 --- a/pallets/rewards/src/mechanism/gap.rs +++ b/pallets/rewards/src/mechanism/gap.rs @@ -184,7 +184,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(_); + pub struct Pallet(_); #[pallet::storage] pub(super) type RptHistory = diff --git a/pallets/transfer-allowlist/src/lib.rs b/pallets/transfer-allowlist/src/lib.rs index dc3675dce3..c8793a35f3 100644 --- a/pallets/transfer-allowlist/src/lib.rs +++ b/pallets/transfer-allowlist/src/lib.rs @@ -68,7 +68,7 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index 14b288e47c..6b86a1a0d2 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -1252,6 +1252,7 @@ impl pallet_block_rewards::Config for Runtime { type Beneficiary = (); type Currency = Tokens; type CurrencyId = CurrencyId; + type ExistentialDeposit = ExistentialDeposit; type MaxChangesPerSession = MaxChangesPerEpoch; type MaxCollators = MaxAuthorities; type Rewards = BlockRewardsBase; @@ -1261,7 +1262,6 @@ impl pallet_block_rewards::Config for Runtime { type StakeGroupId = CollatorGroupId; type Weight = u64; type WeightInfo = weights::pallet_block_rewards::WeightInfo; - type ExistentialDeposit = ExistentialDeposit; } // Liquidity rewards diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 2940edde4f..95bb525141 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -1400,6 +1400,7 @@ impl pallet_block_rewards::Config for Runtime { type Beneficiary = Treasury; type Currency = Tokens; type CurrencyId = CurrencyId; + type ExistentialDeposit = ExistentialDeposit; type MaxChangesPerSession = MaxChangesPerEpoch; type MaxCollators = MaxAuthorities; type Rewards = BlockRewardsBase; @@ -1409,7 +1410,6 @@ impl pallet_block_rewards::Config for Runtime { type StakeGroupId = CollatorGroupId; type Weight = u64; type WeightInfo = weights::pallet_block_rewards::WeightInfo; - type ExistentialDeposit = ExistentialDeposit; } // Liquidity rewards diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index 5e40ab06e4..946966f313 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -1841,6 +1841,7 @@ impl pallet_block_rewards::Config for Runtime { type Beneficiary = Treasury; type Currency = Tokens; type CurrencyId = CurrencyId; + type ExistentialDeposit = ExistentialDeposit; type MaxChangesPerSession = MaxChangesPerEpoch; type MaxCollators = MaxAuthorities; type Rewards = BlockRewardsBase; @@ -1850,7 +1851,6 @@ impl pallet_block_rewards::Config for Runtime { type StakeGroupId = CollatorGroupId; type Weight = u64; type WeightInfo = weights::pallet_block_rewards::WeightInfo; - type ExistentialDeposit = ExistentialDeposit; } parameter_types! {