Testing interactions with other NFT projects locally is difficult

Overview

Terra NFT Stub contract

Testing interactions with other NFT projects locally is difficult. Terra NFT Stub makes things a bit easier by providing a contract that allows you to easily(?) stub out tokens with known characteristics and attributes.

Any token that follows the CW721 Metadata structure can be stubbed.

Usage

This project is still early stage so has not been published on crates.io yet.

The following commands will build and optimize a WASM binary.

cargo build
cargo optimize

The scripts in terrad-scripts/ provide examples for storing and instantiating the contract against a localterra instance, and a basic example of sending a Stub msg to stub out a new token in the contract.

You would typically want to:

  1. Build and optimize the contract binary.
  2. Store the contract code with store.sh.
  3. Instantiate the contract with instantiate.sh (needs the correct code_id.)
  4. Try creating the example stub with example-stub.sh (needs the address of the instantiated contract.)
  5. Look up the new stub token in finder.

The scripts need to be manually updated to include specific details for code_id, contract address, minter address, etc. After running each script, you can use the TX hash returned by the script to look up the transaction in finder and then copy the required details to the next script that you need to run.

This smart contract makes use of the cw721-base and cw721-metadata-onchain reference implementations specifically so that tokens can be deserialized within other contracts using the same token structs. A smart contract can import both of the references crates and use the structs in those packages to deserialize a token when calling query_wasm_smart.

Ideas and suggestions

Please submit ideas for extending and improving this testing contract as an issue. The initial motivation was to build something that would allow deterministic results to be returned from nft_info and all_nft_info messages to have predictable results when using either query within another smart contract.

There are plenty more ways that this contract could be extended to support local testing though, and we'd like to know what others want from a stub NFT contract for testing and developing Terra smart contracts.

Test contract only

This contract is explicitly for testing purposes only. Don't use this repo as a basis for building a production smart contract, and don't deploy this contract on mainnet.

Inspiration

This project leans heavily on work done by TerraPeeps and R.E.S.T.

Digging through those projects has help make this project a reality. TerraPeeps helped understand handling custom messages, querying and storage. R.E.S.T. helped thinking about structuring smart contract code and how to reuse the reference implementation in CW721 base and CW721 Metadata Onchain.

The astroport_fi factory project also helped understand how to test and verify how query_wasm_smart works, and can be tested.

This is still a project created to help learn about smart contracts on Terra, and also learn and pratctice Rust, though. Any suggestions on how to improve the structure of the code or how to write more effective Rust are welcome; just open an issue!

You might also like...
Facilitating high-level interactions between Wasm modules and JavaScript

wasm-bindgen Facilitating high-level interactions between Wasm modules and JavaScript. Guide | API Docs | Contributing | Chat Built with ๐Ÿฆ€ ๐Ÿ•ธ by The

Application microframework with command-line option parsing, configuration, error handling, logging, and shell interactions
Application microframework with command-line option parsing, configuration, error handling, logging, and shell interactions

Abscissa is a microframework for building Rust applications (either CLI tools or network/web services), aiming to provide a large number of features w

Verify Discord interactions on Cloudflare Workers with Twilight

twilight-cloudflare-workers Verify Discord interactions on Cloudflare Workers with Twilight. API The primary function in the API is process. It takes

JS Runtime proof-of-concept for interactions with AvdanOS

Important: we are migrating to a new Discord server .gg/avdanos What is this ? This repo aims to be a JavaScript environment where AvdanOS extensions

A package for common types for Cargo index interactions, and conversion between them.

Development stream: https://youtu.be/zGS-HqcAvA4 License Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org

Mercy is a public Rust crate created to assist with building cybersecurity frameworks, assessment tools, and numerous other projects
Mercy is a public Rust crate created to assist with building cybersecurity frameworks, assessment tools, and numerous other projects

Mercy ๐Ÿ“š Documentation Mercy is a public Rust crate created to assist with building cybersecurity frameworks, assessment tools, and numerous other pro

Mercy is a public Rust crate created to assist with building cybersecurity frameworks, assessment tools, and numerous other projects
Mercy is a public Rust crate created to assist with building cybersecurity frameworks, assessment tools, and numerous other projects

Mercy ๐Ÿ“š Documentation Mercy is a public Rust crate created to assist with building cybersecurity frameworks, assessment tools, and numerous other pro

A WIP property-based testing library in Rust, built with generalized targeted-property testing in mind.

Crabcheck A WIP property-based testing library in Rust, built with generalized targeted-property testing in mind. What is property-based testing? TODO

A simple cli to clone projects and fetch all projects in a GitHub org..

stupid-git A simple cli to clone projects and update all projects. get all repository from GitHub clone all pull all with git stash Usage create sgit.

