emergencyWithdrawERC20
function. The function allows the contract owner to withdraw a particular amount from the contract balance incase of an emergency Normally there should be check to keep track of the amount of withdrawable tokens.
But instead, the function did not verify whether the contract has enough balance of token to withdraw before calling the token.safeTransfer(_to, _amount)
. If _amount is greater than the contract’s balance, the transfer will fail, reverting the that particular transaction.
Likelihood:
This will happen whenever the contract owner calls the emergencyWithdrawERC20
function and inputs an amount greater than the contract balance.
Impact:
The impact will be that the entire transaction will be reverted
I initiated the contract with only 1 token.
Then attempted to withdraw 10 tokens.
Since the contract did check the balance, it reverts due to insufficient funds.
The expectRevert() line confirms that the function will terminate, leading to DoS of the protocol
Add a simple balance check before attempting the transfer
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.