Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Incorrect Payment Distribution in graduateAndUpgrade

Summary

Incorrect teacher payment calculation overpays teachers and fails to retain 60% of the bursary.

Vulnerability Details

The graduateAndUpgrade function in LevelOne.sol calculates payPerTeacher as (bursary * TEACHER_WAGE) / PRECISION (35%) and transfers this amount to each teacher. With multiple teachers, the total payout exceeds 35%, violating the invariant that teachers should share 35% of the bursary. Additionally, the remaining 60% is not explicitly retained in bursary.

Impact

Leads to financial loss and incorrect bursary balance post-upgrade.

Tools Used

Manual code review and simulated calculations.

Recommendations

Calculate total teacher pay as (bursary * TEACHER_WAGE) / PRECISION, divide by the number of teachers, and update bursary to (bursary * 60) / PRECISION after transfers.

Updates

Lead Judging Commences

yeahchibyke Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

incorrect teacher pay calculation

`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.