Make and use playgrounds locally.

cargo playground Cargo playground opens a local playground in the editor of your choice. Install You can install it directly using cargo $ cargo insta

A utility that can download JavaScript and TypeScript module graphs and store them locally in a special zip file.

eszip A utility that can download JavaScript and TypeScript module graphs and store them locally in a special zip file. To create a new archive: esz

Replicating Fastly Varnish locally

Fastly VCL Interpreters in Rust A tree-walk interpreter for Fastly VCL Install project Install rust - curl https://sh.rustup.rs -sSf | sh Clone projec

Test social media cards locally
Test social media cards locally

Share Preview Test social media cards locally Description Preview and debug websites metadata tags for social media share. Third Party Packages Distri

Run Github Actions workflows locally or on a custom backend

gha-runner runs Github Actions workflows. You can run workflows locally, or extend gha-runner with custom backends to run workflows elsewhere (e.g. Pe

Desktop launcher to install and use Holochain apps locally

Holochain Launcher A cross-platform executable that launches a local Holochain conductor, and installs and opens apps. Feedback is immensely welcome i

Merge together and efficiently time-sort compressed .pcap files stored in AWS S3 object storage (or locally) to stdout for pipelined processing.

Merge together and efficiently time-sort compressed .pcap files stored in AWS S3 object storage (or locally) to stdout for pipelined processing. High performance and parallel implementation for 10 Gbps playback throughput with large numbers of files (~4k).

sg = Steam Guard, access sg verification code locally.

Steam Guard CLI Access your Steam Guard token locally. Credit https://github.com/steevp/UpdogFarmer/blob/master/app/src/main/java/com/steevsapps/idled

Dr-dotnet - ๐Ÿฉบ One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service

Dr-dotnet - ๐Ÿฉบ One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service. Based on the lowest level dotnet profiling APIs and using the rust language ๐Ÿฆ€ for a minimal runtime penalty.

Mac App/CLI that automatically adds project logos to your locally cloned GitHub repos
Mac App/CLI that automatically adds project logos to your locally cloned GitHub repos

Download the app Automatically adds project logos to your locally cloned GitHub repos. Youtube Video This repository contains the source code for the

Owner
smaster0517
Reliable and Passionate Full Stack Blockchain// Web Developer. Highly motivated self-driven developer, who holds a strong passion for exploring emerging tech.
smaster0517
A simple web server(and library) to display server stats over HTTP and Websockets/SSE or stream it to other systems.

x-server-stats A simple web server(and library) to display server stats over HTTP and Websockets/SSE or stream it to other systems. x-server(in x-serv

Pratyaksh 11 Oct 17, 2022
Implementation of the Docker Registry HTTP API V2 in Rust, that can act as a proxy to other registries

Docker registry server and proxy (I'm bad at creating catchy names, but this one is good enough.) This project aims to implement a Docker Registry HTT

l4p1n (Mathias B.) 2 Dec 30, 2022
MuonFP is an enterprise ready, TCP passive fingerprinter written in Rust that has no external dependencies such as WireShark or other open source software.

MuonFP is a TCP passive fingerprinter written in Rust that has no external dependencies such as WireShark or other open source software. The program w

Sundruid 8 Sep 22, 2024
Modrinth API is a simple library for using Modrinth's API in Rust projects

Ferinth is a simple library for using the Modrinth API in Rust projects. It uses reqwest as its HTTP(S) client and deserialises responses to typed structs using serde.

null 20 Dec 8, 2022
Rust-based static analysis for TypeScript projects

Fast TypeScript Analyzer FTA (Fast TypeScript Analyzer) is a super-fast TypeScript static analysis tool written in Rust. It captures static informatio

Sam Brown 4 May 23, 2023
twilight-interactions is a set of macros and utilities to work with Discord Interactions using twilight.

Twilight interactions twilight-interactions is a set of macros and utilities to work with Discord Interactions using twilight. Note: This crate is not

null 24 Dec 26, 2022
Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order).

Mundane Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order). Issues and

Google 1.1k Jan 3, 2023
Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order).

Mundane Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order). Issues and

Google 1.1k Jan 3, 2023
The Heros NFT Marketplace Boilerplate project is designed to let users fork, customize, and deploy their own nft marketplace app to a custom domain, ultra fast.

Heros NFT on Solana The Heros NFT Marketplace Boilerplate project is designed to let users fork, customize, and deploy their own nft marketplace app t

nightfury 6 Jun 6, 2022
Kinda functional block engine for testing bundles on jito-solana locally

Half Baked Block Engine About This is a half-baked block engine. It can be used for testing bundles running through jito-solana. Shortcomings The bare

null 8 Nov 16, 2022