Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lottery tests and align design to factory #41

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

pablin-dev
Copy link
Collaborator

@pablin-dev pablin-dev commented Dec 19, 2024

Ran 9 tests for test/apps/lazy721.t.sol:Lazy721Test
[PASS] testFuzz_Mint(string) (runs: 50, μ: 1638773, ~: 1648994)
[PASS] testFuzz_Mint(uint16) (runs: 50, μ: 1065191502, ~: 475191713)
[PASS] testInitializeState() (gas: 24497)
[PASS] testRevertWhenNonOwnerMints() (gas: 15650)
[PASS] testRevertWhenQueryNonexistentToken() (gas: 13399)
[PASS] testRevertWhenTokenCapExceed() (gas: 571039)
[PASS] testSafeMint() (gas: 304948)
[PASS] test_SupportsInterface() (gas: 10969)
[PASS] test_TokenURI() (gas: 301973)
Suite result: ok. 9 passed; 0 failed; 0 skipped; finished in 11.65s (11.66s CPU time)

Ran 1 test suite in 11.66s (11.65s CPU time): 9 tests passed, 0 failed, 0 skipped (9 total tests)
Ran 9 tests for test/apps/lazy721a.t.sol:Lazy721ATest
[PASS] testFuzz_Mint_Name(string) (runs: 50, μ: 1151349, ~: 1131951)
[PASS] testFuzz_Mint_Quantity(uint16,string) (runs: 300, μ: 15225689, ~: 6980783)
[PASS] testInitializeState() (gas: 26317)
[PASS] testRevertWhenNonOwnerMints() (gas: 15687)
[PASS] testRevertWhenQueryNonexistentToken() (gas: 13293)
[PASS] testRevertWhenTokenCapExceed() (gas: 165483)
[PASS] testSafeMint() (gas: 145661)
[PASS] test_SupportsInterface() (gas: 10786)
[PASS] test_TokenURI() (gas: 145072)
Suite result: ok. 9 passed; 0 failed; 0 skipped; finished in 843.05ms (847.63ms CPU time)

Ran 1 test suite in 843.70ms (843.05ms CPU time): 9 tests passed, 0 failed, 0 skipped (9 total tests)
Ran 9 tests for test/apps/lazy1155.t.sol:Lazy1155Test
[PASS] testFuzz_BatchMint(uint16) (runs: 10, μ: 2528391, ~: 2528391)
[PASS] testFuzz_Mint(uint16) (runs: 10, μ: 222447612, ~: 171248719)
[PASS] testInitializeState() (gas: 14431)
[PASS] testRevertWhenNonOwnerMints() (gas: 16273)
[PASS] testRevertWhenQueryNonexistentToken() (gas: 16347)
[PASS] testRevertWhenTokenCapExceed() (gas: 111656)
[PASS] test_SupportsInterface() (gas: 11032)
[PASS] test_TokenURI() (gas: 202961)
[PASS] testmint() (gas: 129792)
Suite result: ok. 9 passed; 0 failed; 0 skipped; finished in 946.79ms (957.28ms CPU time)

Ran 1 test suite in 947.28ms (946.79ms CPU time): 9 tests passed, 0 failed, 0 skipped (9 total tests)
Ran 4 tests for test/apps/lottery.t.sol:LotteryTest
[PASS] testFail_Draw_Guess(uint8) (runs: 50, μ: 52667, ~: 52667)
[PASS] testFuzz_Draw_Always_Loose(uint8) (runs: 300, μ: 228565, ~: 229428)
[PASS] testFuzz_Draw_Always_Win(uint8) (runs: 300, μ: 224430, ~: 224430)
[PASS] testFuzz_Draw_Withdraw(uint8) (runs: 300, μ: 225243, ~: 225243)
Suite result: ok. 4 passed; 0 failed; 0 skipped; finished in 27.82ms (79.63ms CPU time)

Ran 1 test suite in 28.31ms (27.82ms CPU time): 4 tests passed, 0 failed, 0 skipped (4 total tests)
Ran 1 test for test/apps/factory/lotteryFactory.t.sol:LotteryFactoryTest
[PASS] testFuzz_Draw_Always_Win_lottery_1155(uint8) (runs: 300, μ: 3768, ~: 3768)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 7.43ms (6.32ms CPU time)

Ran 1 test suite in 7.85ms (7.43ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)
$ hardhat test


  Lottery
    Draw
      ✔ Player draw successful First Prize
      ✔ Player draw successful All Prizes (64ms)
      ✔ Player draw successful Second Prize
      ✔ Player draw successful Third Prize
      ✔ Player draw successful Four Prize
      ✔ Player draw fail


  6 passing (898ms)

@pablin-dev pablin-dev self-assigned this Dec 20, 2024
Copy link
Collaborator

@PsychoPunkSage PsychoPunkSage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@@ -24,7 +24,6 @@ abstract contract NFTLotteryFactory is INFTLotteryFactory {
address nftContract,
address decrypter,
uint256 fee,
uint8 threshold,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmm...
Is there any reason to remove the threshold param from the function signature?? Cause it is required at the time of deployment of lottery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants