Wenwin contest - Bason's results

The next generation of chance-based gaming.

General Information

Platform: Code4rena

Start Date: 06/03/2023

Pot Size: $36,500 USDC

Total HM: 8

Participants: 93

Period: 3 days

Judge: cccz

Total Solo HM: 3

Id: 218

League: ETH

Wenwin

Findings Distribution

Researcher Performance

Rank: 75/93

Findings: 1

Award: $21.70

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

21.7018 USDC - $21.70

Labels

bug
grade-b
QA (Quality Assurance)
sponsor confirmed
Q-35

External Links

Low and Non-Critical Issues Summary

NumberIssues Details
[L-01]MISSING EVENT FOR CRITICAL PARAMETER CHANGE
[NC-01]Use latest Solidity version
[NC-02]Use stable pragma statement
[NC-03]Different pragma directives are used
[NC-04]Use named imports instead of plain import FILE.SOL
[NC-05]In all solidity files, license keyword should be mentioned
[NC-06]Constants should be defined rather than using magic numbers
[NC-07]Add NatSpec documentation
[NC-08]You can use named parameters in mapping types

[L-01] MISSING EVENT FOR CRITICAL PARAMETER CHANGE

Emitting events allows monitoring activities with off-chain monitoring tools.

Lottery.sol 110: function buyTickets( 170: function claimWinningTickets(uint256[] calldata ticketIds) external override returns (uint256 claimedAmount) {

[NC-01] Use latest Solidity version

Solidity pragma versioning should be upgraded to latest available version.

VRFv2RNSource.sol pragma solidity ^0.8.7;

[NC-02] Use stable pragma statement

Using a floating pragma statement ^0.8.7 is discouraged as code can compile to different bytecodes with different compiler versions. Use a stable pragma statement to get a deterministic bytecode.


[NC-03] Different pragma directives are used

Use one Solidity version on each contract.


[NC-04] USE NAMED IMPORTS INSTEAD OF PLAIN IMPORT FILE.SOL

Recommendation: `import {contract1 , contract2} from "filename.sol";


[NC-05] In all solidity files, license keyword should be mentioned


[NC-06] Constants should be defined rather than using magic numbers

LotterySetup.sol
36: uint256 private constant BASE_JACKPOT_PERCENTAGE = 30_030
51: if (lotterySetupParams.selectionMax >= 120) {
55: lotterySetupParams.expectedPayout < lotterySetupParams.ticketPrice / 100
61: lotterySetupParams.selectionSize > 16
81: jackpotBound = 2_000_000 * tokenUnit;
126: uint256 mask = uint256(type(uint16).max) << (winTier * 16);
127: uint256 extracted = (nonJackpotFixedRewards & mask) >> (winTier * 16);

ReferralSystem.sol
117: if (totalTicketsSoldPrevDraw < 10_000) {
121: if (totalTicketsSoldPrevDraw < 100_000) {
123: return totalTicketsSoldPrevDraw.getPercentage(PercentageMath.ONE_PERCENT * 75 / 100);
125: (totalTicketsSoldPrevDraw < 1_000_000) {
127: return totalTicketsSoldPrevDraw.getPercentage(PercentageMath.ONE_PERCENT * 50 / 100);

[NC-07] Add NatSpec documentation

NatSpec documentation to all public/external functions and variables is essential for better understanding of the code by developers and auditors and is strongly recommended.


[NC-08] You can use named parameters in mapping types

From Solidity 0.8.18 you can use named parameters in mapping types. This will make the code much more readable.

#0 - thereksfour

2023-03-12T10:33:45Z

1 L 3 INFO 5 NC

#1 - c4-judge

2023-03-12T10:33:51Z

thereksfour marked the issue as grade-b

#2 - c4-sponsor

2023-03-14T11:17:39Z

0xluckydev marked the issue as sponsor confirmed

#3 - 0xluckydev

2023-03-14T11:17:47Z

Low importance. First one is not valid since register emits an event. Same with the second function.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter