Skip to content

Commit

Permalink
fix miss named var (#114)
Browse files Browse the repository at this point in the history
* fix miss named var

* Update var name
  • Loading branch information
deuszex authored Feb 8, 2024
1 parent a4c38e4 commit aac3615
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cep18/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ pub fn upgrade(name: &str) {
.map(ContractPackageHash::new)
.unwrap_or_revert_with(Cep18Error::MissingPackageHashForUpgrade);

let previous_contract_version = runtime::get_key(&format!("{CONTRACT_NAME_PREFIX}{name}"))
let previous_contract_hash = runtime::get_key(&format!("{CONTRACT_NAME_PREFIX}{name}"))
.unwrap_or_revert()
.into_hash()
.map(ContractHash::new)
Expand All @@ -378,7 +378,7 @@ pub fn upgrade(name: &str) {
let (contract_hash, contract_version) =
storage::add_contract_version(contract_package_hash, entry_points, NamedKeys::new());

storage::disable_contract_version(contract_package_hash, previous_contract_version)
storage::disable_contract_version(contract_package_hash, previous_contract_hash)
.unwrap_or_revert();
runtime::put_key(
&format!("{CONTRACT_NAME_PREFIX}{name}"),
Expand Down
4 changes: 2 additions & 2 deletions tests/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn should_upgrade_contract_version() {
.into_t()
.unwrap();

let install_request_1 = ExecuteRequestBuilder::standard(
let upgrade_request = ExecuteRequestBuilder::standard(
*DEFAULT_ACCOUNT_ADDR,
CEP18_CONTRACT_WASM,
runtime_args! {
Expand All @@ -38,7 +38,7 @@ fn should_upgrade_contract_version() {
)
.build();

builder.exec(install_request_1).expect_success().commit();
builder.exec(upgrade_request).expect_success().commit();

let version_1: u32 = builder
.query(
Expand Down

0 comments on commit aac3615

Please sign in to comment.