#xyz #contract #nft #smart-contracts #cosmwasm #helper #base

collectxyz

Common data types and helpers for interacting with xyz smart contracts

3 unstable releases

0.2.2 Nov 13, 2021
0.2.1 Nov 9, 2021
0.1.0 Nov 3, 2021

#18 in #xyz

31 downloads per month
Used in collectxyz-nft-contract

Apache-2.0

21KB
448 lines

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
  1. Install rustup via https://rustup.rs/

  2. Run the following:

rustup default stable
rustup target add wasm32-unknown-unknown
  1. 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.

Dependencies

~5.5MB
~116K SLoC