Skip to content

Commit

Permalink
Part.6
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed Oct 18, 2024
1 parent 1f64c62 commit 630781b
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 619 deletions.
25 changes: 0 additions & 25 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ darwinia-common-runtime = { path = "runtime/common", default-features
darwinia-deposit = { path = "pallet/deposit", default-features = false }
darwinia-ethtx-forwarder = { path = "pallet/ethtx-forwarder", default-features = false }
darwinia-precompile-assets = { path = "precompile/assets", default-features = false }
darwinia-precompile-staking = { path = "precompile/staking", default-features = false }
darwinia-precompile-state-storage = { path = "precompile/state-storage", default-features = false }
darwinia-runtime = { path = "runtime/darwinia" }
darwinia-staking = { path = "pallet/staking", default-features = false }
Expand Down
33 changes: 0 additions & 33 deletions pallet/account-migration/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,6 @@ use frame_support::derive_impl;
use sp_io::TestExternalities;
use sp_runtime::BuildStorage;

pub struct Dummy;
impl darwinia_deposit::SimpleAsset for Dummy {
type AccountId = AccountId;

fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult {
Ok(())
}

fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult {
Ok(())
}
}
impl darwinia_staking::Stake for Dummy {
type AccountId = AccountId;
type Item = Balance;

fn stake(_: &Self::AccountId, _: Self::Item) -> sp_runtime::DispatchResult {
Ok(())
}

fn unstake(_: &Self::AccountId, _: Self::Item) -> sp_runtime::DispatchResult {
Ok(())
}
}

#[sp_version::runtime_version]
pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Darwinia2"),
Expand Down Expand Up @@ -125,8 +100,6 @@ frame_support::parameter_types! {

impl darwinia_deposit::Config for Runtime {
type DepositMigrator = ();
type Kton = Dummy;
type MaxDeposits = frame_support::traits::ConstU32<512>;
type Ring = Balances;
type RuntimeEvent = RuntimeEvent;
type Treasury = ();
Expand All @@ -135,20 +108,14 @@ impl darwinia_deposit::Config for Runtime {

impl darwinia_staking::Config for Runtime {
type Currency = Balances;
type Deposit = Deposit;
type IssuingManager = ();
type KtonStaking = ();
type MaxDeposits = frame_support::traits::ConstU32<512>;
type Ring = Dummy;
type RingStaking = ();
type RuntimeEvent = RuntimeEvent;
type ShouldEndSession = ();
type Treasury = ();
type UnixTime = Timestamp;
type WeightInfo = ();
}
#[cfg(not(feature = "runtime-benchmarks"))]
impl darwinia_staking::DepositConfig for Runtime {}

impl crate::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
Expand Down
9 changes: 5 additions & 4 deletions pallet/staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ mod benchmarks {
let a = frame_benchmarking::whitelisted_caller::<T::AccountId>();
let a_cloned = a.clone();

// Worst-case scenario:
//
// The total number of deposit items has reached `darwinia_deposits::Config::MaxDeposits`.
<Ledgers<T>>::insert(&a, Ledger { ring: 1, deposits: BoundedVec::new() });

#[extrinsic_call]
_(RawOrigin::Signed(a), a_cloned);
}
Expand All @@ -45,6 +44,8 @@ mod benchmarks {
let a = frame_benchmarking::whitelisted_caller::<T::AccountId>();
let a_cloned = a.clone();

<PendingRewards<T>>::insert(&a, 1);

#[extrinsic_call]
_(RawOrigin::Signed(a), a_cloned);
}
Expand Down Expand Up @@ -78,7 +79,7 @@ mod benchmarks {

frame_benchmarking::impl_benchmark_test_suite!(
Pallet,
crate::mock::ExtBuilder::default().build(),
crate::mock::ExtBuilder.build(),
crate::mock::Runtime
);
}
8 changes: 4 additions & 4 deletions pallet/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl pallet_session::Config for Runtime {

frame_support::parameter_types! {
pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry");
pub TreasuryAcct: AccountId = Treasury::account_id();
pub TreasuryAccount: AccountId = Treasury::account_id();
}
#[cfg(feature = "runtime-benchmarks")]
pub struct DummyBenchmarkHelper;
Expand Down Expand Up @@ -175,7 +175,7 @@ impl pallet_treasury::Config for Runtime {
type MaxApprovals = ();
type OnSlash = ();
type PalletId = TreasuryPalletId;
type Paymaster = frame_support::traits::tokens::PayFromAccount<Balances, TreasuryAcct>;
type Paymaster = frame_support::traits::tokens::PayFromAccount<Balances, TreasuryAccount>;
type PayoutPeriod = ();
type ProposalBond = ();
type ProposalBondMaximum = ();
Expand Down Expand Up @@ -257,7 +257,7 @@ pub enum KtonStaking {}
impl crate::Reward<AccountId> for KtonStaking {
fn allocate(_: Option<AccountId>, amount: Balance) {
let _ = Balances::transfer_keep_alive(
RuntimeOrigin::signed(TreasuryAcct::get()),
RuntimeOrigin::signed(TreasuryAccount::get()),
<KtonStakingContract<Runtime>>::get().unwrap(),
amount,
);
Expand All @@ -269,7 +269,7 @@ impl crate::Config for Runtime {
type KtonStaking = KtonStaking;
type RingStaking = RingStaking;
type RuntimeEvent = RuntimeEvent;
type Treasury = TreasuryAcct;
type Treasury = TreasuryAccount;
type UnixTime = Timestamp;
type WeightInfo = ();
}
Expand Down
72 changes: 0 additions & 72 deletions precompile/staking/Cargo.toml

This file was deleted.

84 changes: 0 additions & 84 deletions precompile/staking/src/lib.rs

This file was deleted.

Loading

0 comments on commit 630781b

Please sign in to comment.