hats-finance / Wise-Lending-0xa2ca45d6e249641e595d50d1d9c69c9e3cd22573

0 stars 1 forks source link

Misleading custom error naming in `SendValueHelper::_sendValue()` #50

Open hats-bug-reporter[bot] opened 8 months ago

hats-bug-reporter[bot] commented 8 months ago

Github username: @JacoboLansac Twitter username: jacolansac Submission hash (on-chain): 0x4b8ce5a37a9134a4f40549066136d4bf3006b90c54e244e92c4a0a79aea9bbe2 Severity: medium

Description: Description\ In the function SendValueHelper::_sendValue(), if the ether balance of the contract is lower than the _amount to be sent, the transaction reverts with the custom error named AmountTooSmall() .

This is misleading, as the _amount is precisely too large for the contract balance, or the balance is too small for the _amount.

contract SendValueHelper {
    bool public sendingProgress;

    function _sendValue(address _recipient, uint256 _amount) internal {
        if (address(this).balance < _amount) {
            revert AmountTooSmall();
        }

        // ...

Suggestion Change the custom error to either AmountTooLarge() or BalanceTooLow()

Severity This is clearly not a medium finding, but a low one.