Skip to main content

Deployer

Trait Deployer 

Source
pub trait Deployer<R>: Sized
where R: OdraContract,
{ // Required methods fn deploy( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, ) -> <R as OdraContract>::HostRef; fn try_deploy( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, ) -> Result<<R as OdraContract>::HostRef, OdraError>; fn deploy_with_cfg( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, cfg: InstallConfig, ) -> <R as OdraContract>::HostRef; fn try_deploy_with_cfg( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, cfg: InstallConfig, ) -> Result<<R as OdraContract>::HostRef, OdraError>; fn try_upgrade( env: &HostEnv, address: Address, init_args: <R as OdraContract>::UpgradeArgs, ) -> Result<<R as OdraContract>::HostRef, OdraError>; fn try_upgrade_with_cfg( env: &HostEnv, address: Address, upgrade_args: <R as OdraContract>::UpgradeArgs, cfg: UpgradeConfig, ) -> Result<<R as OdraContract>::HostRef, OdraError>; }
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( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, ) -> <R as OdraContract>::HostRef

Deploys a contract with given init args.

If the init_args is not NoArgs, the contract is deployed and initialized by calling the constructor. Otherwise no constructor is called.

The default [OdraConfig] is used for deployment.

Returns a host reference to the deployed contract.

Source

fn try_deploy( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, ) -> Result<<R as OdraContract>::HostRef, OdraError>

Tries to deploy a contract with given init args.

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

Source

fn deploy_with_cfg( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, cfg: InstallConfig, ) -> <R as OdraContract>::HostRef

Deploys a contract with given init args and configuration.

Returns a host reference to the deployed contract.

Source

fn try_deploy_with_cfg( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, cfg: InstallConfig, ) -> Result<<R as OdraContract>::HostRef, OdraError>

Tries to deploy a contract with given init args and configuration.

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

Source

fn try_upgrade( env: &HostEnv, address: Address, init_args: <R as OdraContract>::UpgradeArgs, ) -> Result<<R as OdraContract>::HostRef, OdraError>

Tries to upgrade a contract with given init args.

Source

fn try_upgrade_with_cfg( env: &HostEnv, address: Address, upgrade_args: <R as OdraContract>::UpgradeArgs, cfg: UpgradeConfig, ) -> Result<<R as OdraContract>::HostRef, OdraError>

Tries to upgrade a contract with given init args and configuration

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<R> Deployer<R> for R
where R: OdraContract,

Available on non-WebAssembly only.