0

I'm currently designing my contract to work with 0x Swap API, but not sure if I should handle the case of refund. (it's kind of tricky for me to add a fallback because i'm using the diamond proxy pattern) So my question is, is it possible that I can expect the 0x swap api give me a calldata that will never return eth? Like is there a way to specify all refund in weth or something. Thanks in advance.

1 Answer 1

0

To clarify, by "refund" do you mean the estimatedGasTokenRefund response field? If so, I don't think there's a way to change that.

If you were just looking to wrap any eth returned in a swap quote, you could do so by requesting a swap quote with sellToken and buyToken as 'WETH' or 'ETH'. The swap quote returned will provide the calldata to directly interact with the WETH9 contract and not with 0x exchange contracts (code example).

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.