mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-09 11:47:23 +00:00
srml-contracts: Refactor away some duplication in runtime functions. (#3257)
* srml-contracts: Storage access micro-optimization. * srml-contracts: Refactor runtime functions to reduce duplication. * Bump node runtime impl version.
This commit is contained in:
@@ -528,10 +528,10 @@ decl_module! {
|
||||
code: Vec<u8>
|
||||
) -> Result {
|
||||
let origin = ensure_signed(origin)?;
|
||||
let schedule = <Module<T>>::current_schedule();
|
||||
|
||||
let (mut gas_meter, imbalance) = gas::buy_gas::<T>(&origin, gas_limit)?;
|
||||
|
||||
let schedule = <Module<T>>::current_schedule();
|
||||
let result = wasm::save_code::<T>(code, &mut gas_meter, &schedule);
|
||||
if let Ok(code_hash) = result {
|
||||
Self::deposit_event(RawEvent::CodeStored(code_hash));
|
||||
@@ -812,10 +812,9 @@ decl_storage! {
|
||||
|
||||
impl<T: Trait> OnFreeBalanceZero<T::AccountId> for Module<T> {
|
||||
fn on_free_balance_zero(who: &T::AccountId) {
|
||||
if let Some(ContractInfo::Alive(info)) = <ContractInfoOf<T>>::get(who) {
|
||||
if let Some(ContractInfo::Alive(info)) = <ContractInfoOf<T>>::take(who) {
|
||||
child::kill_storage(&info.trie_id);
|
||||
}
|
||||
<ContractInfoOf<T>>::remove(who);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user