Giter VIP home page Giter VIP logo

contract-samples-hardhat's Introduction

contract-samples-hardhat

Samples of contracts repository.

Contracts

Refer addresses.json for contracts' addresses

Flow of Auction

  1. Deploy an auction smart contract
  2. Deploy an NFT smart contract with setting an auction smart contract as a minter
  • Use or inherit AuctionNFTBase for NFT contract
  1. Build a metadata server that returns NFT's metadata
  2. Create an auction web app to show NFTs and let users bid
  3. Create an auction
  4. Users bid
  5. Auction finishes when time comes
  6. Owner settles auction to transfer NFT and ETH

See Auction Contract Specification for speficiations and description of auction contract

Quickstart

Requirements

Name Used for
TypeScript Test for solidity smart contract, script, tools
solc solidity commandline compiler for compiling solidity code, running test, etc
Hardhat Test for solidity smart contract, script, tools (Overview of Hardhat)

Install Dependencies

  • โš ๏ธ Install yarn if you have not installed. (Reference)
yarn

Test

yarn test

Script

Environment Setup

Copy .env.example to .env and fill in fields

Deploy

Auction

  • (Reccomended) deployment with auto-deploy configuration for an NFT auction contract, verify etherscan and write addresses to the addresses.json.
    • auto-deploy sets gas info automatically. Deployment without auto-deploy requires to configure gas info manually.
yarn task:deploy-and-configure --network [network] --auto-deploy

# ex.) for goerli
yarn task:deploy-and-configure --network goerli --auto-deploy
  • deployment with manual configuration for an NFT auction contract, verify etherscan and write addresses to the addresses.json.
yarn task:deploy-and-configure --network [network]

# ex.) for goerli
yarn task:deploy-and-configure --network goerli

AuctionNFTBase

Use Remix to deploy.

Verify on block explorer

In case you only want to verify a contract for block explorer.

yarn task:verify --contract [path:contractName] [contractAddress] --network [network]

# ex.) contract on goerli
yarn task:verify --contract contracts/proxies/AuctionProxy.sol:AuctionProxy 0xF99a8b2DF498bc3ea2044f1943C210A4fd946b2E --network goerli

Note

This smart contract follows various gas optimization methods. Some of the methods can be found here.

contract-samples-hardhat's People

Contributors

soradaibu 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.