Skip to content

Commit

Permalink
Return Address when deploy not BytesN<32> (#949)
Browse files Browse the repository at this point in the history
### What
Return `Address` from `deploy` not `BytesN<32>`.

### Why
In #947 we replaced usage
of BytesN<32> with Address for contract IDs, but I missed this one case.
  • Loading branch information
leighmcculloch authored May 18, 2023
1 parent 9969179 commit faf489b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions soroban-sdk/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,16 @@ impl DeployerWithCurrentContract {
/// will be used to derive a contract ID for the deployed contract.
///
/// Returns the deployed contract's ID.
pub fn deploy(&self, wasm_hash: &impl IntoVal<Env, BytesN<32>>) -> BytesN<32> {
pub fn deploy(&self, wasm_hash: &impl IntoVal<Env, BytesN<32>>) -> Address {
let env = &self.env;
let id = env
.create_contract_from_contract(
wasm_hash.into_val(env).to_object(),
self.salt.to_object(),
)
.unwrap_infallible();
unsafe { BytesN::<32>::unchecked_new(env.clone(), id) }
let id = unsafe { BytesN::<32>::unchecked_new(env.clone(), id) };
Address::from_contract_id(&id)
}
}

Expand Down

0 comments on commit faf489b

Please sign in to comment.