0

I have deployed a local instance of 0X API with the environment variables:

CHAIN_ID=250
ETHEREUM_RPC_URL=https://rpc.ftm.tools

When trying to get the prices it sometimes works well for some prices but there are pairs that throw an internal server error. When checking the details I saw it shows the error:

"Error: out of gas\n    at SwapHandlers._getSwapQuoteAsync

For example this price request is failing:

http://127.0.0.1:3000/swap/v1/price?sellToken=WFTM&buyToken=USDC&sellAmount=10000000000000000000

Can you guys help me to identify what could be causing the internal server error?

Thank you

1 Answer 1

0

You'll need a better RPC endpoint which has a higher eth call gas limit. The public one you're using is very small.

When creating routes a lot of gas is used in reading the chain.

3
  • Thank you so much @Jacob, do I need to mount my own nodes? or do you know some highly available RPC?
    – eum602
    Feb 24, 2022 at 0:28
  • Quicknode supports Fantom, or you can run your own nodes. We actually have a fix that may release soon which will lower the gas on Fantom. It occurs on small amounts (where there are MANY pools with liquidity) and goes away on larger amounts. So if you try a larger amount of FTM sell you should see success. Feb 24, 2022 at 0:57
  • Thank you I have confirmed what you said, I got the price for a higher amount of FTM (100 fmts) against USDC and this time it passed. I'll take a look at Quicknode.
    – eum602
    Feb 24, 2022 at 16:11

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.