Description
When the Godfather tries to withdraw USDC from the MoneyVault the call to CrimeMoney::burnwill fail due to the modifier on the burn function requiring the moneyshelf role.
Impact
Funds cannot be withdrawn from the MoneyVault by the GodFather which contradicts the documentation:
MoneyVault:
Only the GodFather can withdraw and no one can deposit in this contract.
Proof of Concept
File: MoneyVault.sol
Reformatted for clarity:
The call to crimeMoney.burn(account, amount); will fail, this will cause a revert; the withdraw(account, amount) will be unwound and the transfer will not be executed.
As shown below, the moneyshelf role is required to call the burn function.
File: CrimeMoney.sol
Reformatted for clarity:
File: CrimeMoney.sol
Reformatted for clarity and comments removed
As you can see in the code snippets above the migrate function does not grant the moneyshelf role to the moneyVault address, and the burn function uses the modifier onlyMoneyShelf.
Recommended mitigation
Note: This code is indicative of one possible solution, it must not be considered production ready code.
Add a new modifier to support MoneyVault calling CrimeMoney::burn.
File: CrimeMoney.sol
Update the CrimeMoney::burn function to use the new modifier
File: CrimeMoney.sol
Grant the new moneyvault role to the MoneyVault in the EmergencyMigration script.
File: EmergencyMigration.s.sol
References
N/A
Tools Used
Manual Review
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.