I'm currently doing some tests using 1inch smart contract in order to be able to swap currency to another.
But I'm facing multiple errors that I didn't understand.
Scenario (on Polygon):
- Call https://api.1inch.exchange/v3.0/137/swap to get the transaction data
- Use the result to send it to Polygon (using Web3 & Infura)
- Facing the error in polygonscan (contract execution revert)
That is the list of the different error I facing :
callBytes failed: Error(External call failed: Error(BAL#508))
callBytes failed: Error(External call failed: Error(External call failed: Error(Deadline not met)))
callBytes failed: Error(External call failed: Error(External call failed: Error(LOP: taking > remaining)))
callBytes failed: Error(External call failed: Error(External call failed: Error(timeout)))
callBytes failed: Error(External call failed: Error(LOP: predicate returned false))
Every error is related to callBytes.
My investigation:
The contract I call is this one : 0x11111112542d85b3ef69ae05771c2dccff4faa26.
This contract call the method callBytes
from this contract : 0x11431a89893025d2a48dca4eddc396f8c8117187 but this one isn't verified and I didn't find any documentation...
If anyone has an idea of what these errors mean it would be a great help to me.
Thanks.
Exemple transaction :
BAL#508 : 0xf2c219d6f42ac3f47c1bb9212af26512aa6d574a80d0bff982bacf808d2d5446
Deadline not met : 0x98e8c5b45391ec7ae4f4ce5e452500d0a25378385b4b0ea342858a38a5cfc7f7
LOP: predicate returned false : 0x77470ea196cf0dde29e6582981e30dfdcd098109bdb039ab1cadf5144d066e8f
LOP: taking > remaining : 0x2563267b3cee277fc6a57e063c7706c054411bb307f987c5df6f297798153917
Timeout : 0x395e96eb144e2fd6cd4bbbff693a8658afb83e0fcaac81f5f6e4dc32c7b55a77
Not that the error is not the same on polygonscan, for getting the error I use npm package eth-revert-reason