Giter VIP home page Giter VIP logo

nft-erc721-erc20-travelnft's Introduction

NFT - Travel Ticket

This the blockchain project that sold 3K+ NFTs in 4 hours on Ethereum using JavaScript and Solidity. OPENSEA SeatBelt On!

Screenshot on testnet rinkeby: https://rinkeby.etherscan.io/address/0xf49a30a3205E9E1f1AC748481f26BAeD344Fb3A9



Usage

use package hardhat...

once install packga "hardhat-shorthand", we can replace "hardhat" in cml by "hh"



Start the project..

  1. yarn install
  2. set your .env file
  3. check the network settings in hardhat.config.js

Deploy the Contract

  • all contract

    // assign network
    yarn hardhat deploy --network rinkeby
    
    // local network
    yarn hardhat deploy
    
  • specific contract

    // tags decide in ./depoly/deploy.js
    yarn hardhat deploy --network rinkeby --tags "XXX"
    

Verify

Normally, it would verify automatically when deploy
If not, can run

  • without argument

    yarn hardhat verify --network rinkeby "CONTRACT_ADDRESS"
    
  • with argument first create an argument.js file

    yarn hardhat verify --network rinkeby --constructor-args arguments.js "CONTRACT_ADDRESS"
    

Test

At the same time, can get the gas report

yarn hardhat test

Image & .json



Gas Improve

Sructure

  • The more often use function, put more ahead
  • Replace if-else by ?:, and put easier fire situation into if statement

Function using

  • Not override tokenURI(), by get rid of ".json" for each filename
  • Use merkle tree, not array mapping
  • Don't use totalSupply() from ERC721Enumerable.sol, which needs 2 override function, and cost 400000 gas more.
  • Import Ownable.sol, not write on my own
  • Less math calculate



Encounter Error

Error: ENOENT: no such file or directory, open... artifacts/build-info ...

yarn hardhat clean

nft-erc721-erc20-travelnft's People

Contributors

bonnie-entre avatar

Watchers

 avatar

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.