pub fn initialize_contract<Contract, F, R>(
    initializer: F
) -> <R as InitializerReturnType<Contract>>::Wrapped where
    Contract: ContractRootKey + SpreadAllocate,
    F: FnOnce(&mut Contract) -> R,
    R: InitializerReturnType<Contract>, 
Expand description

Initializes the ink! contract using the given initialization routine.


  • This uses SpreadAllocate trait in order to default initialize the ink! smart contract before calling the initialization routine.
  • This either returns Contract or Result<Contract, E> depending on the return type R of the initializer closure F. If R is () then Contract is returned and if R is any type of Result<(), E> then Result<Contract, E> is returned. Other return types for F than the ones listed above are not allowed.