You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Locker:initializeCollection() will revert due to arithmetic underflow
Summary
Locker:initializeCollection() will revert due to arithmetic underflow
Vulnerability Detail
Locker:initializeCollection() refund any unused relative token to the user, but the problem is instead of writing finalBalance - startBalance, it uses startBalance - finalBalance
function initializeCollection(address_collection, uint_eth, uint[] calldata_tokenIds, uint_tokenSlippage, uint160_sqrtPriceX96) publicvirtual whenNotPaused collectionExists(_collection) {
//// Refund any unused relative token to the user
nativeToken.transfer(
msg.sender,
> startBalance - nativeToken.balanceOf(address(this))
);
}
if there is any refund, it will revert the transaction due to arithmetic underflow
The text was updated successfully, but these errors were encountered:
sherlock-admin2
changed the title
Muscular Pebble Walrus - Locker:initializeCollection() will revert due to arithmetic underflow
utsav - Locker:initializeCollection() will revert due to arithmetic underflow
Oct 9, 2024
utsav
Medium
Locker:initializeCollection() will revert due to arithmetic underflow
Summary
Locker:initializeCollection() will revert due to arithmetic underflow
Vulnerability Detail
Locker:initializeCollection() refund any unused relative token to the user, but the problem is instead of writing
finalBalance - startBalance
, it usesstartBalance - finalBalance
if there is any refund, it will revert the transaction due to arithmetic underflow
Impact
initializeCollection() will be DoSed
Code Snippet
https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/Locker.sol#L394C3-L398C11
Tool used
Manual Review
Recommendation
Subtract finalBalance - startBalance
The text was updated successfully, but these errors were encountered: