1inch AggregationRouterV5 中的 swap函数 的data参数具体是如何构造的

Joe Joe 提出于 2023-03-05 10:43 4080 浏览

swap函数是这样的

/// @notice Performs a swap, delegating all calls encoded in `data` to `executor`. See tests for usage examples
    /// @dev router keeps 1 wei of every token on the contract balance for gas optimisations reasons. This affects first swap of every token by leaving 1 wei on the contract.
    /// @param executor Aggregation executor that executes calls described in `data`
    /// @param desc Swap description
    /// @param permit Should contain valid permit that can be used in `IERC20Permit.permit` calls.
    /// @param data Encoded calls that `caller` should execute in between of swaps
    /// @return returnAmount Resulting token amount
    /// @return spentAmount Source token amount
    function swap(
        IAggregationExecutor executor,
        SwapDescription calldata desc,
        bytes calldata permit,
        bytes calldata data
    )
        external
        payable
        returns (
            uint256 returnAmount,
            uint256 spentAmount
        )
    {

在它的doc和合约中都未能找到data参数的明确解释,希望大佬能帮忙解答下这个问题

1 个回答

Jeack 2023-03-05 15:51

写回答

你需要登录后才可以回答问题,登录