Type Definition concordium_std::InitResult[][src]

type InitResult<S> = Result<S, Reject>;

The expected return type of the init method of the smart contract, parametrized by the state type of the smart contract.

Optionally, to define a custom type for error instead of using Reject, allowing the track the reason for rejection, but only in unit tests.

See also the documentation for bail! for how to use custom error types.

Example

Defining a custom error type

enum MyCustomError {
    SomeError
}

#[init(contract = "mycontract")]
fn contract_init<R: HasReceiveContext, L: HasLogger, A: HasActions>(
    ctx: &R,
    receive_amount: Amount,
    logger: &mut L,
) -> Result<State, MyCustomError> { ... }