Code Monkey home page Code Monkey logo

dixel-contract's Introduction

Dixel

A single NFT canvas where users overwrite the previous edition with price-compounded pixels.

  1. There is an universal art canvas with 16x16 pixels that anyone can overwrite
  2. Whenever a user overwrites a pixel, the price of the pixel increases by 0.1% (Initial pixel price: 0.001 DIXEL)
  3. A new NFT edition with the current canvas state will be minted to the updater (image data is encoded as SVG, 100% on-chain)
  4. Total cost that user paid to overwrite pixels goes to:
    • 10% -> all contributors proportional to their contribution count (total pixel count a user has updated so far)
    • 90% -> reserve for refund when the NFT gets burned
  5. If a user burn a NFT they own, reserve amount (DIXEL tokens) gets refunded to the user (90% of total minting cost)

Run Tests

npx hardhat test

Contracts

BSC Production

BSC Testnet

  • Test token: 0x62c01AF8F8Ab997Acec06C3a71DC18594726ba24
  • TestTokenFaucet: 0x0d5B2E37FB21A784FE26fD8d89Ea3Ce8F8BDc54d
  • DixelClub: 0x3b7bd4FCcc630f025584f1F7e4874adB1f324AcE
  • DixelArt NFT: 0x46cc5a12A3F58A837475C9BFe52C0C02274C0C0c
  • DixelAirdrop: 0x7Fcb48b7AF75E47af89B328f99B681aCa93A7d10
  • DixelTip: 0x37F6692763d388902f7413Fd560A15491927Fe0D

Deploy

npx hardhat compile

HARDHAT_NETWORK=bscmain node scripts/deploy.js

# Verify source code on Etherscan
npx hardhat verify --network bscmain {contract address} "parameter 1" "parameter 2"

Gas Consumption

·----------------------------------------------------|---------------------------|--------------|-----------------------------·
|                Solc version: 0.8.10                ·  Optimizer enabled: true  ·  Runs: 1500  ·  Block limit: 60000000 gas  │
·····················································|···························|··············|······························
|  Methods                                           ·                1 gwei/gas                ·       2607.30 usd/eth       │
····························|························|·············|·············|··············|···············|··············
|  Contract                 ·  Method                ·  Min        ·  Max        ·  Avg         ·  # calls      ·  usd (avg)  │
····························|························|·············|·············|··············|···············|··············
|  DixelAirdrop             ·  claim                 ·          -  ·          -  ·       69988  ·            8  ·       0.18  │
····························|························|·············|·············|··············|···············|··············
|  DixelAirdrop             ·  closeAirdrop          ·          -  ·          -  ·       78915  ·            3  ·       0.21  │
····························|························|·············|·············|··············|···············|··············
|  DixelAirdrop             ·  whitelist             ·          -  ·          -  ·       95119  ·           22  ·       0.25  │
····························|························|·············|·············|··············|···············|··············
|  DixelArt                 ·  approve               ·          -  ·          -  ·       48721  ·            5  ·       0.13  │
····························|························|·············|·············|··············|···············|··············
|  DixelArt                 ·  burn                  ·          -  ·          -  ·       68181  ·            7  ·       0.18  │
····························|························|·············|·············|··············|···············|··············
|  DixelArt                 ·  transferOwnership     ·      28630  ·      28642  ·       28641  ·          102  ·       0.07  │
····························|························|·············|·············|··············|···············|··············
|  DixelMock                ·  claimReward           ·      55953  ·      73053  ·       57268  ·           52  ·       0.15  │
····························|························|·············|·············|··············|···············|··············
|  DixelMock                ·  updatePixels          ·    1157496  ·    1292627  ·     1243279  ·          214  ·       3.24  │
····························|························|·············|·············|··············|···············|··············
|  DixelMock                ·  updatePixelsNoChecks  ·          -  ·          -  ·     3008326  ·            1  ·       7.84  │
····························|························|·············|·············|··············|···············|··············
|  DixelMock                ·  updatePixelsOriginal  ·          -  ·          -  ·     3258586  ·            1  ·       8.50  │
····························|························|·············|·············|··············|···············|··············
|  DixelTip                 ·  burnAndRefundTips     ·          -  ·          -  ·       91497  ·            4  ·       0.24  │
····························|························|·············|·············|··············|···············|··············
|  DixelTip                 ·  tip                   ·          -  ·          -  ·       98370  ·            9  ·       0.26  │
····························|························|·············|·············|··············|···············|··············
|  ERC20PresetMinterPauser  ·  approve               ·      46608  ·      46620  ·       46619  ·          203  ·       0.12  │
····························|························|·············|·············|··············|···············|··············
|  ERC20PresetMinterPauser  ·  mint                  ·      55830  ·      72954  ·       62554  ·          316  ·       0.16  │
····························|························|·············|·············|··············|···············|··············
|  Deployments                                       ·                                          ·  % of limit   ·             │
·····················································|·············|·············|··············|···············|··············
|  ColorUtilsMock                                    ·          -  ·          -  ·      298677  ·        0.5 %  ·       0.78  │
·····················································|·············|·············|··············|···············|··············
|  DixelAirdrop                                      ·     794659  ·     794671  ·      794670  ·        1.3 %  ·       2.07  │
·····················································|·············|·············|··············|···············|··············
|  DixelArt                                          ·    2927148  ·    2927172  ·     2927171  ·        4.9 %  ·       7.63  │
·····················································|·············|·············|··············|···············|··············
|  DixelMock                                         ·    8076080  ·    8096016  ·     8076295  ·       13.5 %  ·      21.06  │
·····················································|·············|·············|··············|···············|··············
|  DixelTip                                          ·     823384  ·     823396  ·      823395  ·        1.4 %  ·       2.15  │
·····················································|·············|·············|··············|···············|··············
|  ERC20PresetMinterPauser                           ·          -  ·          -  ·     1951544  ·        3.3 %  ·       5.09  │
·----------------------------------------------------|-------------|-------------|--------------|---------------|-------------·

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.