Hawk High

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

Incorrect Salary Distribution Logic in graduateAndUpgrade

Summary The current logic allocates 35% of the bursary to each teacher instead of distributing 35% collectively among all teachers.

Vulnerability Details in LevelOne.sol file

uint256 payPerTeacher = (bursary * TEACHER_WAGE) / PRECISION;

the code shows that payPerTeacher = ( bursary * 35 ) /100, but that is only correct when there's one teacher.

Impact Teacher won't get pay correctly. Tf there's three teacher. it even results in overpayment, exceeding the total bursary. (105% payment to the teachers)

Tools Used manul review

Recommendations Adjust the logic to divide 35% of the bursary equally among all teachers :

uint256 payPerTeacher = (bursary * TEACHER_WAGE) / (PRECISION*totalTeachers);
Updates

Lead Judging Commences

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

incorrect teacher pay calculation

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

yeahchibyke Lead Judge 3 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.