0

i have a contract that i would like to utilize the zeroEx protocol with

i am calling the qoute endpoint like this

https://bsc.api.0x.org/swap/v1/quote?sellToken=0x55d398326f99059ff775485246999027b3197955&buyToken=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&sellAmount=5000000000000000000&takerAddress=0xadA75b297dE5391E6e0F30a89fb6b3F816b4A5BE&slippagePercentage=0.01&skipValidation=true

this is the API qoute URL

i then call my contract with the bytes data returned from this endpoint

const I = await axios.get(url, {
  timeout: 10000,
  headers: optionsCreateZeroEx.headers

});

const swapDataI: any = I.data;

console.log(swapDataI)

I Then Utilize the response.data and call my contract method as part of the callData params to my contract method

once all tokens are transfered to my contract

 IERC20Upgradeable(sData.tokenFrom).safeTransferFrom(
                _msgSender(),
                address(this),
                sData.swappingTokenAmount
            );

I perfrom the following call

 (success, result) = 0xContract.call(sData.data);

where sData.data being the data returned from zeroEx endpoint

but no matter what i cannot get pass my require

require(success, "AGG Swap Fail");

Any Help Would be appreciated Thank You Team.

1 Answer 1

0

I Have Resolved the issue One needs to make sure we have in your contract the following


    receive() external payable {}

very simple oversight on my behalf but hope this can help someone in the future

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.