diff --git a/frame/contracts/src/exec.rs b/frame/contracts/src/exec.rs index 235ca63442b45..5733d86b42cac 100644 --- a/frame/contracts/src/exec.rs +++ b/frame/contracts/src/exec.rs @@ -1026,6 +1026,10 @@ where top_frame.contract_info().code_hash = hash; increment_refcount::(hash)?; decrement_refcount::(prev_hash)?; + Contracts::::deposit_event(Event::ContractCodeUpdated { + contract: top_frame.account_id.clone(), + code_hash: hash, + }); Ok(()) } diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index e4a54362c90bc..77c3227179667 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -559,6 +559,14 @@ pub mod pallet { /// A code with the specified hash was removed. CodeRemoved { code_hash: T::Hash }, + + /// Contract code has been updated to one specified with code_hash + ContractCodeUpdated { + /// The contract that has been updated. + contract: T::AccountId, + /// New code hash that was set for the contract + code_hash: T::Hash, + }, } #[pallet::error]