TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: low
Invalid

send calls _debit with 4 parameters instead of 3

Summary

The removeAuctionConfig function cannot remove an auction if startCooldown == 0.

Vulnerability Details

The TempleGold::send function executes OFT's _debit function.

https://github.com/Cyfrin/2024-07-templegold/blob/main/protocol/contracts/templegold/TempleGold.sol#L295-L300

(uint256 amountSentLD, uint256 amountReceivedLD) = _debit(
msg.sender,
_sendParam.amountLD,
_sendParam.minAmountLD,
_sendParam.dstEid
);

However, the real _debit OFT implementation has 3 input parameters, not 4.

https://github.com/LayerZero-Labs/LayerZero-v2/blob/main/packages/layerzero-v2/evm/oapp/contracts/oft/OFT.sol#L69

function _debit(
uint256 _amountLD,
uint256 _minAmountLD,
uint32 _dstEid
) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {

In the current code, _debit has not been overwritten, meaning it is still using the OFT base method. This will cause send to revert as it's trying to input 4 parameters into _debit, while it only accepts 3.

Impact

send will revert every time it's called.

Tools Used

Manual review

Recommendations

Remove the address parameter.

(uint256 amountSentLD, uint256 amountReceivedLD) = _debit(
- msg.sender,
_sendParam.amountLD,
_sendParam.minAmountLD,
_sendParam.dstEid
);
Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

send calls _debit with 4 parameters instead of 3

Support

FAQs

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