In the graduateAndUpgrade function, the teacher payment is calculated as (bursary * TEACHER_WAGE) / PRECISION and applied to each teacher individually. This does not split the teacher wage among all teachers, causing the total payment to exceed the bursary when there are multiple teachers, leading to transaction failure.
The current code defines:
Where TEACHER_WAGE is 35 and PRECISION is 100, meaning each teacher receives 35% of the bursary. The function then transfers this amount to each teacher:
For example:
1 teacher: 35% (teachers) + 5% (principal) = 40% of bursary
2 teachers: 70% (teachers) + 5% (principal) = 75% of bursary
3 teachers: 105% (teachers) + 5% (principal) = 110% of bursary
With three or more teachers, the total exceeds 100%, causing the safeTransfer to revert due to insufficient funds.
add thos test to LevelOneAndGraduateTest:
The graduateAndUpgrade function fails with three or more teachers, halting fund distribution and contract upgrades.
Funds may remain locked in the contract, leading to potential financial loss.
Adjust the payment logic to distribute the teacher wage among all teachers.
`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.
`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.