Cosm-Orc
Rust Cosmwasm smart contract orchestration and gas profiling library.
Store, instantiate, execute, and query Cosmwasm smart contracts against a configured Cosmos based chain.
Optionally, profile gas usage of the smart contract operations.
Potential uses:
- Integration tests
- Deployments / Bootstrapping environments
- Gas profiling
This project is not yet intended to be used for mainnet.
Quick Start
// juno_local.yaml has the `cw20_base` code_id already stored
// If the smart contract has not been stored on the chain yet use: `cosm_orc::store_contracts()`
let mut cosm_orc = new?;
let key = SigningKey ;
cosm_orc.instantiate?;
let res = cosm_orc.query?;
let res: TokenInfoResponse = res.data?;
See here for example usages.
Optimize and Store Contracts
If config.yaml doesn't have the pre-stored contract code ids, you can call optimize_contracts() and store_contracts():
let mut cosm_orc = new?;
let key = SigningKey ;
// Build + optimize all smart contracts in current workspace
// This will save the optimized wasm files in `./artifacts`
cosm_orc.optimize_contracts?;
// NOTE: currently cosm-orc is expecting a wasm filed called: `cw20_base.wasm`
// to be in `/artifacts`, since `cw20_base` is used as the contract name in the instantiate()/query() calls below:
cosm_orc.store_contracts?;
cosm_orc.instantiate?;
let res = cosm_orc.query?;
let res: TokenInfoResponse = res.data?;
Gas Profiling
let mut cosm_orc = new?;
cosm_orc.instantiate?;
let reports = cosm_orc.gas_profiler_report;
Gas Report Github Action
Use the cosm-orc-github-action to view the cosm-orc gas usage as a PR comment.
Github action also supports showing the diff between 2 different reports.
Examples:
Configuration
See ./example-configs directory for example yaml configs.