Troubleshooting
Debugging Transaction Failures
EVM execution environments often provide limited ways to figure how exactly a transaction failed to execute.
Foundry provides a useful command:
This shows a breakdown of the transaction execution and the different contract interactions.
Assuming the transaction failed, the most probable error signature would be 0x71c4efed
(SlippageExceeded
).
You can look up the full list of errors in the OBRouter
Reference.
Alternatively if the error is not found on the table, foundry also provides cast-4byte which can decode the error if it is already present in their lookup table:
OutOfGas Transactions
We've identified that bArtio's gas estimation for transactions can sometimes be inaccurate, leading to failures due to insufficient gas. When reviewing such transactions on a block explorer or using debugging methods (described above), you'll notice that the failures are attributed to inadequate gas provision.
By default, viem and wagmi will always try to estimate gas from the RPC if no gas limit is set to the transaction. This gas estimation often leads to incorrect estimates that lead to transactions failing withOutOfGas
.
[OutOfGas] EvmError: OutOfGas
To address this issue, we’ve implemented a solution in our frontend and recommend other integrators do the same. The approach involves manually estimating the transaction gas using the RPC, then submitting the swap transaction with an additional buffer added to the estimated gas value.
We suggest applying a buffer of 10%-20% on top of the RPC's returned gas estimate. This method has proven effective in mitigating OutOfGas
errors and ensuring smoother transaction execution.
Below is an example of through viem:
Transaction Calldata Missing on Swap API
If the swap
endpoint on the API does not return the transaction calldata. This is because a to
parameter needs to be provided in order for the calldata to be constructed, otherwise OBRouter
does not know where to send outputted tokens.
Last updated