The NFT smart contract powering xyz on Terra

Overview

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.

You might also like...
Testing a smart contract on the Solana blockchain

Environment Setup Install Rust from https://rustup.rs/ Install Solana from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-to

clockchain is a system for benchmarking smart contract execution times across blockchains.
clockchain is a system for benchmarking smart contract execution times across blockchains.

Clockchain Clockchain is a research tool for benchmarking smart contract execution times across blockchains using Arcesco-- a block-chain agnostic ins

Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana (WIP) ⛏👷🚧⚠️
Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana (WIP) ⛏👷🚧⚠️

Solana BPF Boilerplate Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana This boilerplate provides the following. Si

Emerging smart contract language for the Ethereum blockchain.

Emerging smart contract language for the Ethereum blockchain.

Vectis - Smart Contract Wallet

A smart contract wallet project to add functionality for users of DApps to manage their keys by allowing for recovery and account freeze, whilst preserving user control, and enabling relayer capability for gas provisioning

Smart Contract built in Rust to run inside Cosmos SDK module on all chains that enable it

CoinSwap is a Smart Contract that is built on the terra blockchain and can be used to swap cryptocurrencies such as LUNA, UST, TerraUSD, Anchor, Mirror Protocol, LUNI and other CW20 tokens. The Project also contains a smart contract which works as a analysis tool for the gas fees on the Terra Blockchain.

Heimdall is an advanced Ethereum smart contract toolkit for forensic and heuristic analysis.
Heimdall is an advanced Ethereum smart contract toolkit for forensic and heuristic analysis.

Heimdall is an advanced EVM toolkit which aims to make dealing with smart contracts on EVM based chains easier. Installation & Usage Heimdall's update

A simple example demonstrating cross-contract calls in CosmWasm smart contracts

Cross-contract calls This tutorial demonstrates cross-contract calls with CosmWasm v1. Overview An end user calls the reservation contract to register

The Ink! smart contract SDK for XVM interface

Ink! XVM SDK The Ink! smart contract SDK for XVM interface. This SDK contains contract wrappers and all middleware code to make XVM development easy.

Comments
  • crate release prep

    crate release prep

    Primarily, this PR splits out the NFT contract message structs into their own package called collectxyz for easier integration into other contracts that wish to call the xyz NFT contract. Additionally, it includes a couple small fixes and enhancements, which live in their own commits for easy review.

    opened by 0xja 2
  • update token metadata format in query responses

    update token metadata format in query responses

    This PR updates the NFT contract's nft_info and all_nft_info query responses to adhere to OpenSea metadata standards. These changes should make our NFT contract behave like a cw721 v0.9.2 contract, even though we still need to use v0.9.1 under the hood because of how our tokens are represented in the contract storage (at least for now).

    Without these updates, nft_info returns token metadata that looks like:

    {
      "name": "xyz #1",
      "description": "Explore the metaverse, starting with xyz.",
      "image": "data:image/svg+xml;base64,...",
      "extension": {
        "coordinates": {
          "x": 0,
          "y": 0,
          "z": 0
        },
        "prev_coordinates": null,
        "arrival": "123456..."
      }
    }
    

    With these updates, nft_info returns token metadata that looks like:

    {
      "token_uri": null,
      "extension": {
        "name": "xyz #1",
        "description": "xyz is a...",
        "attributes": [
          {
            "display_type": null,
            "trait_type": "x",
            "value": "0"
          },
          {
            "display_type": null,
            "trait_type": "y",
            "value": "0"
          },
          {
            "display_type": null,
            "trait_type": "z",
            "value": "0"
          }
        ],
        "image": "data:image/svg+xml;base64,...",
        "image_data": null,
        "external_url": null,
        "background_color": null,
        "animation_url": null,
        "youtube_url": null
      }
    }
    

    Note: this doesn't change the response format for any non-CW721 query methods, like xyz_nft_info.

    opened by 0xja 0
  • v0.1.1 migration prep

    v0.1.1 migration prep

    This PR updates MigrateMsg to contain no data, and removes code from the migration handler that would update the contract config (was in place to simplify fast iteration during initial contract development).

    The code on this branch has been built and deployed to the testnet. If we find no issues in manual testing against the testnet contract, we should feel secure migrating the mainnet contract to v0.1.1.

    opened by 0xja 0
  • Add GitHub Actions workflows for testing and releases

    Add GitHub Actions workflows for testing and releases

    This PR introduces two GitHub Actions workflows pulled from the Mirror Protocol contracts repo - one for linting and testing code, and another for packaging code for GitHub releases.

    opened by 0xja 0
Owner
null
An example smart contract that builds on top of xyz

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

null 5 Apr 4, 2022
Smart Contract for Terra Name Service

TERRA NAME SERVICE CONTRACTS Terra Name Service is to create easy-to-remember names for your Terra address like ‘dokwon.ust’ instead of ‘terra1...whez

null 12 Nov 23, 2022
Substrate NFT !ink smart contract base

Substrate !ink NFT simple implementation This is a simple working version of base NFT smart contract written using latest (as of this date) !ink 3.0.0

POLK4.NET 14 Dec 3, 2022
Example NFT marketplace project using ink! smart contract.

NFT Marketplace project This contract is an example for the NFT marketplace implementation. License Apache 2.0 ??️ How to use - Contracts ?? Build Use

Swanky dApps 8 Jan 18, 2023
A Simple Rust NFT API + Smart Contract

Rust NFT API Purpose Rust NFT API is a simple RESTful API developed in Rust that offers functionalities for creating, retrieving, and listing Non-Fung

Luis Soares 5 Feb 25, 2024
Terra Trophies is a copy of Ethereum's POAP project for Terra

Terra Trophies Terra Trophies is a copy of Ethereum's POAP project for Terra. It allows anyone to create digital badges for participants of events, or

larry.{ust,sol,thor} 18 Dec 7, 2022
My code for the terra.academy course on CosmWasm smart contracts

CosmWasm Starter Pack This is a template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it. To understan

Alex Incerti 0 Nov 7, 2021
This monorepository contains the source code for the smart contracts implementing bAsset Protocol on the Terra blockchain.

Crll bAsset Contracts This monorepository contains the source code for the smart contracts implementing bAsset Protocol on the Terra blockchain. You c

null 3 Mar 29, 2024
Opendp - The core library of differential privacy algorithms powering the OpenDP Project.

OpenDP The OpenDP Library is a modular collection of statistical algorithms that adhere to the definition of differential privacy. It can be used to b

OpenDP 176 Dec 27, 2022
clockchain is a system for benchmarking smart contract execution times across blockchains.

Clockchain Clockchain is a research tool for benchmarking smart contract execution times across blockchains using Arcesco-- a block-chain agnostic ins

Zeke Medley 7 Oct 3, 2022