mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-10 22:47:22 +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
@@ -14,7 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{BalanceOf, ContractInfo, ContractInfoOf, TombstoneContractInfo, Trait, AliveContractInfo};
|
||||
use crate::{Module, RawEvent, BalanceOf, ContractInfo, ContractInfoOf, TombstoneContractInfo,
|
||||
Trait, AliveContractInfo};
|
||||
use sp_runtime::traits::{Bounded, CheckedDiv, CheckedMul, Saturating, Zero,
|
||||
SaturatedConversion};
|
||||
use frame_support::traits::{Currency, ExistenceRequirement, Get, WithdrawReason, OnUnbalanced};
|
||||
@@ -101,6 +102,7 @@ fn try_evict_or_and_pay_rent<T: Trait>(
|
||||
// The contract cannot afford to leave a tombstone, so remove the contract info altogether.
|
||||
<ContractInfoOf<T>>::remove(account);
|
||||
child::kill_storage(&contract.trie_id, contract.child_trie_unique_id());
|
||||
<Module<T>>::deposit_event(RawEvent::Evicted(account.clone(), false));
|
||||
return (RentOutcome::Evicted, None);
|
||||
}
|
||||
|
||||
@@ -160,6 +162,8 @@ fn try_evict_or_and_pay_rent<T: Trait>(
|
||||
|
||||
child::kill_storage(&contract.trie_id, contract.child_trie_unique_id());
|
||||
|
||||
<Module<T>>::deposit_event(RawEvent::Evicted(account.clone(), true));
|
||||
|
||||
return (RentOutcome::Evicted, Some(tombstone_info));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user