Skip to content

Steemhunt/mint.club-v2-contract

Repository files navigation

image

Mint Club V2

Overview 👀

Mint Club is a bonding curve-based token (ERC20, ERC1155) creation and trading protocol. Users can create an asset with a custom bonding curve on top of any existing ERC20 token as collateral. By using a bonding curve, the new asset is immediately tradable without the need for liquidity creation on DEXs or CEXs.

Security Audit 🔒

Key features 🗝️

  1. Token Creation (ERC20 or ERC1155)

    • Create a bonding curve token (ERC20) or NFT (ERC1155) by using another ERC20 token as the base asset for your token's bonding curve pool.
    • Choose from curve types such as linear, exponential, or flat line, and adjust the price variation intervals for your token's journey.
    • Set key token specifications like starting price, free minting allocation, maximum price, and supply.
    • Deploy your asset on various Layer 1 and 2 networks.
  2. Buy (= Mint) and Sell (= Burn) Bonding Curve Asset

    • When a bonding curve token is bought, the price curve determines the amount of the base token to be paid, enabling a swap. The paid base tokens are stored in the bonding curve pool, and an equivalent amount of the bonding curve tokens is minted to the buyer.
    • Conversely, when a bonding curve token is sold, the curve calculates the amount of base tokens to be returned. These base tokens are then returned to the seller, and the equivalent bonding curve tokens are burned.
  3. Airdrop Tool

    • Set up a public or private airdrop for ERC20 or ERC1155 (supports id = 0 only) tokens.
    • For private airdrops, Mint Club offers a merkleRoot-based whitelist feature.
  4. Lock-up Tool

    • Create a contract-bound lock-up schedule for ERC20 or ERC1155 (supports id = 0 only) tokens.
    • Specify the unlock time and recipient address for after the lock-up period is completed.

Gloals and Objectives ⛳️

Mint Club aims to provide no-code, yet flexible, token creation tools for web3 creators who want to build their token economy. One of the biggest hurdles in building token economics is providing liquidity in the early stages, but this issue is eliminated with the Mint Club protocol.

Contract addresses 📜

