Skip to content

collectxyz/collectxyz-guestbook-tutorial-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xyz Guestbook Tutorial Contract

This repository contains an example smart contract that illustrates how to build on top of the xyz NFT contract.

This contract implements a "guestbook" that allows the owner of an xyz to store a single guestbook entry at that xyz's current coordinate location for a small fee. If the xyz owner relocates their xyz, they can make another guestbook entry at their xyz's new location.

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, run:

RUSTFLAGS='-C link-arg=-s' cargo wasm
shasum -a 256  target/wasm32-unknown-unknown/release/collectxyz_guestbook_tutorial_contract.wasm

Production

For production builds, first install 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/rust-optimizer:0.11.5

# or, install cargo-run-script, then run
cargo run-script optimize

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.

About

An example smart contract that builds on top of xyz

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages