Giter Club home page Giter Club logo

terra-boilerplate's Introduction

terra-boilerplate

This repo contains boilerplate contracts for terra blockchain. Contract simply say you gm followed by your name. This repo also includes scripts to upload, instantiate & interact with contract.

Prerequisite

  1. Rust and Cargo (v1.51.0+)
  2. Docker
  3. NodeJs

Installation

npm install

Building the Contract

This will check for any preliminary errors before optimizing.

cargo wasm

Optimizing your build:

cargo run-script optimize

This will result in an optimized build of artifacts/terra_boilerplate.wasm or artifacts/terra_boilerplate-aarch64.wasm in your working directory.

Tests:

You an run unit test for contract via below command:

cargo unit-test

Contract Deployment

Upload & Instantiate Contract code:

npm run upload

Expected Output:

Uploading contract code...
Upload finished!
Transaction: https://finder.terra.money/testnet/tx/2D2BB6BC07AE660DB4F0B00E217893486583E6E5A3D2B7490FD487BB665B0B6C

Code ID: 31074

Initiating contract with CodeID 31074...
Contract Initiated successfully!
Transaction: https://finder.terra.money/testnet/tx/F417E778D43B016CA6CA0937737F9D3ED06F147BFB62A969076EF672B65EDCEB

Contract Address:  terra1ej0wfpdym4gf0ql80lj3jam2xg4wnrnh8vgcny
(https://finder.terra.money/testnet/address/terra1ej0wfpdym4gf0ql80lj3jam2xg4wnrnh8vgcny)

Query Message:

npm run query

Expected Output:

Message: gm terra!

Update Name (MsgExecute):

npm run update --name=lunatics

Expected Output:

Changing user name...
Name changes successfully!
Transaction: https://finder.terra.money/testnet/tx/2DD2E6966290CACF275354573FE26CF067DDDB7CCC1F3C17715E24B62490637C

New Message:

npm run query

Expected Output:

Message: gm lunatics!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.