Based on this example: https://docs.rs/ink/latest/ink/struct.EnvAccess.html#method.instantiate_contract

Im doing something similar:

        pub fn new_multisig(&mut self, threshold: u8, owners_list: Vec<AccountId>, salt: Vec<u8>) {
            let multisig = build_create::<MultiSigRef>()

            self.env().emit_event(NewMultisig {
                multisig_address: multisig, //Here i need to get the address of the new contract
                threshold: threshold,
                owners_list: owners_list,

But i need to obtain the address of the instantiated contract. How can i do it?

1 Answer 1


You can use to_account_id method to obtain address of instantiated smart contract.

let contract_address = multisig.to_account_id();

Taking into account Luca's comment, the workable sample would be

use ink::ToAccountId;

let contract_address = multisig.to_account_id();
  • Hey! That worked, but i also needed to import the trait: use ink::ToAccountId;
    – Luca Auet
    Aug 1 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.