Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/event to use named fields #1708

Merged
merged 15 commits into from
Dec 22, 2021
Merged
120 changes: 23 additions & 97 deletions Cargo.lock

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

12 changes: 10 additions & 2 deletions ecosystem-modules/compound-cash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ pub mod module {
#[pallet::generate_deposit(pub fn deposit_event)]
pub enum Event<T: Config> {
/// Set the future yield for the Cash asset.
FutureYieldSet(Balance, CashYieldIndex, Moment),
FutureYieldSet {
yield_amount: Balance,
index: CashYieldIndex,
timestamp: Moment,
},
}

/// Stores a history of yields that have already been consumed.
Expand Down Expand Up @@ -102,7 +106,11 @@ impl<T: Config> Pallet<T> {
);

FutureYield::<T>::insert(yield_index, (next_cash_yield, timestamp_effective));

Self::deposit_event(Event::FutureYieldSet {
yield_amount: next_cash_yield,
index: yield_index,
timestamp: timestamp_effective,
});
Ok(())
}
}
Expand Down
26 changes: 17 additions & 9 deletions ecosystem-modules/ren/renvm-bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ pub mod module {
#[pallet::event]
#[pallet::generate_deposit(fn deposit_event)]
pub enum Event<T: Config> {
/// Asset minted. \[owner, amount\]
Minted(T::AccountId, Balance),
/// Asset burnt in this chain \[owner, dest, amount\]
Burnt(T::AccountId, DestAddress, Balance),
/// Rotated key \[new_key\]
RotatedKey(PublicKey),
/// Asset minted.
Minted { owner: T::AccountId, amount: Balance },
/// Asset burnt in this chain.
Burnt {
owner: T::AccountId,
dest: DestAddress,
amount: Balance,
},
/// Rotated key
RotatedKey { key: PublicKey },
}

/// The RenVM split public key
Expand Down Expand Up @@ -185,7 +189,7 @@ pub mod module {
Pays::Yes,
DispatchClass::Normal,
);
Self::deposit_event(Event::Minted(who, amount));
Self::deposit_event(Event::Minted { owner: who, amount });

Ok(())
}
Expand All @@ -201,7 +205,11 @@ pub mod module {

T::BridgedTokenCurrency::withdraw(&sender, amount)?;
BurnEvents::<T>::insert(this_id, (frame_system::Pallet::<T>::block_number(), &to, amount));
Self::deposit_event(Event::Burnt(sender, to, amount));
Self::deposit_event(Event::Burnt {
owner: sender,
dest: to,
amount,
});

Ok(())
})?;
Expand All @@ -218,7 +226,7 @@ pub mod module {
pub fn rotate_key(origin: OriginFor<T>, new_key: PublicKey, sig: EcdsaSignature) -> DispatchResult {
ensure_none(origin)?;
Self::do_rotate_key(new_key, sig);
Self::deposit_event(Event::RotatedKey(new_key));
Self::deposit_event(Event::RotatedKey { key: new_key });

Ok(())
}
Expand Down
Loading