I'm working on an an ink! contract and trying to establish a factory contract to enable indexing for each deployment using a subquery subgraph. For this purpose, we emit an event whenever a successful instantiation takes place. However, during compilation, I encounter the following error within the emit_event function:

type annotations needed
cannot satisfy `<_ as ink::reflect::ContractEventBase>::Type == _`
Type annotations needed
and another `impl` found in the `multisig` crate: `impl<'a> ink::codegen::EmitEvent<multisig::multisig::MultiSig> for ink::EnvAccess<'a, <multisig::multisig::MultiSig as ink::ink_env::ContractEnv>::Env>;`

Here is the entire contract

#![cfg_attr(not(feature = "std"), no_std, no_main)]

mod multisig_factory {

    use ink::prelude::vec::Vec;
    use ink::ToAccountId;
    use multisig::MultiSigRef;

    pub struct NewMultisig {
        multisig_address: AccountId,
        threshold: u8,
        owners_list: Vec<AccountId>,

    #[derive(scale::Encode, scale::Decode)]
    #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
    pub enum Error {
        /// The contract instantiation failed.

    pub struct MultiSigFactory {
        multisig_codehash: Hash,

    impl MultiSigFactory {
        pub fn new(codehash: Hash) -> Result<Self, Error> {
            Ok(Self {
                multisig_codehash: codehash,

        pub fn new_multisig(
            &mut self,
            threshold: u8,
            owners_list: Vec<AccountId>,
            salt: Vec<u8>,
        ) -> Result<(), Error> {
            let multisig_ins = MultiSigRef::new(threshold, owners_list)

            match multisig_ins {
                Ok(multisig) => {
                    let multisig_address = multisig.to_account_id();
                    self.env().emit_event(NewMultisig { // HERE I HAVE THE ERROR
                Err(_) => Err(Error::InstantiationFailed),

Any clue how I can proceed?

  • I successfully build your contract you shared. I replaced MultiSigRef with MultiSigFactoryRef as you didn't share that module, issue might be in multisig mod contract, maybe event names are same, etc. Commented Aug 2, 2023 at 4:41


Your Answer

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