diff --git a/runtime/common/src/auctions.rs b/runtime/common/src/auctions.rs index e7c8f466f5c8..2d71fd432d0f 100644 --- a/runtime/common/src/auctions.rs +++ b/runtime/common/src/auctions.rs @@ -128,25 +128,31 @@ pub mod pallet { pub enum Event { /// An auction started. Provides its index and the block number where it will begin to /// close and the first lease period of the quadruplet that is auctioned. - /// `[auction_index, lease_period, ending]` - AuctionStarted(AuctionIndex, LeasePeriodOf, T::BlockNumber), - /// An auction ended. All funds become unreserved. `[auction_index]` - AuctionClosed(AuctionIndex), + AuctionStarted { + auction_index: AuctionIndex, + lease_period: LeasePeriodOf, + ending: T::BlockNumber, + }, + /// An auction ended. All funds become unreserved. + AuctionClosed { auction_index: AuctionIndex }, /// Funds were reserved for a winning bid. First balance is the extra amount reserved. - /// Second is the total. `[bidder, extra_reserved, total_amount]` - Reserved(T::AccountId, BalanceOf, BalanceOf), + /// Second is the total. + Reserved { bidder: T::AccountId, extra_reserved: BalanceOf, total_amount: BalanceOf }, /// Funds were unreserved since bidder is no longer active. `[bidder, amount]` - Unreserved(T::AccountId, BalanceOf), + Unreserved { bidder: T::AccountId, amount: BalanceOf }, /// Someone attempted to lease the same slot twice for a parachain. The amount is held in reserve /// but no parachain slot has been leased. - /// `[parachain_id, leaser, amount]` - ReserveConfiscated(ParaId, T::AccountId, BalanceOf), + ReserveConfiscated { para_id: ParaId, leaser: T::AccountId, amount: BalanceOf }, /// A new bid has been accepted as the current winner. - /// `[who, para_id, amount, first_slot, last_slot]` - BidAccepted(T::AccountId, ParaId, BalanceOf, LeasePeriodOf, LeasePeriodOf), + BidAccepted { + bidder: T::AccountId, + para_id: ParaId, + amount: BalanceOf, + first_slot: LeasePeriodOf, + last_slot: LeasePeriodOf, + }, /// The winning offset was chosen for an auction. This will map into the `Winning` storage map. - /// `[auction_index, block_number]` - WinningOffset(AuctionIndex, T::BlockNumber), + WinningOffset { auction_index: AuctionIndex, block_number: T::BlockNumber }, } #[pallet::error] @@ -397,7 +403,11 @@ impl Pallet { let ending = frame_system::Pallet::::block_number().saturating_add(duration); AuctionInfo::::put((lease_period_index, ending)); - Self::deposit_event(Event::::AuctionStarted(n, lease_period_index, ending)); + Self::deposit_event(Event::::AuctionStarted { + auction_index: n, + lease_period: lease_period_index, + ending, + }); Ok(()) } @@ -472,11 +482,11 @@ impl Pallet { // ...and record the amount reserved. ReservedAmounts::::insert(&bidder_para, reserve_required); - Self::deposit_event(Event::::Reserved( - bidder.clone(), - additional, - reserve_required, - )); + Self::deposit_event(Event::::Reserved { + bidder: bidder.clone(), + extra_reserved: additional, + total_amount: reserve_required, + }); } // Return any funds reserved for the previous winner if we are not in the ending period @@ -495,16 +505,20 @@ impl Pallet { // It really should be reserved; there's not much we can do here on fail. let err_amt = CurrencyOf::::unreserve(&who, amount); debug_assert!(err_amt.is_zero()); - Self::deposit_event(Event::::Unreserved(who, amount)); + Self::deposit_event(Event::::Unreserved { bidder: who, amount }); } } } // Update the range winner. Winning::::insert(offset, ¤t_winning); - Self::deposit_event(Event::::BidAccepted( - bidder, para, amount, first_slot, last_slot, - )); + Self::deposit_event(Event::::BidAccepted { + bidder, + para_id: para, + amount, + first_slot, + last_slot, + }); } Ok(()) } @@ -535,7 +549,10 @@ impl Pallet { T::SampleLength::get().max(One::one()); let auction_counter = AuctionCounter::::get(); - Self::deposit_event(Event::::WinningOffset(auction_counter, offset)); + Self::deposit_event(Event::::WinningOffset { + auction_index: auction_counter, + block_number: offset, + }); let res = Winning::::get(offset) .unwrap_or([Self::EMPTY; SlotRange::SLOT_RANGE_COUNT]); // This `remove_all` statement should remove at most `EndingPeriod` / `SampleLength` items, @@ -585,14 +602,20 @@ impl Pallet { // The leaser attempted to get a second lease on the same para ID, possibly griefing us. Let's // keep the amount reserved and let governance sort it out. if CurrencyOf::::reserve(&leaser, amount).is_ok() { - Self::deposit_event(Event::::ReserveConfiscated(para, leaser, amount)); + Self::deposit_event(Event::::ReserveConfiscated { + para_id: para, + leaser, + amount, + }); } }, Ok(()) => {}, // Nothing to report. } } - Self::deposit_event(Event::::AuctionClosed(AuctionCounter::::get())); + Self::deposit_event(Event::::AuctionClosed { + auction_index: AuctionCounter::::get(), + }); } /// Calculate the final winners from the winning slots. @@ -1763,11 +1786,11 @@ mod benchmarking { let origin = T::InitiateOrigin::successful_origin(); }: _(RawOrigin::Root, duration, lease_period_index) verify { - assert_last_event::(Event::::AuctionStarted( - AuctionCounter::::get(), - LeasePeriodOf::::max_value(), - T::BlockNumber::max_value(), - ).into()); + assert_last_event::(Event::::AuctionStarted { + auction_index: AuctionCounter::::get(), + lease_period: LeasePeriodOf::::max_value(), + ending: T::BlockNumber::max_value(), + }.into()); } // Worst case scenario a new bid comes in which kicks out an existing bid for the same slot. @@ -1859,7 +1882,7 @@ mod benchmarking { Auctions::::on_initialize(duration + now + T::EndingPeriod::get()); } verify { let auction_index = AuctionCounter::::get(); - assert_last_event::(Event::::AuctionClosed(auction_index).into()); + assert_last_event::(Event::::AuctionClosed { auction_index }.into()); assert!(Winning::::iter().count().is_zero()); } diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index f22b6636c33c..e2731f9336cc 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -183,8 +183,8 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// Someone claimed some DOTs. `[who, ethereum_address, amount]` - Claimed(T::AccountId, EthereumAddress, BalanceOf), + /// Someone claimed some DOTs. + Claimed { who: T::AccountId, ethereum_address: EthereumAddress, amount: BalanceOf }, } #[pallet::error] @@ -581,7 +581,11 @@ impl Pallet { Signing::::remove(&signer); // Let's deposit an event to let the outside world know this happened. - Self::deposit_event(Event::::Claimed(dest, signer, balance_due)); + Self::deposit_event(Event::::Claimed { + who: dest, + ethereum_address: signer, + amount: balance_due, + }); Ok(()) } diff --git a/runtime/common/src/crowdloan/mod.rs b/runtime/common/src/crowdloan/mod.rs index e48b1b51b818..bbb74c634ade 100644 --- a/runtime/common/src/crowdloan/mod.rs +++ b/runtime/common/src/crowdloan/mod.rs @@ -254,27 +254,27 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// Create a new crowdloaning campaign. `[fund_index]` - Created(ParaId), - /// Contributed to a crowd sale. `[who, fund_index, amount]` - Contributed(T::AccountId, ParaId, BalanceOf), - /// Withdrew full balance of a contributor. `[who, fund_index, amount]` - Withdrew(T::AccountId, ParaId, BalanceOf), + /// Create a new crowdloaning campaign. + Created { para_id: ParaId }, + /// Contributed to a crowd sale. + Contributed { who: T::AccountId, fund_index: ParaId, amount: BalanceOf }, + /// Withdrew full balance of a contributor. + Withdrew { who: T::AccountId, fund_index: ParaId, amount: BalanceOf }, /// The loans in a fund have been partially dissolved, i.e. there are some left - /// over child keys that still need to be killed. `[fund_index]` - PartiallyRefunded(ParaId), - /// All loans in a fund have been refunded. `[fund_index]` - AllRefunded(ParaId), - /// Fund is dissolved. `[fund_index]` - Dissolved(ParaId), + /// over child keys that still need to be killed. + PartiallyRefunded { para_id: ParaId }, + /// All loans in a fund have been refunded. + AllRefunded { para_id: ParaId }, + /// Fund is dissolved. + Dissolved { para_id: ParaId }, /// The result of trying to submit a new bid to the Slots pallet. - HandleBidResult(ParaId, DispatchResult), - /// The configuration to a crowdloan has been edited. `[fund_index]` - Edited(ParaId), - /// A memo has been updated. `[who, fund_index, memo]` - MemoUpdated(T::AccountId, ParaId, Vec), + HandleBidResult { para_id: ParaId, result: DispatchResult }, + /// The configuration to a crowdloan has been edited. + Edited { para_id: ParaId }, + /// A memo has been updated. + MemoUpdated { who: T::AccountId, para_id: ParaId, memo: Vec }, /// A parachain has been moved to `NewRaise` - AddedToNewRaise(ParaId), + AddedToNewRaise { para_id: ParaId }, } #[pallet::error] @@ -351,7 +351,7 @@ pub mod pallet { fund.raised, ); - Self::deposit_event(Event::::HandleBidResult(para_id, result)); + Self::deposit_event(Event::::HandleBidResult { para_id, result }); } T::WeightInfo::on_initialize(new_raise_len) } else { @@ -437,7 +437,7 @@ pub mod pallet { // Add a lock to the para so that the configuration cannot be changed. T::Registrar::apply_lock(index); - Self::deposit_event(Event::::Created(index)); + Self::deposit_event(Event::::Created { para_id: index }); Ok(()) } @@ -494,7 +494,7 @@ pub mod pallet { Funds::::insert(index, &fund); - Self::deposit_event(Event::::Withdrew(who, index, balance)); + Self::deposit_event(Event::::Withdrew { who, fund_index: index, amount: balance }); Ok(()) } @@ -536,11 +536,11 @@ pub mod pallet { Funds::::insert(index, &fund); if all_refunded { - Self::deposit_event(Event::::AllRefunded(index)); + Self::deposit_event(Event::::AllRefunded { para_id: index }); // Refund for unused refund count. Ok(Some(T::WeightInfo::refund(refund_count)).into()) } else { - Self::deposit_event(Event::::PartiallyRefunded(index)); + Self::deposit_event(Event::::PartiallyRefunded { para_id: index }); // No weight to refund since we did not finish the loop. Ok(().into()) } @@ -567,7 +567,7 @@ pub mod pallet { CurrencyOf::::unreserve(&fund.depositor, fund.deposit); Funds::::remove(index); - Self::deposit_event(Event::::Dissolved(index)); + Self::deposit_event(Event::::Dissolved { para_id: index }); Ok(()) } @@ -604,7 +604,7 @@ pub mod pallet { }, ); - Self::deposit_event(Event::::Edited(index)); + Self::deposit_event(Event::::Edited { para_id: index }); Ok(()) } @@ -622,7 +622,7 @@ pub mod pallet { ensure!(balance > Zero::zero(), Error::::NoContributions); Self::contribution_put(fund.fund_index, &who, &balance, &memo); - Self::deposit_event(Event::::MemoUpdated(who, index, memo)); + Self::deposit_event(Event::::MemoUpdated { who, para_id: index, memo }); Ok(()) } @@ -636,7 +636,7 @@ pub mod pallet { ensure!(!fund.raised.is_zero(), Error::::NoContributions); ensure!(!NewRaise::::get().contains(&index), Error::::AlreadyInNewRaise); NewRaise::::append(index); - Self::deposit_event(Event::::AddedToNewRaise(index)); + Self::deposit_event(Event::::AddedToNewRaise { para_id: index }); Ok(()) } @@ -810,7 +810,7 @@ impl Pallet { Funds::::insert(index, &fund); - Self::deposit_event(Event::::Contributed(who, index, value)); + Self::deposit_event(Event::::Contributed { who, fund_index: index, amount: value }); Ok(()) } } @@ -1648,14 +1648,17 @@ mod tests { // Move to the end of the crowdloan run_to_block(10); assert_ok!(Crowdloan::refund(Origin::signed(1337), para)); - assert_eq!(last_event(), super::Event::::PartiallyRefunded(para).into()); + assert_eq!( + last_event(), + super::Event::::PartiallyRefunded { para_id: para }.into() + ); // Funds still left over assert!(!Balances::free_balance(account_id).is_zero()); // Call again assert_ok!(Crowdloan::refund(Origin::signed(1337), para)); - assert_eq!(last_event(), super::Event::::AllRefunded(para).into()); + assert_eq!(last_event(), super::Event::::AllRefunded { para_id: para }.into()); // Funds are returned assert_eq!(Balances::free_balance(account_id), 0); @@ -1983,7 +1986,7 @@ mod benchmarking { }: _(RawOrigin::Signed(caller), para_id, cap, first_period, last_period, end, Some(verifier)) verify { - assert_last_event::(Event::::Created(para_id).into()) + assert_last_event::(Event::::Created { para_id }.into()) } // Contribute has two arms: PreEnding and Ending, but both are equal complexity. @@ -2004,7 +2007,7 @@ mod benchmarking { verify { // NewRaise is appended to, so we don't need to fill it up for worst case scenario. assert!(!NewRaise::::get().is_empty()); - assert_last_event::(Event::::Contributed(caller, fund_index, contribution).into()); + assert_last_event::(Event::::Contributed { who: caller, fund_index, amount: contribution }.into()); } withdraw { @@ -2017,7 +2020,7 @@ mod benchmarking { frame_system::Pallet::::set_block_number(T::BlockNumber::max_value()); }: _(RawOrigin::Signed(caller), contributor.clone(), fund_index) verify { - assert_last_event::(Event::::Withdrew(contributor, fund_index, T::MinContribution::get()).into()); + assert_last_event::(Event::::Withdrew { who: contributor, fund_index, amount: T::MinContribution::get() }.into()); } // Worst case: Refund removes `RemoveKeysLimit` keys, and is fully refunded. @@ -2037,7 +2040,7 @@ mod benchmarking { frame_system::Pallet::::set_block_number(T::BlockNumber::max_value()); }: _(RawOrigin::Signed(caller), fund_index) verify { - assert_last_event::(Event::::AllRefunded(fund_index).into()); + assert_last_event::(Event::::AllRefunded { para_id: fund_index }.into()); } dissolve { @@ -2048,7 +2051,7 @@ mod benchmarking { frame_system::Pallet::::set_block_number(T::BlockNumber::max_value()); }: _(RawOrigin::Signed(caller.clone()), fund_index) verify { - assert_last_event::(Event::::Dissolved(fund_index).into()); + assert_last_event::(Event::::Dissolved { para_id: fund_index }.into()); } edit { @@ -2077,7 +2080,7 @@ mod benchmarking { // Doesn't matter what we edit to, so use the same values. }: _(RawOrigin::Root, para_id, cap, first_period, last_period, end, Some(verifier)) verify { - assert_last_event::(Event::::Edited(para_id).into()) + assert_last_event::(Event::::Edited { para_id }.into()) } add_memo { @@ -2107,7 +2110,7 @@ mod benchmarking { }: _(RawOrigin::Signed(caller), fund_index) verify { assert!(!NewRaise::::get().is_empty()); - assert_last_event::(Event::::AddedToNewRaise(fund_index).into()) + assert_last_event::(Event::::AddedToNewRaise { para_id: fund_index }.into()) } // Worst case scenario: N funds are all in the `NewRaise` list, we are @@ -2146,7 +2149,7 @@ mod benchmarking { Crowdloan::::on_initialize(end_block); } verify { assert_eq!(EndingsCount::::get(), old_endings_count + 1); - assert_last_event::(Event::::HandleBidResult((n - 1).into(), Ok(())).into()); + assert_last_event::(Event::::HandleBidResult { para_id: (n - 1).into(), result: Ok(()) }.into()); } impl_benchmark_test_suite!( diff --git a/runtime/common/src/integration_tests.rs b/runtime/common/src/integration_tests.rs index 7ff7afe4fdf2..76dc1f4c55b0 100644 --- a/runtime/common/src/integration_tests.rs +++ b/runtime/common/src/integration_tests.rs @@ -432,10 +432,17 @@ fn basic_end_to_end_works() { // Auction ends at block 110 + offset run_to_block(109 + offset); assert!(contains_event( - crowdloan::Event::::HandleBidResult(ParaId::from(para_2), Ok(())).into() + crowdloan::Event::::HandleBidResult { + para_id: ParaId::from(para_2), + result: Ok(()) + } + .into() )); run_to_block(110 + offset); - assert_eq!(last_event(), auctions::Event::::AuctionClosed(1).into()); + assert_eq!( + last_event(), + auctions::Event::::AuctionClosed { auction_index: 1 }.into() + ); // Paras should have won slots assert_eq!( diff --git a/runtime/common/src/paras_registrar.rs b/runtime/common/src/paras_registrar.rs index 59806e0cf639..7631914b9992 100644 --- a/runtime/common/src/paras_registrar.rs +++ b/runtime/common/src/paras_registrar.rs @@ -127,9 +127,9 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - Registered(ParaId, T::AccountId), - Deregistered(ParaId), - Reserved(ParaId, T::AccountId), + Registered { para_id: ParaId, manager: T::AccountId }, + Deregistered { para_id: ParaId }, + Reserved { para_id: ParaId, who: T::AccountId }, } #[pallet::error] @@ -492,7 +492,7 @@ impl Pallet { let info = ParaInfo { manager: who.clone(), deposit, locked: false }; Paras::::insert(id, info); - Self::deposit_event(Event::::Reserved(id, who)); + Self::deposit_event(Event::::Reserved { para_id: id, who }); Ok(()) } @@ -530,7 +530,7 @@ impl Pallet { // We check above that para has no lifecycle, so this should not fail. let res = runtime_parachains::schedule_para_initialize::(id, genesis); debug_assert!(res.is_ok()); - Self::deposit_event(Event::::Registered(id, who)); + Self::deposit_event(Event::::Registered { para_id: id, manager: who }); Ok(()) } @@ -549,7 +549,7 @@ impl Pallet { } PendingSwap::::remove(id); - Self::deposit_event(Event::::Deregistered(id)); + Self::deposit_event(Event::::Deregistered { para_id: id }); Ok(()) } @@ -1268,7 +1268,7 @@ mod benchmarking { T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); }: _(RawOrigin::Signed(caller.clone())) verify { - assert_last_event::(Event::::Reserved(LOWEST_PUBLIC_ID, caller).into()); + assert_last_event::(Event::::Reserved { para_id: LOWEST_PUBLIC_ID, who: caller }.into()); assert!(Paras::::get(LOWEST_PUBLIC_ID).is_some()); assert_eq!(paras::Pallet::::lifecycle(LOWEST_PUBLIC_ID), None); } @@ -1282,7 +1282,7 @@ mod benchmarking { assert_ok!(Registrar::::reserve(RawOrigin::Signed(caller.clone()).into())); }: _(RawOrigin::Signed(caller.clone()), para, genesis_head, validation_code) verify { - assert_last_event::(Event::::Registered(para, caller).into()); + assert_last_event::(Event::::Registered{ para_id: para, manager: caller }.into()); assert_eq!(paras::Pallet::::lifecycle(para), Some(ParaLifecycle::Onboarding)); next_scheduled_session::(); assert_eq!(paras::Pallet::::lifecycle(para), Some(ParaLifecycle::Parathread)); @@ -1296,7 +1296,7 @@ mod benchmarking { let validation_code = Registrar::::worst_validation_code(); }: _(RawOrigin::Root, manager.clone(), deposit, para, genesis_head, validation_code) verify { - assert_last_event::(Event::::Registered(para, manager).into()); + assert_last_event::(Event::::Registered { para_id: para, manager }.into()); assert_eq!(paras::Pallet::::lifecycle(para), Some(ParaLifecycle::Onboarding)); next_scheduled_session::(); assert_eq!(paras::Pallet::::lifecycle(para), Some(ParaLifecycle::Parathread)); @@ -1308,7 +1308,7 @@ mod benchmarking { let caller: T::AccountId = whitelisted_caller(); }: _(RawOrigin::Signed(caller), para) verify { - assert_last_event::(Event::::Deregistered(para).into()); + assert_last_event::(Event::::Deregistered { para_id: para }.into()); } swap { diff --git a/runtime/common/src/purchase.rs b/runtime/common/src/purchase.rs index 9e8bd2c9081f..b534e2277059 100644 --- a/runtime/common/src/purchase.rs +++ b/runtime/common/src/purchase.rs @@ -133,19 +133,19 @@ pub mod pallet { #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// A [new] account was created. - AccountCreated(T::AccountId), - /// Someone's account validity was updated. [who, validity] - ValidityUpdated(T::AccountId, AccountValidity), - /// Someone's purchase balance was updated. [who, free, locked] - BalanceUpdated(T::AccountId, BalanceOf, BalanceOf), - /// A payout was made to a purchaser. [who, free, locked] - PaymentComplete(T::AccountId, BalanceOf, BalanceOf), - /// A new payment account was set. [who] - PaymentAccountSet(T::AccountId), + AccountCreated { who: T::AccountId }, + /// Someone's account validity was updated. + ValidityUpdated { who: T::AccountId, validity: AccountValidity }, + /// Someone's purchase balance was updated. + BalanceUpdated { who: T::AccountId, free: BalanceOf, locked: BalanceOf }, + /// A payout was made to a purchaser. + PaymentComplete { who: T::AccountId, free: BalanceOf, locked: BalanceOf }, + /// A new payment account was set. + PaymentAccountSet { who: T::AccountId }, /// A new statement was set. StatementUpdated, /// A new statement was set. `[block_number]` - UnlockBlockUpdated(T::BlockNumber), + UnlockBlockUpdated { block_number: T::BlockNumber }, } #[pallet::error] @@ -222,7 +222,7 @@ pub mod pallet { vat: Permill::zero(), }; Accounts::::insert(&who, status); - Self::deposit_event(Event::::AccountCreated(who)); + Self::deposit_event(Event::::AccountCreated { who }); Ok(()) } @@ -251,7 +251,7 @@ pub mod pallet { Ok(()) }, )?; - Self::deposit_event(Event::::ValidityUpdated(who, validity)); + Self::deposit_event(Event::::ValidityUpdated { who, validity }); Ok(()) } @@ -283,7 +283,11 @@ pub mod pallet { Ok(()) }, )?; - Self::deposit_event(Event::::BalanceUpdated(who, free_balance, locked_balance)); + Self::deposit_event(Event::::BalanceUpdated { + who, + free: free_balance, + locked: locked_balance, + }); Ok(()) } @@ -346,11 +350,11 @@ pub mod pallet { // Setting the user account to `Completed` ends the purchase process for this user. status.validity = AccountValidity::Completed; - Self::deposit_event(Event::::PaymentComplete( - who.clone(), - status.free_balance, - status.locked_balance, - )); + Self::deposit_event(Event::::PaymentComplete { + who: who.clone(), + free: status.free_balance, + locked: status.locked_balance, + }); Ok(()) }, )?; @@ -367,7 +371,7 @@ pub mod pallet { T::ConfigurationOrigin::ensure_origin(origin)?; // Possibly this is worse than having the caller account be the payment account? PaymentAccount::::put(who.clone()); - Self::deposit_event(Event::::PaymentAccountSet(who)); + Self::deposit_event(Event::::PaymentAccountSet { who }); Ok(()) } @@ -402,7 +406,7 @@ pub mod pallet { ); // Possibly this is worse than having the caller account be the payment account? UnlockBlock::::set(unlock_block); - Self::deposit_event(Event::::UnlockBlockUpdated(unlock_block)); + Self::deposit_event(Event::::UnlockBlockUpdated { block_number: unlock_block }); Ok(()) } } diff --git a/runtime/common/src/slots/mod.rs b/runtime/common/src/slots/mod.rs index 3796c3330c3a..1b76e508dadf 100644 --- a/runtime/common/src/slots/mod.rs +++ b/runtime/common/src/slots/mod.rs @@ -122,19 +122,18 @@ pub mod pallet { #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// A new `[lease_period]` is beginning. - NewLeasePeriod(LeasePeriodOf), + NewLeasePeriod { lease_period: LeasePeriodOf }, /// A para has won the right to a continuous set of lease periods as a parachain. /// First balance is any extra amount reserved on top of the para's existing deposit. /// Second balance is the total amount reserved. - /// `[parachain_id, leaser, period_begin, period_count, extra_reserved, total_amount]` - Leased( - ParaId, - T::AccountId, - LeasePeriodOf, - LeasePeriodOf, - BalanceOf, - BalanceOf, - ), + Leased { + para_id: ParaId, + leaser: T::AccountId, + period_begin: LeasePeriodOf, + period_count: LeasePeriodOf, + extra_reserved: BalanceOf, + total_amount: BalanceOf, + }, } #[pallet::error] @@ -228,7 +227,7 @@ impl Pallet { /// We need to on-board and off-board parachains as needed. We should also handle reducing/ /// returning deposits. fn manage_lease_period_start(lease_period_index: LeasePeriodOf) -> Weight { - Self::deposit_event(Event::::NewLeasePeriod(lease_period_index)); + Self::deposit_event(Event::::NewLeasePeriod { lease_period: lease_period_index }); let old_parachains = T::Registrar::parachains(); @@ -408,14 +407,14 @@ impl Leaser for Pallet { let _ = T::Registrar::make_parachain(para); } - Self::deposit_event(Event::::Leased( - para, - leaser.clone(), + Self::deposit_event(Event::::Leased { + para_id: para, + leaser: leaser.clone(), period_begin, period_count, - reserved, - amount, - )); + extra_reserved: reserved, + total_amount: amount, + }); Ok(()) }) @@ -1027,7 +1026,13 @@ mod benchmarking { let period_count = 3u32.into(); }: _(RawOrigin::Root, para, leaser.clone(), amount, period_begin, period_count) verify { - assert_last_event::(Event::::Leased(para, leaser, period_begin, period_count, amount, amount).into()); + assert_last_event::(Event::::Leased { + para_id: para, + leaser, period_begin, + period_count, + extra_reserved: amount, + total_amount: amount, + }.into()); } // Worst case scenario, T parathreads onboard, and C parachains offboard.