Trait odra::host::Deployer

source ·
pub trait Deployer: Sized {
    // Required methods
    fn deploy<T>(env: &HostEnv, init_args: T) -> Self
       where T: InitArgs;
    fn try_deploy<T>(env: &HostEnv, init_args: T) -> Result<Self, OdraError>
       where T: InitArgs;
}
Expand description

A type which can deploy a contract.

Before any interaction with the contract, it must be deployed, either on a virtual machine or on a real blockchain.

The Deployer trait provides a simple way to deploy a contract.

Required Methods§

source

fn deploy<T>(env: &HostEnv, init_args: T) -> Self
where T: InitArgs,

Deploys a contract with given init args.

If the init args are provided, the contract is deployed and initialized by calling the constructor. If the init args are not provided, the contract is deployed without initialization.

Returns a host reference to the deployed contract.

source

fn try_deploy<T>(env: &HostEnv, init_args: T) -> Result<Self, OdraError>
where T: InitArgs,

Tries to deploy a contract with given init args.

Similar to deploy, but returns a result instead of panicking.

Object Safety§

This trait is not object safe.

Implementors§