pub trait Deployer<R: OdraContract>: Sized {
// Required methods
fn deploy(env: &HostEnv, init_args: R::InitArgs) -> R::HostRef;
fn try_deploy(
env: &HostEnv,
init_args: R::InitArgs,
) -> OdraResult<R::HostRef>;
fn deploy_with_cfg(
env: &HostEnv,
init_args: R::InitArgs,
cfg: InstallConfig,
) -> R::HostRef;
fn try_deploy_with_cfg(
env: &HostEnv,
init_args: R::InitArgs,
cfg: InstallConfig,
) -> OdraResult<R::HostRef>;
fn try_upgrade(
env: &HostEnv,
address: Address,
init_args: R::UpgradeArgs,
) -> OdraResult<R::HostRef>;
fn try_upgrade_with_cfg(
env: &HostEnv,
address: Address,
upgrade_args: R::UpgradeArgs,
cfg: UpgradeConfig,
) -> OdraResult<R::HostRef>;
}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§
Sourcefn deploy(env: &HostEnv, init_args: R::InitArgs) -> R::HostRef
fn deploy(env: &HostEnv, init_args: R::InitArgs) -> R::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.
Sourcefn try_deploy(env: &HostEnv, init_args: R::InitArgs) -> OdraResult<R::HostRef>
fn try_deploy(env: &HostEnv, init_args: R::InitArgs) -> OdraResult<R::HostRef>
Tries to deploy a contract with given init args.
Similar to deploy, but returns a result instead of panicking.
Sourcefn deploy_with_cfg(
env: &HostEnv,
init_args: R::InitArgs,
cfg: InstallConfig,
) -> R::HostRef
fn deploy_with_cfg( env: &HostEnv, init_args: R::InitArgs, cfg: InstallConfig, ) -> R::HostRef
Deploys a contract with given init args and configuration.
Returns a host reference to the deployed contract.
Sourcefn try_deploy_with_cfg(
env: &HostEnv,
init_args: R::InitArgs,
cfg: InstallConfig,
) -> OdraResult<R::HostRef>
fn try_deploy_with_cfg( env: &HostEnv, init_args: R::InitArgs, cfg: InstallConfig, ) -> OdraResult<R::HostRef>
Tries to deploy a contract with given init args and configuration.
Similar to deploy_with_cfg, but returns a result instead of panicking.
Sourcefn try_upgrade(
env: &HostEnv,
address: Address,
init_args: R::UpgradeArgs,
) -> OdraResult<R::HostRef>
fn try_upgrade( env: &HostEnv, address: Address, init_args: R::UpgradeArgs, ) -> OdraResult<R::HostRef>
Tries to upgrade a contract with given init args.
Sourcefn try_upgrade_with_cfg(
env: &HostEnv,
address: Address,
upgrade_args: R::UpgradeArgs,
cfg: UpgradeConfig,
) -> OdraResult<R::HostRef>
fn try_upgrade_with_cfg( env: &HostEnv, address: Address, upgrade_args: R::UpgradeArgs, cfg: UpgradeConfig, ) -> OdraResult<R::HostRef>
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".