The graduateAndUpgrade
function incorrectly allocates the entire 35% teacher wage budget to each individual teacher, rather than dividing it evenly among all teachers. This results in a substantial overpayment that violates the intended distribution logic, potentially causing the contract to disburse more funds than are available or budgeted.
The graduateAndUpgrade
function is designed to distribute a fixed percentage of the bursary
to teachers and the principal. However, there is a critical miscalculation in how teacher compensation is determined. The TEACHER_WAGE
constant represent of 35% of the total schoolFees
is used to compute the payPerTeacher
without dividing the total teacher share by the number of teachers.
As a result, each teacher receives 35% of the bursary, rather than dividing the 35% equally among all teachers. This causes the total payout to teachers to exceed the intended budget, leading to an overpayment and a potential depletion of contract funds.
This code demonstrates that each teacher receives 35% of the total funds, instead of receiving an individual share from the 35% allocated to all teachers.
If multiple teachers are present, the contract may attempt to transfer more funds than it holds, potentially causing transaction failures due to insufficient balance.
Manual Review
The payPerTeacher
calculation should be modified so that the total 35% portion of the bursary is first calculated, and then evenly divided among all teachers in the list. Here's an example implementation of the corrected logic:
`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.