BOOT
Smart contract scripting library to ease CosmWasm smart contract deployment and testing.
BOOT is inspired by terra-rust-api and uses cosmos-rust for protocol buffer parsing.
boot-plus uses BOOT to provide standard type-safe interfaces to interact with cw-plus contracts.
The use of this software makes it easier to quickly deploy and iterate on your contracts. You should use this function responsibly when working on mainnet or testnet as ALL the code you upload to those networks takes up valuable space. Therefore I strongly suggest using a locally-hosted chain like localterra, local junod, etc. .
How it works
Usually your contracts workspace will have a package that contains the endpoint structs of your contracts. We can easily access these endpoint structs (InstantiateMsg, ExecuteMsg, QueryMsg, ...) by adding that package as a dependency to your BOOT crate.
In order to perform actions on the contract we need to specify these structs so the compiler can type-check our actions. This prevents us from executing a faulty message on a contract and it also handles converting the structs to their json format. The implementation for a CW20 token is shown below. The full file resides here
use cw20_base::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
// Just a type-alias
pub type Cw20<Chain> = CwPlusContract<Chain, ExecuteMsg, InstantiateMsg, QueryMsg, Empty>;
You can now perform any action on the cw20 contract and implement custom actions.
let cw20_token = Cw20::new(chain)?;
let token_info: TokenInfoResponse = cw20_token.query(&Cw20QueryMsg::TokenInfo {}).await?;
I recommend reading the cw20 usage example here
Contributing
Feel free to open issues or PRs!