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

Commit

Permalink
Export fn code_hash (#12479)
Browse files Browse the repository at this point in the history
Co-authored-by: parity-processbot <>
  • Loading branch information
kvinwang authored Oct 17, 2022
1 parent 0ee0327 commit 6f453b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,11 @@ where
T::AddressGenerator::generate_address(deploying_address, code_hash, salt)
}

/// Returns the code hash of the contract specified by `account` ID.
pub fn code_hash(account: &AccountIdOf<T>) -> Option<CodeHash<T>> {
Storage::<T>::code_hash(account)
}

/// Store code for benchmarks which does not check nor instrument the code.
#[cfg(feature = "runtime-benchmarks")]
fn store_code_raw(
Expand Down
1 change: 0 additions & 1 deletion frame/contracts/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ where
}

/// Returns the code hash of the contract specified by `account` ID.
#[cfg(test)]
pub fn code_hash(account: &AccountIdOf<T>) -> Option<CodeHash<T>> {
<ContractInfoOf<T>>::get(account).map(|i| i.code_hash)
}
Expand Down

0 comments on commit 6f453b5

Please sign in to comment.