pub struct ScConfig {
pub default_contract_config_name: String,
pub contracts: Vec<ContractVariant>,
pub proxy_configs: Vec<ProxyConfig>,
}
Expand description
An entire project configuration.
It can contain one or several contract variants.
Fields§
§default_contract_config_name: String
§contracts: Vec<ContractVariant>
§proxy_configs: Vec<ProxyConfig>
Implementations§
Source§impl ScConfig
impl ScConfig
Sourcepub fn load_from_config(
config: &ScConfigSerde,
original_abi: &ContractAbi,
) -> Self
pub fn load_from_config( config: &ScConfigSerde, original_abi: &ContractAbi, ) -> Self
Assembles an ContractVariantConfig
from a raw config object that was loaded via Serde.
In most cases the config will be loaded from a .toml file, use load_from_file
for that.
Source§impl ScConfig
impl ScConfig
Sourcepub fn default_config(original_abi: &ContractAbi) -> Self
pub fn default_config(original_abi: &ContractAbi) -> Self
Provides the config for the cases where no multicontract.toml
file is available.
The default configuration contains a single main contract, with all endpoints.
Sourcepub fn load_from_file<P: AsRef<Path>>(
path: P,
original_abi: &ContractAbi,
) -> Option<Self>
pub fn load_from_file<P: AsRef<Path>>( path: P, original_abi: &ContractAbi, ) -> Option<Self>
Loads a contract configuration from file. Will return None
if the file is not found.
Sourcepub fn load_from_files_or_default<I, P>(
paths: I,
original_abi: &ContractAbi,
) -> Self
pub fn load_from_files_or_default<I, P>( paths: I, original_abi: &ContractAbi, ) -> Self
The standard way of loading a multicontract.toml
configuration: read the file if present, use the default config otherwise.
Sourcepub fn load_from_crate_or_default<P>(
contract_crate_path: P,
original_abi: &ContractAbi,
) -> Self
pub fn load_from_crate_or_default<P>( contract_crate_path: P, original_abi: &ContractAbi, ) -> Self
The standard way of loading a multicontract.toml
configuration: read the file if present, use the default config otherwise.
Source§impl ScConfig
impl ScConfig
pub fn main_contract(&self) -> &ContractVariant
pub fn main_contract_mut(&mut self) -> &mut ContractVariant
pub fn secondary_contracts(&self) -> impl Iterator<Item = &ContractVariant>
pub fn secondary_contracts_mut( &mut self, ) -> impl Iterator<Item = &mut ContractVariant>
pub fn get_contract_by_id( &self, contract_id: String, ) -> Option<&ContractVariant>
pub fn get_contract_by_name( &self, contract_name: String, ) -> Option<&ContractVariant>
Sourcepub fn find_contract(&self, contract_name: &str) -> &ContractVariant
pub fn find_contract(&self, contract_name: &str) -> &ContractVariant
Yields the contract with the given public name.