0

I'm trying to figure out how I can use 1inch AggregationRouterV4 as a smart contract and not as an API.

I have experience with ethers , but I can't find any example and tests on how to work with a smart contract and the swap function.

I found implementations for old one with:

function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 amount,
        uint256 minReturn,
        uint256[] memory distribution,
        uint256 disableFlags
 ) public payable;

But not for the new version:

function swap(
  contract IAggregationExecutor caller,
  struct AggregationRouterV4.SwapDescription desc,
  bytes data
) external returns (uint256 returnAmount, uint256 gasLeft)

Can someone show an example of a simple exchange of any token using ethers/web3 and AggregationRouterV4 ?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.