Fail with error 'callBytes failed: Error(LOP: remaining amount is 0)'

Hi All,

Thanks for the great forum. It’s been a ton of help. I’ve been playing around with the Swap and Quote API and have been running into some issues lately. I realize my topic is similar to this this post , but I couldn’t find my help there.

What I’m doing: Essentially, I’ve created an object that houses contract address information, and looping through it to perform swaps on various contracts. E.g. awaiting a swap for btc → usdc, then eth-> usdc, matic → usdc, etc etc. I’m using JavaScript, the Web3 package, as well as the 1inch API docs to formulate my requests.

However, I’ve recently started getting ‘cannot estimate errors’, so based on the “troubleshooting Cannot Estimate” post in the docs , I’ve disabled the swap estimate and have added my own gas manually. However now, 60-70% of the time, my swaps result in this error:

Fail with error 'callBytes failed: Error(LOP: remaining amount is 0)'

which is visible in the block explorer. My console gives me this error:

Error: Transaction has been reverted by the EVM

I find it odd that which transactions are successful are seemingly random. I’ve checked out this post on Limit Order Remaining, but It wasn’t able to clear it up for me.

Does anyone have tips for me? Thanks in advance!