QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

UpliftOnlyExample::nftPool mapping not reset for burned NFTs

Summary

The UpliftOnlyExample::onAfterRemoveLiquidity function does not reset the nftPool mapping for NFTs that have been burned. Consequently, burned NFTs remain mapped to a pool address, leading to an incorrect representation of the contract's state.

UpliftOnlyExample::onAfterRemoveLiquidity function:

function onAfterRemoveLiquidity(
...
) public override onlySelfRouter(router) returns (bool, uint256[] memory hookAdjustedAmountsOutRaw) {
...
for (uint256 i = localData.feeDataArrayLength - 1; i >= 0; --i) {
...
if (feeDataArray[i].amount <= localData.amountLeft) {
uint256 depositAmount = feeDataArray[i].amount;
localData.feeAmount += (depositAmount * feePerLP);
localData.amountLeft -= feeDataArray[i].amount;
=> lpNFT.burn(feeDataArray[i].tokenID);
=> // @low Not reset `nftPool` mapping
delete feeDataArray[i];
feeDataArray.pop();
if (localData.amountLeft == 0) {
break;
}
} else {
...
}
}
...
}

Impact

Burned NFTs remain mapped to a pool address, leading to an incorrect representation of the contract's state.

Recommendations

Update logic in the UpliftOnlyExample::onAfterRemoveLiquidity function to reset the nftPool mapping for any NFT that is burned.

function onAfterRemoveLiquidity(
...
) public override onlySelfRouter(router) returns (bool, uint256[] memory hookAdjustedAmountsOutRaw) {
...
for (uint256 i = localData.feeDataArrayLength - 1; i >= 0; --i) {
...
if (feeDataArray[i].amount <= localData.amountLeft) {
uint256 depositAmount = feeDataArray[i].amount;
localData.feeAmount += (depositAmount * feePerLP);
localData.amountLeft -= feeDataArray[i].amount;
lpNFT.burn(feeDataArray[i].tokenID);
+ delete nftPool[feeDataArray[i].tokenID]
delete feeDataArray[i];
feeDataArray.pop();
if (localData.amountLeft == 0) {
break;
}
} else {
...
}
}
...
}
Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!