me-foundation / magicdrop

MagicDrop is a collection of EVM minting protocols that enable the multi stage minting, per stage WL management, per stage supply limit, and crossmint support.
MIT License
54 stars 37 forks source link

feat: downsize contracts #101

Open matheus1lva opened 10 months ago

matheus1lva commented 10 months ago
  1. simplify contract to downsize

    ·---------------------------------------|--------------------------------|--------------------------------·
    |  Solc version: 0.8.16                 ·  Optimizer enabled: true       ·  Runs: 200                     │
    ········································|································|·································
    |  Contract Name                        ·  Deployed size (KiB) (change)  ·  Initcode size (KiB) (change)  │
    ········································|································|·································
    |  Address                              ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  BucketAuction                        ·                19.020 (0.000)  ·                20.373 (0.000)  │
    ········································|································|·································
    |  BucketAuctionOperatorFilterer        ·                20.019 (0.000)  ·                21.734 (0.000)  │
    ········································|································|·································
    |  BytesLib                             ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  DutchAuction                         ·                16.440 (0.000)  ·                17.700 (0.000)  │
    ········································|································|·································
    |  ECDSA                                ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  EnumerableSet                        ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  ERC20                                ·                 2.121 (0.000)  ·                 2.859 (0.000)  │
    ········································|································|·································
    |  ERC721                               ·                 4.261 (0.000)  ·                 4.999 (0.000)  │
    ········································|································|·································
    |  ERC721A                              ·                 3.334 (0.000)  ·                 4.076 (0.000)  │
    ········································|································|·································
    |  ERC721M                              ·                14.456 (0.000)  ·                15.698 (0.000)  │
    ········································|································|·································
    |  ERC721MAutoApprover                  ·                14.694 (0.000)  ·                15.994 (0.000)  │
    ········································|································|·································
    |  ERC721MIncreasableOperatorFilterer   ·                15.747 (0.000)  ·                17.387 (0.000)  │
    ········································|································|·································
    |  ERC721MIncreasableSupply             ·                14.748 (0.000)  ·                16.027 (0.000)  │
    ········································|································|·································
    |  ERC721MLite                          ·                13.948 (0.000)  ·                15.419 (0.000)  │
    ········································|································|·································
    |  ERC721MOnft                          ·                23.708 (0.000)  ·                25.406 (0.000)  │
    ········································|································|·································
    |  ERC721MOperatorFilterer              ·                15.455 (0.000)  ·                17.039 (0.000)  │
    ········································|································|·································
    |  ERC721MOperatorFiltererAutoApprover  ·                15.712 (0.000)  ·                17.363 (0.000)  │
    ········································|································|·································
    |  ERC721MPausable                      ·                14.949 (0.000)  ·                16.218 (0.000)  │
    ········································|································|·································
    |  ERC721MPausableOperatorFilterer      ·                15.948 (0.000)  ·                17.577 (0.000)  │
    ········································|································|·································
    |  ExcessivelySafeCall                  ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  MerkleProof                          ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  MockERC20                            ·                 2.384 (0.000)  ·                 2.934 (0.000)  │
    ········································|································|·································
    |  MockLayerZeroEndpoint                ·                 2.150 (0.000)  ·                 2.182 (0.000)  │
    ········································|································|·································
    |  ONFT721Lite                          ·                15.771 (0.000)  ·                16.822 (0.000)  │
    ········································|································|·································
    |  SafeERC20                            ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  SignatureChecker                     ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  Strings                              ·                 0.084 (0.000)  ·                 0.138 (0.000)  │
    ········································|································|·································
    |  TestReentrantExploit                 ·                 1.077 (0.000)  ·                 1.221 (0.000)  │
    ········································|································|·································
    |  TestStaking                          ·                 1.377 (0.000)  ·                 1.521 (0.000)  │
    ·---------------------------------------|--------------------------------|--------------------------------·
  2. Simplify removing updateStages where setStages has basically the same functionality.

  3. Move some setters directly to constructor since some are rarely updated after deployment, saving some bytes

  4. remove intermediary variable definitions

  5. simplify withdraw and withdrawERC20 into single one

  6. remove some more unused methods

There are some tests failing in regards to cosign, which needs a bit of work because i was not able to find the root cause.

channing-magiceden commented 10 months ago

Since you changed most contracts' constructor, you should also update scritps/deployXXX.ts and update hardhat.config.ts to require extra params

matheus1lva commented 9 months ago

Since you changed most contracts' constructor, you should also update scritps/deployXXX.ts and update hardhat.config.ts to require extra params

updating now.