Contract / Chain Ethereum Optimism Arbitrum One Base BNB Chain Polygon (PoS)
MCV2_Token 0xAa70bC79fD1cB4a6FBA717018351F0C3c64B79Df
MCV2_MultiToken 0x6c61918eECcC306D35247338FDcf025af0f6120A
MCV2_Bond 0xc5a076cad94176c2996B32d8466Be1cE757FAa27
MCV2_ZapV1 0x91523b39813F3F4E406ECe406D0bEAaA9dE251fa
Locker 0xA3dCf3Ca587D9929d540868c924f208726DC9aB6
MerkleDistributor 0x1349A9DdEe26Fe16D0D44E35B3CB9B0CA18213a4
MCV1_Wrapper 0x29b0E6D2C2884aEa3FB4CB5dD1C7002A8E10c724 (BNB Chain only)
Contract / Chain Blast
MCV2_Token 0x1349A9DdEe26Fe16D0D44E35B3CB9B0CA18213a4
MCV2_MultiToken 0x5DaE94e149CF2112Ec625D46670047814aA9aC2a
MCV2_Bond 0x621c335b4BD8f2165E120DC70d3AfcAfc6628681
MCV2_ZapV1 0x06FD26c092Db44E5491abB7cDC580CE24D93030c
Locker 0x3Fd5B4DcDa968C8e22898523f5343177F94ccfd1
MerkleDistributor 0x29b0E6D2C2884aEa3FB4CB5dD1C7002A8E10c724
Contract / Chain Avalanche (C (C-Chain)-Chain)
MCV2_Token 0x5DaE94e149CF2112Ec625D46670047814aA9aC2a
MCV2_MultiToken 0x621c335b4BD8f2165E120DC70d3AfcAfc6628681
MCV2_Bond 0x3Fd5B4DcDa968C8e22898523f5343177F94ccfd1
MCV2_ZapV1 0x29b0E6D2C2884aEa3FB4CB5dD1C7002A8E10c724
Locker 0x5b64cECC5cF3E4B1A668Abd895D16BdDC0c77a17
MerkleDistributor 0x841A2bD2fc97DCB865b4Ddb352540148Bad2dB09
Contract / Chain Degen Chain
MCV2_Token 0xaF987E88bf30581F7074E628c894A3FCbf4EE12e
MCV2_MultiToken 0x91523b39813F3F4E406ECe406D0bEAaA9dE251fa
MCV2_Bond 0x3bc6B601196752497a68B2625DB4f2205C3b150b
MCV2_ZapV1 0x1349A9DdEe26Fe16D0D44E35B3CB9B0CA18213a4
Locker 0xF44939c1613143ad587c79602182De7DcF593e33
MerkleDistributor 0x5DaE94e149CF2112Ec625D46670047814aA9aC2a
Contract / Chain Zora Klaytn Cyber Ham
MCV2_Token 0xAa70bC79fD1cB4a6FBA717018351F0C3c64B79Df
MCV2_MultiToken 0x6c61918eECcC306D35247338FDcf025af0f6120A
MCV2_Bond 0xc5a076cad94176c2996B32d8466Be1cE757FAa27
MCV2_ZapV1 0x91523b39813F3F4E406ECe406D0bEAaA9dE251fa
Locker 0xA3dCf3Ca587D9929d540868c924f208726DC9aB6
MerkleDistributor 0x3bc6B601196752497a68B2625DB4f2205C3b150b
Contract / Chain Sepolia Testnet
MCV2_Token 0x749bA94344521727f55a3007c777FbeB5F52C2Eb
MCV2_MultiToken 0x3cABE5125C5D8922c5f38c5b779F6E96F563cdc0
MCV2_Bond 0x8dce343A86Aa950d539eeE0e166AFfd0Ef515C0c
MCV2_ZapV1 0x1Bf3183acc57571BecAea0E238d6C3A4d00633da
Locker 0x7c204B1B03A88D24088941068f6DFC809f2fd022
MerkleDistributor 0x0CD940395566d509168977Cf10E5296302efA57A
Contract / Chain Base Sepolia Testnet Blast Sepolia Testnet Cyber Testnet Over Testnet
MCV2_Token 0x37F540de37afE8bDf6C722d87CB019F30e5E406a
MCV2_MultiToken 0x4bF67e5C9baD43DD89dbe8fCAD3c213C868fe881
MCV2_Bond / MCV2_BlastBond 0x5dfA75b0185efBaEF286E80B847ce84ff8a62C2d
MCV2_ZapV1 0x40c7DC399e01029a51cAb316f8Bca7D20DE31bad
Locker 0x2c6B3fe4D6de27363cFEC95f703889EaF6b770fB
MerkleDistributor 0xCbb23973235feA43E62C41a0c67717a92a2467f2
Contract / Chain Avalanche Fu (C-Chain)ji Testnet
MCV2_Token 0xAD5a113ee65F30269f7558f96483126B1FB60c4E
MCV2_MultiToken 0xB43826E079dFB2e2b48a0a473Efc7F1fe6391763
MCV2_Bond 0x20fBC8a650d75e4C2Dab8b7e85C27135f0D64e89
MCV2_ZapV1 0x60432191893c4F742205a2C834817a1891feC435
Locker 0x789771E410527691729e54A84103594ee6Be6C3C
MerkleDistributor 0x6d1f4ecd17ddA7fb39C56Da566b66d63f06671d9

Bulk Sender

Chain / Contract Contract Address
Ethereum 0x621c335b4BD8f2165E120DC70d3AfcAfc6628681
Base 0x95BDA90196c4e737933360F4639c46Ace657AAb7
Optimism 0x3Fd5B4DcDa968C8e22898523f5343177F94ccfd1
Arbitrum One 0x841A2bD2fc97DCB865b4Ddb352540148Bad2dB09
Polygon (PoS) 0x29b0E6D2C2884aEa3FB4CB5dD1C7002A8E10c724
BNB Chain 0x3Fd5B4DcDa968C8e22898523f5343177F94ccfd1
Avalanche (C-Chain) 0x3a8a4BFCC487d0FE9D342B6180bf0323989f251B
Blast 0x9a176d09b3824cf50417e348696cBbBc43d7818d
Degen 0x7B09b728ee8c6a714dC3F10367b5DF9b217FE633
Zora 0xa4021a8907197Df92341F1218B32E26b250F6798
Klaytn 0xa4021a8907197Df92341F1218B32E26b250F6798
Cyber 0xa4021a8907197Df92341F1218B32E26b250F6798
Ham 0xa4021a8907197Df92341F1218B32E26b250F6798
Sepolia 0x7A6995CE649FA025a8792a375510d2B7C3c48581

Design Choices 📐

Discrete Bonding Curve (DBC)

