LevelOne::graduateAndUpgrade
is incorrect, causing the payment to be incorrectDescription: As described in the documentation, the payment should be calculated as follows:
Principal - 5% of bursary
Teachers - share 35% of bursary
The remainig 60% is left in the bursary
Impact: Calculations in LevelOne::graduateAndUpgrade
are incorrect, causing usdc payment to be mishandled
Proof of Concepts:
6 students enter with 5 000 USDC fee each. That brings 30 000 USDC to the bursary.
There is 1 principal and 2 teachers
Given then the bursary is split as follows:
Principal - 5% of bursary = 1 500 USDC
Teachers - share 35% of bursary = 10 500 USDC total or 5 250 each
Bursary should be left with 18 000
After adding logs to LevelOne::graduateAndUpgrade
we get the following:
As we can see, principal is calculated correctly, pay per teacher is incorrect, which is the total sum for all teachers but its called payPerTeacher
and bursary is never updated, leading future upgrades to calculate incorrecly wages.
Recommended mitigation:
Given the invariants, we recommend to update LevelOne::graduateAndUpgrade
as follows:
And running the previous test now give:
`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.