Hawk High

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

[EVMN-HH06] Incorrect Teacher Payment Calculation

Summary

Incorrect Teacher Payment Calculation

Vulnerability Details

The teacher payment calculation is incorrect. The current implementation calculates the total percentage for teachers but doesn't divide it among the teachers correctly:

uint256 payPerTeacher = (bursary * TEACHER_WAGE) / PRECISION;

Impact

High (High Impact, High Likelihood)

Tools Used

Manual review.

Recommendations

Fix the payment calculation to properly distribute among teachers:

// Calculate total teacher payment
uint256 totalTeacherPay = (bursary * TEACHER_WAGE) / PRECISION;
// Only proceed with payments if there are teachers
uint256 payPerTeacher = 0;
if (totalTeachers > 0) {
payPerTeacher = totalTeacherPay / totalTeachers;
for (uint256 n = 0; n < totalTeachers; n++) {
usdc.safeTransfer(listOfTeachers[n], payPerTeacher);
}
}
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.