Description: Some tokens (like USDT) do not work when changing the allowance from a non-zero value. For example, Tether (USDT)'s approve() function will revert if the current approval is not zero to protect against front-running attacks on approval changes.
The updateVaultAssetAllowance
function updates the asset allowance for a specific vault and is called by the contract owner. The new asset allowance amount is set for the vault's index token:
The updateAssetAllowance
function in ZlpVault is used to increase the allowance:
Impact: Since updateVaultAssetAllowance
is used to update the allowance for a specific vault, if the transaction fails due to an existing non-zero allowance, it may prevent updates to the vault's allowance, potentially disrupting market-making operations.
Recommendation: The function should first set the allowance to 0 before making the actual approval call. This follows best practices for ERC-20 token approvals and prevents potential reversion issues.
Consider using OpenZeppelin’s safeApprove function to ensure compatibility with all tokens.
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.