返回 aaveLendingPool.withdraw() return 值验证

Aave aaveLendingPool.withdraw() return value validation

我正在编写一个拉取支付功能,与任何外部调用一样,验证结果并检查是否成功执行是一种很好的做法。我正在使用以下界面:

    interface IAaveLendingPool {
    function deposit(
        address asset,
        uint256 amount,
        address onBehalfOf,
        uint16 referralCode
    ) external;

    function withdraw(
        address asset,
        uint256 amount,
        address to
    ) external;

    function getReservesList() external view returns (address[] memory);
}

aAveLendingPool= IAaveLendingPool(0x0543958349aAve_pooladdress)

Aave 提供的接口也没有指定 return。 LendingPool.sol合约returns external override whenNotPaused returns (uint256).

的withdraw函数

问题:我可以使用 returned uint 来验证成功执行或 aAveLendingPool.withdraw() return是布尔值吗?以下是否会按预期工作?

    ///@notice assigns dai to caller
    require( aaveLendingPool.withdraw(
                address(dai),
                amount,
                msg.sender), "Error, contract does not have enough DAI")

 

请提供 solidity 文档 link 到外部函数调用 return 值(如果有)。

根据 Consensys Diligence Aave V2 audit

ERC20 implementations are not always consistent. Some implementations of transfer and transferFrom could return ‘false’ on failure instead of reverting. It is safer to wrap such calls into require() statements to these failures.

因此,将转移调用包装在要求检查中是安全且足够的。

require( aaveLendingPool.withdraw(
                address(dai),
                amount,
                msg.sender), "Error, contract does not have enough DAI")