Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upgrade zrml-rikiddo
  • Loading branch information
sea212 committed Apr 21, 2024
commit eb69c207d1b1e11cef1d3c3d5149015210b5529d
3 changes: 2 additions & 1 deletion zrml/rikiddo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub mod pallet {
traits::{Get, Hooks, StorageVersion, Time},
Twox64Concat,
};
use frame_system::pallet_prelude::BlockNumberFor;
use parity_scale_codec::{Decode, Encode, FullCodec, FullEncode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::DispatchError;
Expand Down Expand Up @@ -150,7 +151,7 @@ pub mod pallet {
StorageMap<_, Twox64Concat, T::PoolId, T::Rikiddo>;

#[pallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<T::BlockNumber> for Pallet<T, I> {}
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {}

#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
Expand Down
42 changes: 19 additions & 23 deletions zrml/rikiddo/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@

use crate::types::{EmaMarketVolume, FeeSigmoid, RikiddoSigmoidMV};
use frame_support::{construct_runtime, parameter_types, traits::Everything};
use frame_system::mocking::MockBlock;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
};
use substrate_fixed::{types::extra::U33, FixedI128, FixedU128};
use zeitgeist_primitives::{
constants::mock::{BlockHashCount, ExistentialDeposit, MaxReserves, BASE},
types::{
AccountIdTest, Balance, BlockNumber, BlockTest, Hash, Index, Moment, PoolId,
UncheckedExtrinsicTest,
},
constants::mock::{BlockHashCount, ExistentialDeposit, MaxLocks, MaxReserves, BASE},
types::{AccountIdTest, Balance, Hash, Moment, PoolId},
};

pub const ALICE: AccountIdTest = 0;
Expand All @@ -52,16 +50,11 @@ parameter_types! {
}

construct_runtime!(
pub enum Runtime
where
Block = BlockTest<Runtime>,
NodeBlock = BlockTest<Runtime>,
UncheckedExtrinsic = UncheckedExtrinsicTest<Runtime>,
{
Balances: pallet_balances::{Call, Config<T>, Event<T>, Pallet, Storage},
Rikiddo: crate::{Pallet, Storage},
System: frame_system::{Call, Config, Event<T>, Pallet, Storage},
Timestamp: pallet_timestamp::{Call, Pallet, Storage, Inherent},
pub enum Runtime {
Balances: pallet_balances,
Rikiddo: crate,
System: frame_system,
Timestamp: pallet_timestamp,
}
);

Expand All @@ -84,37 +77,40 @@ impl frame_system::Config for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
type AccountId = AccountIdTest;
type BaseCallFilter = Everything;
type Block = MockBlock<Runtime>;
type BlockHashCount = BlockHashCount;
type BlockLength = ();
type BlockNumber = BlockNumber;
type BlockWeights = ();
type RuntimeCall = RuntimeCall;
type DbWeight = ();
type RuntimeEvent = RuntimeEvent;
type Hash = Hash;
type Hashing = BlakeTwo256;
type Header = Header;
type Index = Index;
type Lookup = IdentityLookup<Self::AccountId>;
type Nonce = u64;
type MaxConsumers = frame_support::traits::ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
type RuntimeOrigin = RuntimeOrigin;
type PalletInfo = PalletInfo;
type SS58Prefix = ();
type SystemWeightInfo = ();
type Version = ();
type OnSetCode = ();
}

impl pallet_balances::Config for Runtime {
type AccountStore = System;
type Balance = Balance;
type DustRemoval = ();
type FreezeIdentifier = ();
type RuntimeHoldReason = ();
type RuntimeEvent = RuntimeEvent;
type MaxReserves = MaxReserves;
type ExistentialDeposit = ExistentialDeposit;
type MaxLocks = ();
type MaxHolds = ();
type MaxFreezes = ();
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
}
Expand Down Expand Up @@ -147,7 +143,7 @@ impl Default for ExtBuilder {

impl ExtBuilder {
pub fn build(self) -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
let mut t = frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();

// see the logs in tests when using `RUST_LOG=debug cargo test -- --nocapture`
let _ = env_logger::builder().is_test(true).try_init();
Expand Down
3 changes: 1 addition & 2 deletions zrml/rikiddo/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ extern crate alloc;
use arbitrary::{Arbitrary, Result as ArbiraryResult, Unstructured};
#[cfg(feature = "arbitrary")]
use core::mem;
use frame_support::dispatch::{Decode, Encode};
use parity_scale_codec::MaxEncodedLen;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::RuntimeDebug;
use substrate_fixed::traits::Fixed;
Expand Down
3 changes: 1 addition & 2 deletions zrml/rikiddo/src/types/ema_market_volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ use crate::{
use arbitrary::{Arbitrary, Result as ArbitraryResult, Unstructured};
#[cfg(feature = "arbitrary")]
use core::mem;
use frame_support::dispatch::{Decode, Encode};
use parity_scale_codec::MaxEncodedLen;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::RuntimeDebug;
use substrate_fixed::{
Expand Down
3 changes: 1 addition & 2 deletions zrml/rikiddo/src/types/rikiddo_sigmoid_mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ use alloc::vec::Vec;
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Result as ArbiraryResult, Unstructured};
use core::ops::{AddAssign, BitOrAssign, ShlAssign};
use frame_support::dispatch::{Decode, Encode};
use hashbrown::HashMap;
use parity_scale_codec::MaxEncodedLen;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::RuntimeDebug;
use substrate_fixed::{
Expand Down
3 changes: 1 addition & 2 deletions zrml/rikiddo/src/types/sigmoid_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ use crate::{
use arbitrary::{Arbitrary, Result as ArbiraryResult, Unstructured};
#[cfg(feature = "arbitrary")]
use core::mem;
use frame_support::dispatch::{Decode, Encode};
use parity_scale_codec::MaxEncodedLen;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::RuntimeDebug;
use substrate_fixed::{
Expand Down