Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

`InheritanceManager:buyOutEstateNFT` can fail due to insufficient allowance and can lead to unnecessary gas spending

Vulnerability Details

Before the transaction, the function does not check the user's allowance and transacts directly. If the allowance is insufficient, this will revert

Impact

Low - Gas consumption

Recommendations

Add an allowance check before the transaction and revert safely

function buyOutEstateNFT(
uint256 _nftID
) external onlyBeneficiaryWithIsInherited {
uint256 value = nftValue[_nftID];
uint256 divisor = beneficiaries.length;
uint256 multiplier = beneficiaries.length - 1;
uint256 finalAmount = (value / divisor) * multiplier;
+ uint256 allowance = IERC20(assetToPay).allowance(msg.sender, address(this));
+ require(allowance >= finalAmount, "Insufficient allowance");
IERC20(assetToPay).safeTransferFrom(
msg.sender,
address(this),
finalAmount
);
...
Updates

Lead Judging Commences

0xtimefliez Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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