xyz NFT Contract
This repository contains the core NFT smart contract that implements xyz, a base layer for metaverses on the Terra blockchain.
The xyz contract extends CosmWasm's CW721-base contract and supports query and execute messages from the CW721 spec.
Integrating with xyz
Developers who wish to integrate with xyz should depend on the collectxyz
package, which contains common data types and helpers for interacting with xyz smart contracts.
Development
Environment Setup
- Rust v1.44.1+
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
Testing
Run all tests for the workspace:
cargo test
Compiling
To compile the NFT contract, first cd
into contracts/collectxyz-nft-contract
, then run:
RUSTFLAGS='-C link-arg=-s' cargo wasm
shasum -a 256 ../../target/wasm32-unknown-unknown/release/collectxyz_nft_contract.wasm
Production
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.11.5
This uses rust-optimizer to perform several optimizations which can significantly reduce the final size of the contract binaries, which will be available inside the artifacts/
directory.