mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
contracts: New contract events + unconfusions (#4685)
* contracts: during execution -> contract trapped during execution This message confused many people so we are improving it to make clear what happened. * contracts: rename Event::Contract -> Event::ContractExecution * contracts: fix tests after ContractExecution renaming * contracts: Add Evicted and Restored events * fix doc comment * wrap to not go over (soft) 100 column line limit * add event deposit for eventual eviction upon pay_rent * contracts: adjust tests for the new events * emit Evicted event immediately and add tombstone flag bool
This commit is contained in:
committed by
Sergei Pepyakin
parent
169a48c0c5
commit
caa6efa5ec
@@ -786,7 +786,12 @@ impl<T: Trait> Module<T> {
|
||||
rent_allowance,
|
||||
delta,
|
||||
} => {
|
||||
let _result = Self::restore_to(donor, dest, code_hash, rent_allowance, delta);
|
||||
let result = Self::restore_to(
|
||||
donor.clone(), dest.clone(), code_hash.clone(), rent_allowance.clone(), delta
|
||||
);
|
||||
Self::deposit_event(
|
||||
RawEvent::Restored(donor, dest, code_hash, rent_allowance, result.is_ok())
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -896,6 +901,25 @@ decl_event! {
|
||||
/// Contract deployed by address at the specified address.
|
||||
Instantiated(AccountId, AccountId),
|
||||
|
||||
/// Contract has been evicted and is now in tombstone state.
|
||||
///
|
||||
/// # 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 initiated.
|
||||
///
|
||||
/// # Params
|
||||
///
|
||||
/// - `donor`: `AccountId`: Account ID of the restoring contract
|
||||
/// - `dest`: `AccountId`: Account ID of the restored contract
|
||||
/// - `code_hash`: `Hash`: Code hash of the restored contract
|
||||
/// - `rent_allowance: `Balance`: Rent allowance of the restored contract
|
||||
/// - `success`: `bool`: True if the restoration was successful
|
||||
Restored(AccountId, AccountId, Hash, Balance, bool),
|
||||
|
||||
/// Code with the specified hash has been stored.
|
||||
CodeStored(Hash),
|
||||
|
||||
@@ -906,8 +930,8 @@ decl_event! {
|
||||
/// successful execution or not.
|
||||
Dispatched(AccountId, bool),
|
||||
|
||||
/// An event from contract of account.
|
||||
Contract(AccountId, Vec<u8>),
|
||||
/// An event deposited upon execution of a contract from the account.
|
||||
ContractExecution(AccountId, Vec<u8>),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user