In LevelOne.sol#graduateAndUpgrade, USDC tokens are transferred for wages, but the bursary state variable is not decremented to reflect these payments. The README specifies that the "remaining 60% should reflect in the bursary after upgrade".
The graduateAndUpgrade function calculates principalPay and payPerTeacher (which should be totalTeacherShare), transfers these amounts, but does not subtract them from the bursary state variable.
The bursary variable in storage becomes an inaccurate representation of the actual USDC funds managed by the contract after wage payouts. If LevelTwo (after fixing storage layout issues) relies on this bursary variable, it would be operating with a stale, inflated value. This violates the invariant about the remaining 60% reflecting in the bursary.
Manual Review, Comparison with README specifications.
After calculating principalPay and the total payout to teachers (totalTeacherShare), and before the upgrade call (or at least before the end of the function), update the bursary state variable:
bursary = bursary - principalPay - totalTeacherShare;
This ensures the bursary variable correctly reflects the remaining funds (intended to be 60%).
(The code modification for this is combined with H-02, H-03, and H-04 fixes in the graduateAndUpgrade function shown under H-04.)
Consolidated Code Modification for LevelOne.sol::graduateAndUpgrade (addressing H-02, H-03, H-04, L-03):
The bursary is not updated after wages have been paid in `graduateAndUpgrade()` function
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.