0

transaction fail at debug

there is not support ? i sent them 1 transaction from smart contact

fillQuote(
        token1,
        token2,
        uint256(_sellAmount),
        address(_allowanceTarget),
        payable(_to),
        _data1
    );

    uint256 _afterBalance = token2.balanceOf(address(this));

    uint256 _toAmount = _afterBalance - _beforeBalance;
    require(_toAmount > 0, "swap back token not enough");

    fillQuote(
        token2,
        token1,
        uint256(_toAmount),
        address(_allowanceTarget),
        payable(_to),
        _data2
    );

https://polygonscan.com/tx/0xd503b6720fccd8b9d9d90794f47d7d765ce86d2910877839fbc892b224d8655c

1 Answer 1

0

Can you provide more information on what you are doing?

Firstly make sure there are allowances on both token1 and token2. Secondly your first trade may get a different amount than what is encoded in _data2, so it might be equal to or higher than the second quote (which I assume is _data2)

3
  • yes now im trying with flashloan my code worked 10:100 success rate my code in fillQuote here : Feb 12, 2022 at 5:18
  • require(sellToken.approve(spender, sellAmount), "go approve IERC20"); (bool success, ) = swapTarget.call{value: msg.value}(swapCallData); require(success, "SWAP_CALL_FAILED"); require(sellToken.approve(spender, 0), "RESET TOKEN"); Feb 12, 2022 at 5:19
  • If you're arbitraging you will have to both make a profit and pay back your flash loan. It's extremely difficult to debug your query with just this information. 0xAPI has been used successfully with atomic arbitrage in the past but the game has since moved on and it is no longer practical. Feb 13, 2022 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.