0

I'm trying to fill order from my contract by using 0x V4 API and contract on Mainnet.

So far I'm guessing that I should call batchFill function in this contract.

https://etherscan.io/address//0xdef1c0ded9bec7f1a1670819833240f027b25eff#writeProxyContract

But I have no idea what data I need to pass to "fillData (tuple)". Could anyone help me? Also, I found that "exchangeProxy" contract is deployed to Polygon network but it seems that the interface is different. How can I fill order on the Polygon network?

https://polygonscan.com/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff#writeProxyContract

I'm using API call like this to get orderbooks information.

https://api.0x.org/sra/v4/orderbook?baseToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&quoteToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&perPage=1000

I found v4 contract address here

https://protocol.0x.org/en/latest/basics/addresses.html#exchange-v4 https://github.com/0xProject/protocol/blob/development/packages/contract-addresses/addresses.json

Thanks,

1 Answer 1

1

A couple things.

  1. Etherscan has the wrong ABI for the Exchange Proxy so don't use that as a reference. The actual interfaces for the features you're interested in can be found here and here (they both exist on the same 0xdef1c0ded9bec7f1a1670819833240f027b25eff address).
  2. batchFillLimitOrders() is used to fill multiple orders. If you're just trying to fill a single order, you can just call fillLimitOrder().
  3. Otherwise, the process is fairly typical: Set an allowance on the Exchange Proxy 0xdef1c0ded9bec7f1a1670819833240f027b25eff for the token you're selling (taker token) then call fillLimitOrder() on that order.

More info can be found here https://protocol.0x.org/en/latest/basics/functions.html

1
  • 1
    Thanks I managed to make it work Commented Oct 7, 2021 at 3:39

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.