Tooling Overview
Introduction
We have developed a universal smart contract management tool, called multiversx-sc-meta (sc-meta in short).
It is called that, because it provides a layer of meta-programming over the regular smart contract development. It can read and interact with some of the code written by developers.
You can find it on crates.io
To install it, simply call
cargo install multiversx-sc-meta --locked
After that, try calling sc-meta help or sc-meta -h to see the CLI docs.
Ubuntu users have to ensure the existence of the build_essential package installed in their system.
Standalone tool vs. contract tool
The unusual thing about this tool is that it comes in two flavors. One of them is the standalone tool, installed as above. The other is a tool that gets provided specifically for every contract, and which helps with building.
The contract tool lies in the meta folder under each contract. It just contains these 3 lines of code:
fn main() {
multiversx_sc_meta::cli_main::<my_contract_crate::AbiProvider>();
}
... but they are important, because they link the contract tool to the contract code, via the ABI.
The contract tool is required in order to build contracts, because it is the only tool that we have that calls the ABI generator, manages the wasm crate and the multi-contract config, and has the data on how to build the contract.
Therefore, all the functionality that needs the ABI goes into the contract tool, whereas the rest in the standalone tool.
To see the contract meta CLI docs, cd into the /meta crate and call cargo run help or cargo run -- -h.
Contract functionality
Currently the contract functionality is:
abiGenerates the contract ABI and nothing else.buildBuilds contract(s) for deploy on the blockchain.build-dbgBuilds contract(s) with symbols and WAT.twiggyBuilds contract(s) and generate twiggy reports.cleanClean the Rust project and the output folder.updateUpdate the Cargo.lock files in all wasm crates.snippetsGenerates a snippets project, based on the contract ABI.
To learn more about the smart contract ABI and ABI-based individual contract tools, see the CLI reference.
Standalone functionality
The standalone functionality is:
infoGeneral info about the contract an libraries residing in the targeted directory.allCalls the meta crates for all contracts under given path with the given arguments.newCreates a new smart contract from a template.templatesLists the available templates.upgradeUpgrades a contract to the latest version. Multiple contract crates are allowed.local-depsGenerates a report on the local dependencies of contract crates. Will explore indirect dependencies too.
All the standalone tools take an optional --path argument. if not provided, it will be the current directory.