0

i am having an issue with an function I would like to call.

Following case:

The function looks like this:

Params Type
token0 IERC20
token1 IERC20
amount uint256
parts uint256
flags uint256

and it returns

Params Type
returnAmount uint256
distribution uint256[]

I tried to handle the variables as following but every time I try the function, it becomes reverted. Here the line:

(uint returnAmount, uint[] memory distribution) = exchange.getExpectedReturn(token0, token1, amount, parts, flags);

Maybe someone has an idea? Do I have to define a struct to handle the params correctly? Is the function itself correct and did I make a mistake with importing the right interface?

The return I would like to handle looks like this:

[3400158, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
4
  • Can you share the revert error?
    – martriay
    Jan 16 at 17:46
  • Error: Returned error: VM Exception while processing transaction: revert Jan 16 at 17:51
  • 1
    You should be showing us what getExpectedReturn does, I don't think the problem is with the return statement. Also, consider using something like hardhat's console.log for better debugging.
    – martriay
    Jan 16 at 17:53
  • I changed the Router address and was able to call the getExpectedReturn function. Netherless I get the following error message: SafeERC20: low-level call failed Jan 17 at 1:35

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.