Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

More app-friendly event description #6684

Merged
merged 4 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/node-template/pallets/template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ decl_event!(
/// Just a dummy event.
/// Event `Something` is declared with a parameter of the type `u32` and `AccountId`
/// To emit this event, we call the deposit function, from our runtime functions
/// [something, who]
SomethingStored(u32, AccountId),
}
);
Expand Down
6 changes: 3 additions & 3 deletions frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ decl_event! {
<T as Trait>::Balance,
<T as Trait>::AssetId,
{
/// Some assets were issued.
/// Some assets were issued. [asset_id, owner, total_supply]
Issued(AssetId, AccountId, Balance),
/// Some assets were transferred.
/// Some assets were transferred. [asset_id, from, to, amount]
Transferred(AssetId, AccountId, AccountId, Balance),
/// Some assets were destroyed.
/// Some assets were destroyed. [asset_id, owner, balance]
Destroyed(AssetId, AccountId, Balance),
}
}
Expand Down
7 changes: 4 additions & 3 deletions frame/atomic-swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ decl_event!(
AccountId = <T as system::Trait>::AccountId,
PendingSwap = PendingSwap<T>,
{
/// Swap created.
/// Swap created. [account, proof, swap]
NewSwap(AccountId, HashedProof, PendingSwap),
/// Swap claimed. The last parameter indicates whether the execution succeeds.
/// Swap claimed. The last parameter indicates whether the execution succeeds.
/// [account, proof, success]
SwapClaimed(AccountId, HashedProof, bool),
/// Swap cancelled.
/// Swap cancelled. [account, proof]
SwapCancelled(AccountId, HashedProof),
}
);
Expand Down
15 changes: 8 additions & 7 deletions frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,23 +243,24 @@ decl_event!(
<T as frame_system::Trait>::AccountId,
<T as Trait<I>>::Balance
{
/// An account was created with some free balance.
/// An account was created with some free balance. [account, free_balance]
Endowed(AccountId, Balance),
/// An account was removed whose balance was non-zero but below ExistentialDeposit,
/// resulting in an outright loss.
/// resulting in an outright loss. [account, balance]
DustLost(AccountId, Balance),
/// Transfer succeeded (from, to, value).
/// Transfer succeeded. [from, to, value]
Transfer(AccountId, AccountId, Balance),
/// A balance was set by root (who, free, reserved).
/// A balance was set by root. [who, free, reserved]
BalanceSet(AccountId, Balance, Balance),
/// Some amount was deposited (e.g. for transaction fees).
/// Some amount was deposited (e.g. for transaction fees). [who, deposit]
Deposit(AccountId, Balance),
/// Some balance was reserved (moved from free to reserved).
/// Some balance was reserved (moved from free to reserved). [who, value]
Reserved(AccountId, Balance),
/// Some balance was unreserved (moved from reserved to free).
/// Some balance was unreserved (moved from reserved to free). [who, value]
Unreserved(AccountId, Balance),
/// Some balance was moved from the reserve of the first account to the second account.
/// Final argument indicates the destination balance type.
/// [from, to, balance, destination_status]
ReserveRepatriated(AccountId, AccountId, Balance, Status),
}
);
Expand Down
7 changes: 7 additions & 0 deletions frame/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,26 @@ decl_event! {
{
/// A motion (given hash) has been proposed (by given account) with a threshold (given
/// `MemberCount`).
/// [account, proposal_index, proposal_hash, threshold]
Proposed(AccountId, ProposalIndex, Hash, MemberCount),
/// A motion (given hash) has been voted on by given account, leaving
/// a tally (yes votes and no votes given respectively as `MemberCount`).
/// [account, proposal_hash, voted, yes, no]
Voted(AccountId, Hash, bool, MemberCount, MemberCount),
/// A motion was approved by the required threshold.
/// [proposal_hash]
Approved(Hash),
/// A motion was not approved by the required threshold.
/// [proposal_hash]
Disapproved(Hash),
/// A motion was executed; result will be `Ok` if it returned without error.
/// [proposal_hash, result]
Executed(Hash, DispatchResult),
/// A single member did some action; result will be `Ok` if it returned without error.
/// [proposal_hash, result]
MemberExecuted(Hash, DispatchResult),
/// A proposal was closed because its threshold was reached or after its duration was up.
/// [proposal_hash, yes, no]
Closed(Hash, MemberCount, MemberCount),
}
}
Expand Down
12 changes: 8 additions & 4 deletions frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,19 +660,21 @@ decl_event! {
<T as frame_system::Trait>::AccountId,
<T as frame_system::Trait>::Hash
{
/// Contract deployed by address at the specified address.
/// Contract deployed by address at the specified address. [owner, contract]
Instantiated(AccountId, AccountId),

/// Contract has been evicted and is now in tombstone state.
///
/// [contract, tombstone]
///
/// # Params
///
/// - `contract`: `AccountId`: The account ID of the evicted contract.
/// - `tombstone`: `bool`: True if the evicted contract left behind a tombstone.
Evicted(AccountId, bool),

/// Restoration for a contract has been successful.
///
/// [donor, dest, code_hash, rent_allowance]
///
/// # Params
///
/// - `donor`: `AccountId`: Account ID of the restoring contract
Expand All @@ -682,12 +684,14 @@ decl_event! {
Restored(AccountId, AccountId, Hash, Balance),

/// Code with the specified hash has been stored.
/// [code_hash]
CodeStored(Hash),

/// Triggered when the current schedule is updated.
/// Triggered when the current [schedule] is updated.
ScheduleUpdated(u32),

/// An event deposited upon execution of a contract from the account.
/// [account, data]
ContractExecution(AccountId, Vec<u8>),
}
}
Expand Down
34 changes: 18 additions & 16 deletions frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,39 +467,41 @@ decl_event! {
<T as frame_system::Trait>::Hash,
<T as frame_system::Trait>::BlockNumber,
{
/// A motion has been proposed by a public account.
/// A motion has been proposed by a public account. [proposal_index, deposit]
Proposed(PropIndex, Balance),
/// A public proposal has been tabled for referendum vote.
/// A public proposal has been tabled for referendum vote. [proposal_index, deposit, depositors]
Tabled(PropIndex, Balance, Vec<AccountId>),
/// An external proposal has been tabled.
ExternalTabled,
/// A referendum has begun.
/// A referendum has begun. [ref_index, threshold]
Started(ReferendumIndex, VoteThreshold),
/// A proposal has been approved by referendum.
/// A proposal has been approved by referendum. [ref_index]
Passed(ReferendumIndex),
/// A proposal has been rejected by referendum.
/// A proposal has been rejected by referendum. [ref_index]
NotPassed(ReferendumIndex),
/// A referendum has been cancelled.
/// A referendum has been cancelled. [ref_index]
Cancelled(ReferendumIndex),
/// A proposal has been enacted.
/// A proposal has been enacted. [ref_index, is_ok]
Executed(ReferendumIndex, bool),
/// An account has delegated their vote to another account.
/// An account has delegated their vote to another account. [who, target]
Delegated(AccountId, AccountId),
/// An account has cancelled a previous delegation operation.
/// An [account] has cancelled a previous delegation operation.
Undelegated(AccountId),
/// An external proposal has been vetoed.
/// An external proposal has been vetoed. [who, proposal_hash, until]
Vetoed(AccountId, Hash, BlockNumber),
/// A proposal's preimage was noted, and the deposit taken.
/// A proposal's preimage was noted, and the deposit taken. [proposal_hash, who, deposit]
PreimageNoted(Hash, AccountId, Balance),
/// A proposal preimage was removed and used (the deposit was returned).
/// A proposal preimage was removed and used (the deposit was returned).
/// [proposal_hash, provider, deposit]
PreimageUsed(Hash, AccountId, Balance),
/// A proposal could not be executed because its preimage was invalid.
/// A proposal could not be executed because its preimage was invalid. [proposal_hash, ref_index]
PreimageInvalid(Hash, ReferendumIndex),
/// A proposal could not be executed because its preimage was missing.
/// A proposal could not be executed because its preimage was missing. [proposal_hash, ref_index]
PreimageMissing(Hash, ReferendumIndex),
/// A registered preimage was removed and the deposit collected by the reaper (last item).
/// A registered preimage was removed and the deposit collected by the reaper.
/// [proposal_hash, provider, deposit, reaper]
PreimageReaped(Hash, AccountId, Balance, AccountId),
/// An account has been unlocked successfully.
/// An [account] has been unlocked successfully.
Unlocked(AccountId),
}
}
Expand Down
10 changes: 5 additions & 5 deletions frame/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,21 +709,21 @@ decl_event!(
Balance = BalanceOf<T>,
<T as frame_system::Trait>::AccountId,
{
/// A new term with new members. This indicates that enough candidates existed to run the
/// A new term with [new_members]. This indicates that enough candidates existed to run the
/// election, not that enough have has been elected. The inner value must be examined for
/// this purpose. A `NewTerm([])` indicates that some candidates got their bond slashed and
/// none were elected, whilst `EmptyTerm` means that no candidates existed to begin with.
NewTerm(Vec<(AccountId, Balance)>),
/// No (or not enough) candidates existed for this round. This is different from
/// `NewTerm([])`. See the description of `NewTerm`.
EmptyTerm,
/// A member has been removed. This should always be followed by either `NewTerm` ot
/// A [member] has been removed. This should always be followed by either `NewTerm` ot
/// `EmptyTerm`.
MemberKicked(AccountId),
/// A member has renounced their candidacy.
/// A [member] has renounced their candidacy.
MemberRenounced(AccountId),
/// A voter (first element) was reported (byt the second element) with the the report being
/// successful or not (third element).
/// A voter was reported with the the report being successful or not.
/// [voter, reporter, success]
VoterReported(AccountId, AccountId, bool),
}
);
Expand Down
9 changes: 5 additions & 4 deletions frame/elections/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,14 @@ decl_module! {

decl_event!(
pub enum Event<T> where <T as frame_system::Trait>::AccountId {
/// reaped voter, reaper
/// Reaped [voter, reaper].
VoterReaped(AccountId, AccountId),
/// slashed reaper
/// Slashed [reaper].
BadReaperSlashed(AccountId),
/// A tally (for approval votes of seat(s)) has started.
/// A tally (for approval votes of [seats]) has started.
TallyStarted(u32),
/// A tally (for approval votes of seat(s)) has ended (with one or more new members).
/// A tally (for approval votes of seat(s)) has ended (with one or more new members).
/// [incoming, outgoing]
TallyFinalized(Vec<AccountId>, Vec<AccountId>),
}
);
Expand Down
12 changes: 6 additions & 6 deletions frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,17 @@ decl_event! {
{
/// Ethereum events from contracts.
Log(Log),
/// A contract has been created at given address.
/// A contract has been created at given [address].
Created(H160),
/// A contract was attempted to be created, but the execution failed.
/// A [contract] was attempted to be created, but the execution failed.
CreatedFailed(H160),
/// A contract has been executed successfully with states applied.
/// A [contract] has been executed successfully with states applied.
Executed(H160),
/// A contract has been executed with errors. States are reverted with only gas fees applied.
/// A [contract] has been executed with errors. States are reverted with only gas fees applied.
ExecutedFailed(H160),
/// A deposit has been made at a given address.
/// A deposit has been made at a given address. [sender, address, value]
BalanceDeposit(AccountId, H160, U256),
/// A withdrawal has been made from a given address.
/// A withdrawal has been made from a given address. [sender, address, value]
BalanceWithdraw(AccountId, H160, U256),
}
}
Expand Down
3 changes: 2 additions & 1 deletion frame/example-offchain-worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ decl_storage! {
decl_event!(
/// Events generated by the module.
pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
/// Event generated when new price is accepted to contribute to the average.
/// Event generated when new price is accepted to contribute to the average.
/// [price, who]
NewPrice(u32, AccountId),
}
);
Expand Down
10 changes: 5 additions & 5 deletions frame/generic-asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,15 @@ decl_event!(
<T as Trait>::AssetId,
AssetOptions = AssetOptions<<T as Trait>::Balance, <T as frame_system::Trait>::AccountId>
{
/// Asset created (asset_id, creator, asset_options).
/// Asset created. [asset_id, creator, asset_options]
Created(AssetId, AccountId, AssetOptions),
/// Asset transfer succeeded (asset_id, from, to, amount).
/// Asset transfer succeeded. [asset_id, from, to, amount]
Transferred(AssetId, AccountId, AccountId, Balance),
/// Asset permission updated (asset_id, new_permissions).
/// Asset permission updated. [asset_id, new_permissions]
PermissionUpdated(AssetId, PermissionLatest<AccountId>),
/// New asset minted (asset_id, account, amount).
/// New asset minted. [asset_id, account, amount]
Minted(AssetId, AccountId, Balance),
/// Asset burned (asset_id, account, amount).
/// Asset burned. [asset_id, account, amount]
Burned(AssetId, AccountId, Balance),
}
);
Expand Down
2 changes: 1 addition & 1 deletion frame/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub enum StoredState<N> {

decl_event! {
pub enum Event {
/// New authority set has been applied.
/// New authority set has been applied. [authority_set]
NewAuthorities(AuthorityList),
/// Current authority set has been paused.
Paused,
Expand Down
23 changes: 12 additions & 11 deletions frame/identity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,26 +462,27 @@ decl_storage! {

decl_event!(
pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId, Balance = BalanceOf<T> {
/// A name was set or reset (which will remove all judgements).
/// A name was set or reset (which will remove all judgements). [who]
IdentitySet(AccountId),
/// A name was cleared, and the given balance returned.
/// A name was cleared, and the given balance returned. [who, deposit]
IdentityCleared(AccountId, Balance),
/// A name was removed and the given balance slashed.
/// A name was removed and the given balance slashed. [who, deposit]
IdentityKilled(AccountId, Balance),
/// A judgement was asked from a registrar.
/// A judgement was asked from a registrar. [who, registrar_index]
JudgementRequested(AccountId, RegistrarIndex),
/// A judgement request was retracted.
/// A judgement request was retracted. [who, registrar_index]
JudgementUnrequested(AccountId, RegistrarIndex),
/// A judgement was given by a registrar.
/// A judgement was given by a registrar. [target, registrar_index]
JudgementGiven(AccountId, RegistrarIndex),
/// A registrar was added.
/// A registrar was added. [registrar_index]
RegistrarAdded(RegistrarIndex),
/// A sub-identity (first) was added to an identity (second) and the deposit paid.
/// A sub-identity was added to an identity and the deposit paid. [sub, main, deposit]
SubIdentityAdded(AccountId, AccountId, Balance),
/// A sub-identity (first) was removed from an identity (second) and the deposit freed.
/// A sub-identity was removed from an identity and the deposit freed.
/// [sub, main, deposit]
SubIdentityRemoved(AccountId, AccountId, Balance),
/// A sub-identity (first arg) was cleared, and the given deposit repatriated from the
/// main identity account (second arg) to the sub-identity account.
/// A sub-identity was cleared, and the given deposit repatriated from the
/// main identity account to the sub-identity account. [sub, main, deposit]
SubIdentityRevoked(AccountId, AccountId, Balance),
}
);
Expand Down
4 changes: 2 additions & 2 deletions frame/im-online/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ decl_event!(
<T as Trait>::AuthorityId,
IdentificationTuple = IdentificationTuple<T>,
{
/// A new heartbeat was received from `AuthorityId`
/// A new heartbeat was received from `AuthorityId` [authority_id]
HeartbeatReceived(AuthorityId),
/// At the end of the session, no offence was committed.
AllGood,
/// At the end of the session, at least one validator was found to be offline.
/// At the end of the session, at least one validator was found to be [offline].
SomeOffline(Vec<IdentificationTuple>),
}
);
Expand Down
6 changes: 3 additions & 3 deletions frame/indices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ decl_event!(
<T as frame_system::Trait>::AccountId,
<T as Trait>::AccountIndex
{
/// A account index was assigned.
/// A account index was assigned. [who, index]
IndexAssigned(AccountId, AccountIndex),
/// A account index has been freed up (unassigned).
/// A account index has been freed up (unassigned). [index]
IndexFreed(AccountIndex),
/// A account index has been frozen to its current account ID.
/// A account index has been frozen to its current account ID. [who, index]
IndexFrozen(AccountIndex, AccountId),
}
);
Expand Down
12 changes: 4 additions & 8 deletions frame/multisig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,13 @@ decl_event! {
BlockNumber = <T as system::Trait>::BlockNumber,
CallHash = [u8; 32]
{
/// A new multisig operation has begun. First param is the account that is approving,
/// second is the multisig account, third is hash of the call.
/// A new multisig operation has begun. [approving, multisig, call_hash]
NewMultisig(AccountId, AccountId, CallHash),
/// A multisig operation has been approved by someone. First param is the account that is
/// approving, third is the multisig account, fourth is hash of the call.
/// A multisig operation has been approved by someone. [approving, timepoint, multisig, call_hash]
MultisigApproval(AccountId, Timepoint<BlockNumber>, AccountId, CallHash),
/// A multisig operation has been executed. First param is the account that is
/// approving, third is the multisig account, fourth is hash of the call to be executed.
/// A multisig operation has been executed. [approving, timepoint, multisig, call_hash]
MultisigExecuted(AccountId, Timepoint<BlockNumber>, AccountId, CallHash, DispatchResult),
/// A multisig operation has been cancelled. First param is the account that is
/// cancelling, third is the multisig account, fourth is hash of the call.
/// A multisig operation has been cancelled. [cancelling, timepoint, multisig, call_hash]
MultisigCancelled(AccountId, Timepoint<BlockNumber>, AccountId, CallHash),
}
}
Expand Down
Loading