CosmWasm contracts for the AXONE network.
Old code has been archived, and a new foundation is on its way.
Looking for the previous implementation?
๐ Check the last release.
This repository hosts Smart Contracts that are deployed on the AXONE network. But they are compatible with any Cosmos blockchains that uses the CosmWasm framework.
The maturity of each contract is indicated by the following emojis.
This stage represents the initial spark or idea that leads to the development of the Smart Contract.
The Smart Contract is still in its infancy, with basic functionalities just being implemented. It is still under development, and its evolution may lead to breaking changes. It is not recommended for production use.
The Smart Contract has undergone a number of tests and improvements, and presents a coherent functional package, but may still lack some advanced features or optimizations. It can be used in production in testnets.
The Smart Contract is fully developed and tested. It's considered safe for production use, offering robust features and optimized performance.
The project is structured around a set of Rust workspaces, each defining a Smart Contract.
.
โโโ contracts
โ โโโ <contract>
โ โโโ Cargo.toml
โ โโโ examples
โ โโโ schema
โ โโโ src
โโโ packages
โ โโโ <package>
โ โโโ Cargo.toml
โ โโโ examples
โ โโโ src
โโโโ Cargo.toml
Be sure you have the following tools installed:
- Rust v1.81 or higher
- cargo-make v0.36.3 or higher
- Docker
- jq v1.6 or higher
- npx v8.19.2 or higher
And the following common GNU Core utilities:
For deployment to networks (testnet/mainnet), copy the example environment file and configure your credentials:
cp .env.example .envThen edit .env and add your deployment wallet mnemonics:
# For testnet deployments
TEST_MNEMONIC="your testnet wallet mnemonic here"
# For mainnet deployments (โ ๏ธ keep this private!)
MAIN_MNEMONIC="your mainnet wallet mnemonic here"For local development, the default LOCAL_MNEMONIC in .env.example is safe to use.
The project uses cargo-make to manage common development tasks. Here are the main tasks available:
Build
----------
build - No Description.
release-wasm - Build optimized wasm using CosmWasm optimizer and provide checksums
schema - Generate JSON schemas for all contracts.
wasm - No Description.
Chain Management
----------
chain - Run the axoned CLI using the chain's home directory under a Docker container.
chain-add-keys - Add a set of predefined keys (recovered from the seed phrases) to the chain.
chain-init-folder - Initialize deploy folder to make sure scripts have the right permission (needed for linux)
chain-initialize - Initialize the chain with a validator's key and a set of predefined keys. โ ๏ธ The home directory is cleaned before.
chain-logs - Show the chain's container logs.
chain-start - Run the full node axoned application using the chain's home directory under a Docker container.
chain-stop - Stop the chain's container.
Cleanup
----------
clean - Clean all artifacts (cargo, docs, and chain).
clean-cargo - Clean cargo build artifacts.
clean-chain - Clean the chain data (โ ๏ธ definitively).
clean-docs - Clean documentation folder.
Code Quality
----------
format - Format all files (Rust and TOML).
format-rust - Format rust sources files. (rustfmt provided by rust-toolchain.toml)
format-toml - Format toml file
lint - Check all linting (Rust, Cargo, and TOML).
lint-cargo - Check all Cargo linting (toml files and dependencies).
lint-cargo-deps - Check for unused dependencies.
lint-cargo-toml - Check lint of all Cargo.toml files.
lint-cargo-toml-file - Check lint of the given toml file
lint-rust - Check all Rust linting (formatting and clippy).
lint-rust-clippy - Check lint of all sources files (clippy via rust-toolchain.toml).
lint-rust-format - Check formatting and derives order (rustfmt via rust-toolchain.toml).
lint-toml - Check lint of all toml files.
Contract Inspection
----------
contract-inspect - Inspect a specific contract deployed to the chain.
contract-list - List all the contracts deployed to the chain.
Contract Interaction
----------
contract-execute - Execute a command on a specific contract. The contract must be already deployed and instantiated.
contract-query - Query a specific contract. The contract must be already deployed and instantiated.
Deployment
----------
deploy-abstract - Deploy Abstract infrastructure to specified networks. Usage: cargo make deploy-abstract <network-ids...>
deploy-contract - Publish a contract to Abstract on specified networks. Usage: cargo make deploy-contract <contract-name> <network-ids...>
deploy-install - Install a module on an Abstract Account. Usage: cargo make deploy-install <contract-name> <network-ids...>
deploy-script - Run a contract deployment script. Usage: cargo make deploy-script <script> <package> <network-ids...>
Development Tools
----------
install-cargo-binstall - Install cargo-binstall if not already available
install-cargo-hack - No Description.
install-cargo-machete - No Description.
install-cargo-sort-derives - No Description.
install-cargo-toml-lint - No Description.
install-cargo-workspaces - No Description.
install-cosmwasm-check - No Description.
install-cranky - No Description.
install-dev-tools - Install all required development tools.
install-llvm-cov - No Description.
install-taplo-cli - No Description.
Documentation
----------
docs - Generate documentation
readme - Update README with help output
Help
----------
help - Display available tasks [aliases: default]
Publishing
----------
publish-crates - Publish all crates to the registry. Requires CARGO_REGISTRY_TOKEN to be set.
Testing
----------
test - Run all tests.
test-coverage - Run tests with coverage reporting.
test-unit - Run all unit tests.
Verification
----------
check - Check all requirements (prerequisites and contracts).
check-awk - Check awk is installed
check-contracts - Check WASM contracts validity.
check-jq - Check jq is installed (version 1.7 or higher, but below 2.0)
check-npx - Check npx is installed
check-perl - Check perl is installed
check-prerequisites - Check all the prerequisites are installed.
To compile the Smart Contracts to Wasm, just invoke the wasm goal of the makefile:
cargo make wasmThis will install the rust Wasm toolchain, if not already done, and start the process for compiling the Smart Contracts to Wasm.
The Smart Contracts are under unit testing. The tests can be launched with the following invocation:
cargo make test-coverageThe project comes with a set of convenient tasks to manage the Smart Contracts and the blockchain.
To initialize the chain, just run:
cargo make chain-initializeThis will initialize the chain's home directory and create a validator's key and a set of predefined keys (recovered from the seed phrases).
To start the chain, just run:
cargo make chain-startNote: the default Docker image used by the tasks points to the latest released axoned version configured in Makefile.toml.
To temporarily run a different axoned image (for example to test a newer release), set the variable when invoking cargo make:
# override just for this run
cargo make --env DOCKER_IMAGE_AXONEPROTOCOL_AXONED=axoneprotocol/axoned:13.1.0 chain-startThis will start the chain's container and run the full node axoned binary inside that image.
Run this to follow the chain container logs in real time:
cargo make chain-logsThe Smart Contracts in this repository are designed to work with the Abstract framework, which provides a modular application layer for Cosmos chains. The deployment process involves three main steps:
Prerequisites: Make sure you've configured your .env file with the appropriate mnemonics for your target network (see Environment Setup).
First, deploy the Abstract framework infrastructure (account factory, module factory, version control, etc.) to your target network:
cargo make deploy-abstract localThis command deploys the entire Abstract infrastructure to the specified network. You only need to do this once per network.
Supported networks: local, testnet, mainnet, axone-localnet, axone-dentrite-1, axone-1.
Once the infrastructure is deployed, publish your smart contracts to Abstract's on-chain registry:
cargo make deploy-contract axone-gov localThis uploads your contract's WASM binary and registers it with Abstract's version control system. The contract becomes available for installation but is not yet instantiated.
You can publish to multiple networks at once:
cargo make deploy-contract axone-gov local testnetFinally, install and instantiate your contract on an Abstract Account (which acts as a modular smart contract wallet):
cargo make deploy-install axone-gov localThis creates an Abstract Account (if needed) and installs your contract as a module on that account. The contract is now fully deployed and operational.
For local development, you can chain these commands together:
cargo make chain-start && \
cargo make deploy-abstract local && \
cargo make deploy-contract axone-gov local && \
cargo make deploy-install axone-gov localNote: Contracts must be compiled first. If WASM files are not found, the deploy-contract task will automatically build them. See the Build section for more details.
Now, you can interact with the deployed Smart Contracts and test them out.
You can freely interact with the local chain by executing the following CLI command. This will execute the axoned
binary
inside a Docker container with the --home argument pointing to the chain's home directory and using the same network
as
the chain's container. The arguments passed to the command will be directly passed to the axoned binary.
cargo make chain <command>For example, to check the status of the chain, just run:
cargo make chain statusTo stop the chain, just run:
cargo make chain-stopTo clean the chain, just run:
cargo make clean-chainThe documentation of the Smart Contracts must be committed to the repository. The documentation is generated from the Smart Contracts' schema.
To generate the documentation follow the steps below.
Be sure you have the following tools installed:
- Yarn v1.22.10 or higher
Then, install the dependencies:
yarn global add @adobe/[email protected]To generate the documentation, just run:
cargo make schema
cargo make docsYou'll find the generated documentation under the docs folder.
When developing a new contract, you should commit the generated documentation to the repository. For this, generate the documentation and commit the changes:
git commit -am "docs: update generated documentation"โ - The enforcement of stringent rules, monitored by a linter (Clippy) within the Github CI environment.
๐ค - A high level of code coverage through systematic unit testing.
๐ซ - Future considerations for additional testing approaches, such as fuzzy testing or end-to-end testing, to further enhance quality.
| Date | Auditor | Version | Report |
|---|---|---|---|
| 2024/08/08 | BlockApex | 0cae9ec (v6.0.0) | Axone Smart Contract Audit Report.pdf |
So you want to contribute? Great! โค๏ธ We appreciate any help you're willing to give. Don't hesitate to open issues and/or submit pull requests.
We believe that collaboration is key to the success of the AXONE project. Join our Community discussions on the Community Repository to:
- Engage in conversations with peers and experts.
- Share your insights and experiences with AXONE.
- Learn from others and expand your knowledge of the protocol.
The Community Repository serves as a hub for discussions, questions, and knowledge-sharing related to AXONE. We encourage you to actively participate and contribute to the growth of our community.
Please check out AXONE health files: