Skip to content
Snippets Groups Projects
Commit a6fd8f78 authored by Shawn Tabrizi's avatar Shawn Tabrizi Committed by GitHub
Browse files

Emit an Event for Random Block Selected in Auction (#2740)

* Update auctions.rs

* Update auctions.rs
parent 8ebbe19d
No related merge requests found
...@@ -147,6 +147,9 @@ decl_event!( ...@@ -147,6 +147,9 @@ decl_event!(
/// A new bid has been accepted as the current winner. /// A new bid has been accepted as the current winner.
/// \[who, para_id, amount, first_slot, last_slot\] /// \[who, para_id, amount, first_slot, last_slot\]
BidAccepted(AccountId, ParaId, Balance, LeasePeriod, LeasePeriod), BidAccepted(AccountId, ParaId, Balance, LeasePeriod, LeasePeriod),
/// The winning offset was chosen for an auction. This will map into the `Winning` storage map.
/// \[auction_index, block_number\]
WinningOffset(AuctionIndex, BlockNumber),
} }
); );
...@@ -496,6 +499,8 @@ impl<T: Config> Module<T> { ...@@ -496,6 +499,8 @@ impl<T: Config> Module<T> {
.expect("secure hashes should always be bigger than the block number; qed"); .expect("secure hashes should always be bigger than the block number; qed");
let offset = (raw_offset_block_number % ending_period) / T::SampleLength::get(); let offset = (raw_offset_block_number % ending_period) / T::SampleLength::get();
let auction_counter = AuctionCounter::get();
Self::deposit_event(RawEvent::WinningOffset(auction_counter, offset));
let res = Winning::<T>::get(offset).unwrap_or_default(); let res = Winning::<T>::get(offset).unwrap_or_default();
let mut i = T::BlockNumber::zero(); let mut i = T::BlockNumber::zero();
while i < ending_period { while i < ending_period {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment