I've encountered the following issue that I'm not able to solve myself. I'd appreciate any help from the 0x dev community.
Let's say a user is creating two buy limit orders:
- makerAmount: 1 USDC, takerAmount: 1 USDT -> remainingFillableTakerAmount: 1 USDT
- makerAmount: 1 USDC, takerAmount: 1 USDT -> remainingFillableTakerAmount: 1 USDT The user approves 2 USDC for the 0x exchange contract. At that point in time, both orders are mutually fillable.
However, if the user now reduces his approval to say 0.5 USDC for some reason, then remainingFillableTakerAmount in both orders gets updated to 0.5 USDT. That is, while each order remains fillable on an individual basis, they are no longer fillable on a combined basis.
The problem is that both orders get returned when using the orderbook api endpoint (e.g., https://ropsten.api.0x.org/orderbook/v1?quoteToken=...&baseToken=...&page=1&perPage=20). I was trying to look at the order data as well as the fillable status using getLimitOrderInfo function, but I couldn't find any identifier I could use to filter out those orders.
I could obviously go through the orderbook orders and check the allowance of each maker using the BalanceChecker contract (which allows to do this for multiple addresses), but I was hoping that there is an easier way to do that.