Trait oasis_contract_sdk::contract::Contract[][src]

pub trait Contract {
    type Request: Decode;
    type Response: Encode;
    type Error: Error;
    fn call<C: Context>(
        ctx: &mut C,
        request: Self::Request
    ) -> Result<Self::Response, Self::Error>;
fn query<C: Context>(
        _ctx: &mut C,
        _request: Self::Request
    ) -> Result<Self::Response, Self::Error>; fn instantiate<C: Context>(
        _ctx: &mut C,
        _request: Self::Request
    ) -> Result<(), Self::Error> { ... }
fn handle_reply<C: Context>(
        _ctx: &mut C,
        _reply: Reply
    ) -> Result<Option<Self::Response>, Self::Error> { ... }
fn pre_upgrade<C: Context>(
        _ctx: &mut C,
        _request: Self::Request
    ) -> Result<(), Self::Error> { ... }
fn post_upgrade<C: Context>(
        _ctx: &mut C,
        _request: Self::Request
    ) -> Result<(), Self::Error> { ... } }
Expand description

Trait that needs to be implemented by contract implementations.

Associated Types

Type of all requests.

Type of all responses.

Type of all errors.

Required methods

Call the contract.

Query the contract.

Provided methods

Instantiate the contract.

Handle replies from sent messages.

Perform any pre-upgrade tasks. This method is called on the old contract code.

If this method reports an error the upgrade will be aborted.

Perform any post-upgrade tasks. This method is called on the new contract code.

If this method reports an error the upgrade will be aborted.

Implementors