This monorepository contains the source code for the core smart contracts implementing Spectrum Protocol on the Terra blockchain.
- Rust v1.60.0+
wasm32-unknown-unknown
target- Docker
-
Install
rustup
via https://rustup.rs/ -
Run the following:
rustup default stable
rustup target add wasm32-unknown-unknown
- Make sure Docker is installed
Each contract contains Rust unit and integration tests embedded within the contract source directories. You can run:
cargo unit-test
cargo integration-test
After making sure tests pass, you can compile each contract with the following:
RUSTFLAGS='-C link-arg=-s' cargo wasm
cp ../../target/wasm32-unknown-unknown/release/{contract_module}.wasm .
ls -l {contract_module}.wasm
sha256sum {contract_module}.wasm
For production builds, run the following:
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.12.6
This performs several optimizations which can significantly reduce the final size of the contract binaries, which will be available inside the artifacts/
directory.
Copyright 2022 Spectrum Protocol