Skip to content

ranupthestairs/erc1155-royalty

Repository files navigation

ERC1155 with ERC2981 Standard

Motivation

  • This project inspired by the famous P2E game Axie Infinity

Project Structure

.
├── README.md
├── contracts
│   └── Land.sol
├── deploy
│   ├── 1_deploy_token.ts
│   └── 2_mint_tokens.ts
├── hardhat.config.ts
├── helpers
│   ├── hardhat-config.ts
│   └── verify.ts
├── package-lock.json
├── package.json
├── scripts
├── test
│   └── index.ts
├── tsconfig.json
└── typechain

Setup

  • Clone this project and run the following command
npm install

# or

npm ci

To make sure everything works perfectly run

npx hardhat

Env Setup

  • Create .env directory on the root folder with the following variables
```shell
ETHERSCAN_API_KEY=<change with your etherscan api key>
# this is for rinkeby test network
RINKEBY_URL=https://eth-rinkeby.alchemyapi.io/v2/<add your alchemy api key here>
RINKEBY_PRIVATE_KEY=<change this with your account private key on metamask>
# If you want to specify the gas manually please uncomment and change RINKEBY_GAS
# for RINKEBY_GAS please get/refer the value from https://ethgasstation.info/ and multiple it to 1000000000 to convert it to wei
# ex: Standard gas price = 30 so 30*1000000000 = 3000000000 wei
# RINKEBY_GAS=3000000000

Deployment

  • On this project deployment we used hardhat-deploy to make the deployment organized and clean

Contract Deployment

npx hardhat deploy --network rinkeby --tags staging --reset

The code above will automatically verify the smart contract on rinkeby etherscan, if verification error occure please run the following to re-verify

npx hardhat --network rinkeby etherscan-verify

Transaction Tx

Deployment TX

Test Royalty

  • To test royalty we list our NFT Land (Axie Infinity Inspired Land) to LooksRare cause opensea doesn't support erc2981 standard as of now

Listing Info:

Buy Tx made by 0xFED561Ac226962b5867160b9D3EDE6ae4Ba52548:

Buy Tx Info:

  • Deployer received 0.0955 weth with 0.0025 weth royalty
  • LooksRare sales 0.002 weth

Address Used:

  • Deployer and Royalty receiver Address: 0x9E36fcE2f2FcdBEF2B9A8D3D377FB6Dc4D48fb6f
  • Buyer Address: 0xFED561Ac226962b5867160b9D3EDE6ae4Ba52548

Contract

Market Place Link:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published