Skip to main content

ContractProvider

Trait ContractProvider 

Source
pub trait ContractProvider {
    // Required methods
    fn contract_ref<T: OdraContract + 'static>(
        &self,
        env: &HostEnv,
    ) -> Result<T::HostRef, ContractError>;
    fn contract_ref_named<T: OdraContract + 'static>(
        &self,
        env: &HostEnv,
        name: Option<String>,
    ) -> Result<T::HostRef, ContractError>;
    fn all_contracts(&self) -> Vec<DeployedContract>;
    fn address_by_name(&self, name: &str) -> Option<Address>;
}
Expand description

This trait defines the methods for providing access to deployed contracts.

Required Methods§

Source

fn contract_ref<T: OdraContract + 'static>( &self, env: &HostEnv, ) -> Result<T::HostRef, ContractError>

Gets a reference to the contract.

Returns a reference to the contract if it is found, otherwise returns an error.

Source

fn contract_ref_named<T: OdraContract + 'static>( &self, env: &HostEnv, name: Option<String>, ) -> Result<T::HostRef, ContractError>

Gets a reference to the named contract.

Returns a reference to the contract if it is found, otherwise returns an error.

Source

fn all_contracts(&self) -> Vec<DeployedContract>

Returns a list of all deployed contracts with their names and addresses.

Source

fn address_by_name(&self, name: &str) -> Option<Address>

Returns the contract address.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§