Announcing Earn API for DeFi
As builders, we understand first-hand how frustrating it can be to connect liquidity pools to your dapp and your product manually. It involves researching the liquidity pools in each chain and working on the smart contract, even writing your own code to enable the users to provide liquidity in certain pools.
We’re proud to announce Earn API for DeFi.
As part of Securo’s mission, this Earn API allows developers to seamlessly deploy funds into DeFi liquidity pools and earn LP rewards in corresponding pools. Eventually, this will save time implementing and maintaining your DeFi product.
What does Earn API do?
Earn API is an API function for providing liquidity to liquidity pools on decentralized exchanges. It provides token assets to liquidity pools to earn rewards from fees generated when other people trade or swap with those pools. You can learn more about the liquidity providers and pools at https://docs.uniswap.org/contracts/v2/concepts/advanced-topics/understanding-returns.
How does Earn API work?
Users can first get the actual liquidity pool ratio for the token pairs in the blockchain network they chose. Then users can use the amounts to create an earn request. Once all the parameters are set, and the request has been sent, users will be provided a webview URL to execute the transaction.
Securo supports gasless transactions to Earn API, too, powered by Biconomy. Once the transaction is confirmed and processed, the users will receive ‘liquidity tokens’.
At launch, we’re providing support for these liquidity pools in 6 blockchain networks.
*To see the full information on the supported liquidity pools, please visit https://docs.securo.dev/securo-services/earn
Here is a simple step-by-step guide on how to use the Earn API.
- Create an account on Securo Developer Portal.
- Create the API key, set the whitelist IP address, and the permission.
- Open Postman to use the Earn API — Liquidity Provider (LP).
- Before creating an LP session, we need Postman to get ‘lpInfo’ first. Set the following parameters:
- chain: blockchain network you want to use.
- tokenA & tokenB: the token pairs you want to use for providing liquidity.
- amountA & amountB: the value of tokens you want to provide liquidity with the token pair.
7. Click Send and get the lpInfo. Then you will get the result for tokenB value amount.
8. Create an LP(Liquidity Provider) session. Edit the parameters and click Send. The amount0 and amount1 can be copied from where we set the lpInfo.
9. After clicking Send, the LP session is successfully created, and it will provide a URL to access the portal.
10. Click the URL to review the transaction details. Once you confirm the transaction, click the Confirm button.
11. Metamask will show a pop-up message. It is a signature request from Biconomy to enable gasless transactions. Click the Sign button to proceed with the transaction without any gas fee.
12. Once the transaction is through, you can review the transaction's status in the Securo app.
Hope you enjoy this Earn API for DeFi, to easily provide liquidity into various liquidity pools.
As this is the first version of the Earn API, we’re still looking to add more liquidity pools and improve this API. We’re excited to see how our users will use these in their dapps and look forward to any feedback on how we can further improve!