Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Latest commit

 

History

History
51 lines (34 loc) · 1.78 KB

036.md

File metadata and controls

51 lines (34 loc) · 1.78 KB

BugHunter101

medium

TxBuilderExtension.onDeferredLiquidityCheck() does not use payable. This will cause errors when calling some functions that require fees

Summary

TxBuilderExtension.onDeferredLiquidityCheck() does not use payable. This will cause errors when calling some functions that require fees

Vulnerability Detail

As we can see, onDeferredLiquidityCheck() is a callback function and it will call executeInternal()

function onDeferredLiquidityCheck(bytes memory encodedData) external override {
        require(msg.sender == address(ironBank), "untrusted message sender");

        (address initiator, Action[] memory actions, uint256 index) =
            abi.decode(encodedData, (address, Action[], uint256));
        executeInternal(initiator, actions, index);
    }

the executeInternal() will be called according to the parameter actions specification. And then, there have some function which require fees . such borrowNativeToken

function borrowNativeToken(address user, uint256 borrowAmount) internal nonReentrant {
        ironBank.borrow(user, address(this), weth, borrowAmount);
        WethInterface(weth).withdraw(borrowAmount);
        (bool sent,) = user.call{value: borrowAmount}("");
        require(sent, "failed to send native token");
    }

So, when we call borrowNativeToken() will cause error. TxBuilderExtension.onDeferredLiquidityCheck() does not use payable. This will cause errors when calling some functions that require fees.

Impact

This will cause errors when calling some functions that require fees

Code Snippet

https://github.com/sherlock-audit/2023-05-ironbank/blob/main/ib-v2/src/extensions/TxBuilderExtension.sol#L105

Tool used

Manual Review

Recommendation

Adding payable for this function