Closed madeinfree closed 2 years ago
Hi, @elie222 I think all the test coverage is done, if any suggestions please let me know, I'd happy to help. and this PR install the hardhat gas-report plugin and add a script for it, thank you!
> npx hardhat test
ERC721RExample
✔ [Check] Check maxMintSupply = 8000
✔ [Check] Check mintPrice = 0.1
✔ [Check] Check refundPeriod 3888000
✔ [Check] Check maxUserMintAmount 5
✔ [Check] Check refundEndTime is same with block timestamp in first deploy
✔ [Check] Check refundGuaranteeActive = true
✔ Should be able to deploy
✔ Should be able to mint and request a refund (76ms)
✔ [OwnerMint] Should able to mint
✔ [PublicMint:Revert] Should not be able to mint when `Public sale is not active` (54ms)
✔ [PublicMint:Revert] Should not be able to mint when `Not enough eth sent`
✔ [PublicMint:Revert] Should not be able to mint when `Max mint supply reached`
✔ [PublicMint:Revert] Should not be able to mint when `Over mint limit`
✔ [PreSaleMint:Revert] Should not presale mint when `Not on allow list`
✔ [PreSaleMint] Should presale mint merkle tree with valid leaf (43ms)
✔ [PreSaleMint:Revert] Should not be mint when `Presale is not active`
✔ [PreSaleMint:Revert] Should not be mint when `Value` not enough
✔ [PreSaleMint:Revert] Should not be mint when `Max amount` (48ms)
✔ [PreSaleMint:Revert] Should not be mint when `Max mint supply`
✔ [Refund] Check hasRefunded store correct tokenId (51ms)
✔ [Refund:Revert] Should not be refunded when `Not token owner`
✔ [Refund:Revert] `Freely minted NFTs cannot be refunded`
✔ [Refund:Revert] NFT cannot be refunded twice `Already refunded` (73ms)
✔ [Refund] NFT refund should in 45 days (44ms)
✔ [Refund:Revert] NFT refund expired after 45 days `Refund expired`
✔ [Owner:Revert] Owner should not be able to mint when `Max mint supply reached`
✔ [Owner:Revert] Owner can not withdraw when `Refund period not over`
✔ [Owner] Owner can withdraw after refundEndTime
✔ [Toggle] Owner can call toggleRefundCountdown and refundEndTime add `refundPeriod` days.
✔ [Toggle] Owner can call togglePresaleStatus
✔ [Toggle] Owner can call togglePublicSaleStatus
✔ [Setter] Owner can call setRefundAddress
✔ [Setter] Owner can call setMerkleRoot
33 passing (4s)
Awesome PR! Really helpful :)
@elie222 thank you for quick reply and suggestions, I'll update it soon.
@elie222 I updated the hardcode test and using the merkletreejs, and I move merkletree function to scripts
folder, what do you think ? thank you for your reply ~
Left a few more comments. Some minor stylistic issues
@elie222 thank you, I updated and checked all test hardcode address, merkle tree and some stylistic issue, rebase the main branch, using new contract method and fixed some unnecessary code.
thanks. you didn't want to use describe blocks instead of starting each test with something like this:
[PublicMint:Revert]
?
I just merged in in any case but maybe the describe blocks approach would be cleaner naming wise
Ok, I'll update later and create a new PR!
Maybe ready.
TODO LIST
Max mint supply reached
Over mint limit
Max mint supply reached
Public sale is not active
Not enough eth sent
Presale is not active
Value
Max amount
Max mint supply
Refund expired
Not token owner
Already refunded
Freely minted NFTs cannot be refunded
Refund period not over