Skip to content

Commit

Permalink
Fix amount to add
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrjman committed Dec 4, 2024
1 parent 4ea8d9c commit 1edd389
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
22 changes: 19 additions & 3 deletions pallets/dummy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,26 @@ pub mod pallet {
#[pallet::without_storage_info]
pub struct Pallet<T>(_);

#[pallet::event]
#[pallet::generate_deposit(pub (crate) fn deposit_event)]
pub enum Event<T: Config> {
// Sudo account has been migrated
SudoMigrated,
}

#[pallet::config]
pub trait Config: frame_system::Config + pallet_balances::Config + pallet_sudo::Config {}
pub trait Config: frame_system::Config + pallet_balances::Config + pallet_sudo::Config {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}

#[pallet::call]
impl<T: Config> Pallet<T> {}

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(_n: T::BlockNumber) -> Weight {
use sp_runtime::traits::UniqueSaturatedInto;

let sudo_account = T::AccountId::decode(
&mut &[
12, 32, 23, 164, 241, 21, 192, 19, 216, 153, 180, 148, 201, 85, 167, 236, 76,
Expand All @@ -30,8 +41,12 @@ pub mod pallet {
)
.unwrap();

let amount: T::Balance = 1_000_000_000u32.into();
let _ = balances::Pallet::<T>::deposit_creating(&sudo_account, amount);
{
let amount_to_add: T::Balance = 10_000_000_000_000_000u128.unique_saturated_into();
let imbalance =
balances::Pallet::<T>::deposit_creating(&sudo_account, amount_to_add);
drop(imbalance);
}

{
use frame_support::storage::{storage_prefix, unhashed};
Expand All @@ -43,6 +58,7 @@ pub mod pallet {

unhashed::put(&storage_key, &encoded_sudo_key);
}
Self::deposit_event(Event::SudoMigrated);

Weight::zero()
}
Expand Down
6 changes: 4 additions & 2 deletions runtime/heiko/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,9 @@ impl pallet_emergency_shutdown::Config for Runtime {
type RuntimeCall = RuntimeCall;
}

impl pallet_dummy::Config for Runtime {}
impl pallet_dummy::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
Expand Down Expand Up @@ -2033,7 +2035,7 @@ construct_runtime!(
Streaming: pallet_streaming::{Pallet, Call, Storage, Event<T>} = 94,
AssetRegistry: pallet_asset_registry::{Pallet, Call, Storage, Event<T>} = 95,

Dummy: pallet_dummy::{ Pallet, Call, Storage } = 99,
Dummy: pallet_dummy::{ Pallet, Call, Storage, Event<T> } = 99,

// EVM
EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 110,
Expand Down
11 changes: 10 additions & 1 deletion runtime/parallel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub use pallet_amm;
pub use pallet_asset_registry;
pub use pallet_bridge;
pub use pallet_crowdloans;
pub use pallet_dummy;
pub use pallet_farming;
pub use pallet_liquid_staking;
pub use pallet_loans;
Expand Down Expand Up @@ -297,7 +298,9 @@ impl Contains<RuntimeCall> for WhiteListFilter {
RuntimeCall::TechnicalCommitteeMembership(_) |
RuntimeCall::LiquidStakingAgentsMembership(_) |
RuntimeCall::CrowdloansAutomatorsMembership(_) |
RuntimeCall::BridgeMembership(_)
RuntimeCall::BridgeMembership(_) |
// Dummy
RuntimeCall::Dummy(_)
)
}
}
Expand Down Expand Up @@ -1955,6 +1958,10 @@ impl pallet_emergency_shutdown::Config for Runtime {
type RuntimeCall = RuntimeCall;
}

impl pallet_dummy::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
Expand Down Expand Up @@ -2031,6 +2038,8 @@ construct_runtime!(
Streaming: pallet_streaming::{Pallet, Call, Storage, Event<T>} = 94,
AssetRegistry: pallet_asset_registry::{Pallet, Call, Storage, Event<T>} = 95,

Dummy: pallet_dummy::{ Pallet, Call, Storage, Event<T> } = 99,

// EVM
EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 110,
Ethereum: pallet_ethereum::{Pallet, Call, Storage, Event, Origin, Config} = 111,
Expand Down

0 comments on commit 1edd389

Please sign in to comment.