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

Configurable BucketAuction #43

Closed me-gozer closed 1 year ago

me-gozer commented 1 year ago

This PR adds the support to enable the bucket auction for a duration whose start and end times are specified with parameters to the constructor. Removed activeStage; and the functions relies on the activeStage are now checking the bucket.timestamp to find out the active stage.

Useful information on the contract changes:

  1. BucketAuction constructor takes two new parameters for the start and end time of the auction.
  2. The private property activeStage and its getters/setters were removed. The dependent functions derive this info by checking the bucket.timestamp.
  3. The modifier cannotMint were removed from the BucketAuction::bid and setPrice.
  4. From now on the setPrice can not be called after the first token is sent; added a private property and modifier for it.
  5. The function ERC721M:canMint assumes the stageTimestamp is block.timestamp unless a timestamp and valid cosigner were specified.

Useful information on the script changes:

  1. Created the common/constants to be used by all scripts
  2. Added a new script to deploy the bucket auction: deployBA

Useful information on the test changes:

  1. Updated the existing test cases affected by the contract changes.
  2. Added new test cases to cover the new contract changes.

Test Coverage:

File % Stmts % Branch % Funcs % Lines Uncovered Lines
contracts/ 98.98 88.56 97.47 98.51
BucketAuction.sol 98.41 88.75 96.55 97.67 62,63
DutchAuction.sol 100 88.64 100 100
ERC721M.sol 98.77 90.2 97.22 98.28 58,59
ERC721MCallback.sol 100 70 100 100
IBucketAuction.sol 100 100 100 100
IDutchAuction.sol 100 100 100 100
IERC721M.sol 100 100 100 100
IERC721MCallback.sol 100 100 100 100
contracts/mocks/ 76.92 50 87.5 80
TestReentrantExploit.sol 75 100 100 80 35
TestStaking.sol 77.78 50 80 80 25,26
--------------------------- ---------- ---------- ---------- ---------- ----------------
All files 97.62 87.92 96.55 97.54
channing-magiceden commented 1 year ago

Can you run coverage and paste the coverage report in PR description?