Unlike Mint Club V1's linear bonding curve (y = x -> total supply = token price), the V2 contract uses a custom increasing price step array for the following reasons:

  1. Utilizing y = ax^b bonding curves is challenging to test because we have to use approximation to calculate the power function of (_baseN / _baseD) ^ (_expN / _expD) (Reference: Banchor's Bonding Curve implementation)
  2. Employing a single bonding curve is hard to customize. Supporting various types of curve functions (e.g., Sigmoid, Logarithm, etc) might be too difficult to implement in Solidity, or even impossible in many cases
  3. Therefore, we decided to use an array of price steps (called BondStep[] { rangeTo, price }), that is simple to calculate and fully customizable.

An example of a price step array:

image

Parameters example:

  • stepRanges: [ 1000, 10000, 500000, 1000000, ..., 21000000 ]
  • stepPrices: [ 0, 1, 2, 4, ..., 100 ]

Custom ERC20 Tokens as Reserve Tokens

Some ERC20 tokens incorporate tax or rebasing functionalities, which could lead to unforeseen behaviors in our Bond contract. For instance, a taxed token might result in the undercollateralization of the reserve token, preventing the complete refund of minted tokens from the bond contract. A similar scenario could occur with Rebase Tokens, as they are capable of altering the balance within the Bond contract.

Due to the diverse nature of custom cases, it is impractical for our bond contract to address all of them. Therefore, we have chosen not to handle these cases explicitly. It's important to note that any behavior stemming from the custom ERC20 token is not considered a bug, as it is a consequence of the token's inherent code.

We plan to issue warnings on our official front-end for tokens known to potentially disrupt our bond contract. However, it's crucial for users to conduct their own research and understand the potential implications of selecting a specific reserve token.

The same issue applies to the Locker and MerkleDistributor tools, and appropriate warning messages will be provided on the front-end client.

Run Tests 🧪

npx hardhat test

Coverage ☂️

--------------------------|----------|----------|----------|----------|----------------|
File                      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
--------------------------|----------|----------|----------|----------|----------------|
 contracts/               |    97.05 |    78.74 |    91.89 |    96.33 |                |
  BulkSender.sol          |      100 |    84.62 |      100 |    97.87 |             74 |
  Locker.sol              |     97.5 |    84.09 |    85.71 |    98.21 |            107 |
  MCV2_BlastBond.sol      |        0 |        0 |        0 |        0 |... 56,57,61,65 |
  MCV2_Bond.sol           |     99.4 |    80.56 |     96.3 |    99.05 |        348,717 |
  MCV2_MultiToken.sol     |      100 |    58.33 |      100 |      100 |                |
  MCV2_NFTDistributor.sol |      100 |       50 |      100 |    84.21 |       31,39,47 |
  MCV2_Royalty.sol        |      100 |    92.86 |      100 |      100 |                |
  MCV2_Token.sol          |      100 |       50 |      100 |      100 |                |
  MCV2_ZapV1.sol          |    94.74 |    52.63 |      100 |    95.12 |          89,90 |
  MerkleDistributor.sol   |    98.39 |    82.81 |    92.31 |    98.81 |            257 |
  MerkleDistributorV2.sol |     98.8 |    91.18 |    95.45 |    96.18 |... 164,291,414 |
 contracts/interfaces/    |      100 |      100 |      100 |      100 |                |
  IBulkSender.sol         |      100 |      100 |      100 |      100 |                |
  IMCV2_Bond.sol          |      100 |      100 |      100 |      100 |                |
  IMintClubBond.sol       |      100 |      100 |      100 |      100 |                |
  IWETH.sol               |      100 |      100 |      100 |      100 |                |
  MCV2_ICommonToken.sol   |      100 |      100 |      100 |      100 |                |
 contracts/lib/           |        0 |        0 |        0 |        0 |                |
  WDEGEN.sol              |        0 |        0 |        0 |        0 |... 74,75,77,79 |
--------------------------|----------|----------|----------|----------|----------------|
All files                 |    94.26 |    77.29 |    86.44 |    93.47 |                |
--------------------------|----------|----------|----------|----------|----------------|

Deploy 🚀

npx hardhat compile && HARDHAT_NETWORK=ethsepolia node scripts/deploy.js

Gas Consumption ⛽️

·-----------------------------------------------------|---------------------------|---------------|-----------------------------·
|                Solc version: 0.8.20                 ·  Optimizer enabled: true  ·  Runs: 50000  ·  Block limit: 30000000 gas  │
······················································|···························|···············|······························
|  Methods                                                                                                                      │
························|·····························|·············|·············|···············|···············|··············
|  Contract             ·  Method                     ·  Min        ·  Max        ·  Avg          ·  # calls      ·  usd (avg)  │
························|·····························|·············|·············|···············|···············|··············
|  BulkSender           ·  sendERC1155                ·          -  ·          -  ·       169298  ·            3  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  BulkSender           ·  sendERC20                  ·          -  ·          -  ·       154771  ·            3  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  BulkSender           ·  updateFeePerRecipient      ·          -  ·          -  ·        26928  ·            1  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  BulkSender           ·  updateProtocolBeneficiary  ·          -  ·          -  ·        27170  ·            1  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  Locker               ·  createLockUp               ·     118371  ·     177007  ·       147544  ·           40  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  Locker               ·  unlock                     ·      65465  ·      66722  ·        66024  ·            9  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  burn                       ·      95828  ·     130648  ·       118254  ·           43  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  burnRoyalties              ·          -  ·          -  ·        79831  ·            1  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  claimRoyalties             ·          -  ·          -  ·        80107  ·            3  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  createMultiToken           ·     394070  ·     495607  ·       489206  ·          104  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  createToken                ·     299237  ·     521942  ·       495817  ·          147  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  mint                       ·     109458  ·     208974  ·       189745  ·          104  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  updateBondCreator          ·      26250  ·      29062  ·        28283  ·           15  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  updateCreationFee          ·      46917  ·      46929  ·        46924  ·            5  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  updateMaxRoyaltyRange      ·          -  ·          -  ·        29763  ·            2  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Bond            ·  updateProtocolBeneficiary  ·          -  ·          -  ·        30050  ·            1  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_MultiToken      ·  safeTransferFrom           ·          -  ·          -  ·        37867  ·            1  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_MultiToken      ·  setApprovalForAll          ·          -  ·          -  ·        48812  ·           26  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_NFTDistributor  ·  createAndDistribute        ·          -  ·          -  ·       628771  ·            4  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Token           ·  approve                    ·      48964  ·      49312  ·        49220  ·           36  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_Token           ·  transfer                   ·          -  ·          -  ·        32280  ·            1  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_ZapV1           ·  burnToEth                  ·     164215  ·     169230  ·       166723  ·           12  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_ZapV1           ·  mintWithEth                ·     207024  ·     210787  ·       208906  ·           24  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MCV2_ZapV1           ·  rescueETH                  ·          -  ·          -  ·        34679  ·            2  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributor    ·  claim                      ·      91708  ·      97812  ·        95785  ·           30  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributor    ·  createDistribution         ·     140046  ·     203822  ·       188786  ·           69  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributor    ·  refund                     ·      47624  ·      48934  ·        48279  ·            8  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributorV2  ·  claim                      ·      91871  ·     134678  ·        99511  ·           30  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributorV2  ·  createDistribution         ·     209647  ·     260947  ·       215024  ·          711  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributorV2  ·  refund                     ·      47590  ·      48912  ·        48251  ·            8  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributorV2  ·  updateClaimFee             ·          -  ·          -  ·        29724  ·            3  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  MerkleDistributorV2  ·  updateProtocolBeneficiary  ·          -  ·          -  ·        30049  ·            3  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  TaxToken             ·  approve                    ·          -  ·          -  ·        46634  ·            4  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  TaxToken             ·  transfer                   ·          -  ·          -  ·        54349  ·            4  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  TestMultiToken       ·  safeTransferFrom           ·      52224  ·      52370  ·        52365  ·           29  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  TestMultiToken       ·  setApprovalForAll          ·      24202  ·      46114  ·        45517  ·           70  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  TestToken            ·  approve                    ·      24327  ·      46611  ·        46074  ·          264  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  TestToken            ·  transfer                   ·      34354  ·      51514  ·        49248  ·          205  ·          -  │
························|·····························|·············|·············|···············|···············|··············
|  Deployments                                        ·                                           ·  % of limit   ·             │
······················································|·············|·············|···············|···············|··············
|  BulkSender                                         ·          -  ·          -  ·       962930  ·        3.2 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  Locker                                             ·          -  ·          -  ·      1311359  ·        4.4 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  MCV2_Bond                                          ·    4849157  ·    4869081  ·      4852482  ·       16.2 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  MCV2_MultiToken                                    ·          -  ·          -  ·      1955155  ·        6.5 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  MCV2_NFTDistributor                                ·          -  ·          -  ·       905348  ·          3 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  MCV2_Token                                         ·          -  ·          -  ·       858512  ·        2.9 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  MCV2_ZapV1                                         ·    1466694  ·    1466706  ·      1466700  ·        4.9 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  MerkleDistributor                                  ·          -  ·          -  ·      2053503  ·        6.8 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  MerkleDistributorV2                                ·          -  ·          -  ·      3173736  ·       10.6 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  TaxToken                                           ·          -  ·          -  ·       736527  ·        2.5 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  TestMultiToken                                     ·    1482000  ·    1482024  ·      1482018  ·        4.9 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  TestToken                                          ·     659419  ·     679719  ·       678837  ·        2.3 %  ·          -  │
······················································|·············|·············|···············|···············|··············
|  WETH9                                              ·          -  ·          -  ·       799725  ·        2.7 %  ·          -  │
·-----------------------------------------------------|-------------|-------------|---------------|---------------|-------------·

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published