CosmWasm contracts for the OKP4 network.
This repository contains the Smart Contracts deployed on the OKP4 network and running on CosmWasm.
The list of currently implemented contracts is as follows:
- cw-template: base smart contract to start coding in the OKP4 blockchain.
The project is structured around a set of Rust workspaces, each defining a smart contract.
.
βββ contracts
β βββ <contract>
β βββ Cargo.toml
β βββ examples
β βββ schema
β βββ src
ββββ Cargo.toml
Be sure you have the following tools installed:
- Rust v1.63.0 or higher
- cargo-make v0.36.3 or higher
- Docker
To compile the Smart Contracts to Wasm, just invoke the wasm
goal of the makefile:
cargo make wasm
This 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-coverage
The project comes with a set of convenient tasks to manage the Smart Contracts and the blockchain. To see the list of available tasks, run the following command:
cargo make --list-all-steps | grep chain- | sort
The list of available tasks is as follows:
chain-add-keys - Add a set of predefined keys (recovered from the seed phrases) to the chain.
chain-clean - Clean the chain data (β οΈ definitively)
chain-deploy-contract - Deploy a specific contract to the chain. The contract must be compiled and the wasm file must be present in the artifacts directory (under target/wasm32-unknown-unknown/...).
chain-deploy-contracts - Deploy all the available contracts to the chain (under target/wasm32-unknown-unknown/...).
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-inspect-contract - Inspect a specific contract deployed to the chain.
chain-list-contracts - List all the contracts deployed to the chain.
chain-logs - Show the chain's container logs.
chain-start - Run the full node wasmd application using the chain's home directory under a Docker container.
chain-stop - Stop the chain's container.
To initialize the chain, just run:
cargo make chain-initialize
This 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-start
This will start the chain's container and run the full node wasmd application.
You can check the chain's logs with:
cargo make chain-logs
To deploy the Smart Contracts, just run:
cargo make chain-deploy-contracts
This will deploy all the available contracts to the chain. For this, the contracts must be compiled and the wasm files must be present in the artifacts directory. See the Build section for more details.
Now, you can interact with the deployed smart contracts and test them out.
To stop the chain, just run:
cargo make chain-stop
To clean the chain, just run:
cargo make chain-clean
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.
Please check out OKP4 health files: