[][src]Type Definition concordium_std::ReceiveResult

type ReceiveResult<A> = Result<A, Reject>;

The expected return type of the receive method of a 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
}

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