pub trait ContractProvider {
// Required methods
fn contract_ref<T: OdraContract + 'static>(
&self,
env: &HostEnv,
) -> Result<T::HostRef, ContractError>;
fn all_contracts(&self) -> Vec<(String, Address)>;
fn address_by_name(&self, name: &str) -> Option<Address>;
}Expand description
This trait defines the methods for providing access to deployed contracts.
Required Methods§
Sourcefn contract_ref<T: OdraContract + 'static>(
&self,
env: &HostEnv,
) -> Result<T::HostRef, ContractError>
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.
Sourcefn all_contracts(&self) -> Vec<(String, Address)>
fn all_contracts(&self) -> Vec<(String, Address)>
Returns a list of all deployed contracts with their names and addresses.
Sourcefn address_by_name(&self, name: &str) -> Option<Address>
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", so this trait is not object safe.