API Reference

Overview

Decentralised Exchanges (DeX)

ThirdFi offers Earn (Providing Liquidity) and Swap functions on-chain with REST API. Currently we are supporting UniswapV2 forked version swapping protocols, such as Uniswap, Sushiswap, Pancakeswap, Quickswap, TraderJoe, Velodrome, OKCSwap, Kuswap, VSS Finance, Swappi, PoseiSwap.

Earn

What is Earn?

Earn is a liquidity provider who provides token assets to liquidity pools in order to earn rewards from fees generated when others 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 work?

  1. Get actual liquidity pool ratio for the token pairs via https://thirdfi.readme.io/reference/get-liquidity-ratio.
  2. Use the amounts returned to create earn request via https://thirdfi.readme.io/reference/create-liquidity-session.
  3. Redirect user to webview URL provided from API.
  4. User is able to add liquidity to pools by connecting user wallet with Metamask/Wallet Connect (Web3 wallet) and specific network chain from the API requested earlier, then do the transaction.
  5. The user wallet will receive the "liquidity tokens" that was added when it has been sent to DeX protocols.

📘

What is the liquidity tokens?

Liquidity tokens are merely an accounting or bookkeeping tool to keep track of how much the liquidity providers are owed. If others subsequently add/withdraw coins, new liquidity tokens are minted/burned such that everyone's relative percentage share of the liquidity pool remains the same. These are not speculative tokens to be traded.

Swap

What is Swap?

Swap is a straightforward method of exchanging token assets for other assets. Swaps on decentralised exchanges (DeX) differ from trades on traditional platforms in that they use an automated market maker mechanism to provide real-time feedback on rates and slippage rather than an order book to represent liquidity or determine prices.

Swapping is simple for end users; a user selects an input token and an output token. They enter an amount, and the protocol determines how much of the output token they will receive. They then perform the swap with a single click and immediately receive the output token in their wallet. You can learn more about the swapping at https://docs.uniswap.org/contracts/v2/concepts/core-concepts/swaps.

How does Swap work?

  1. Create token swap request via https://thirdfi.readme.io/reference/create-swap-session.
  2. Redirect user to webview URL provided from API.
  3. User is able to swap the token by connecting user wallet with Metamask/Wallet Connect (Web3 wallet) and specific network chain from the API requested earlier, then do swapping.
  4. The user wallet will receive the token that was swapped when it has been sent to DeX protocols.

List of chains we supported

This is useful in Get Estimated Swap Output Amount and Create Session.

Blockchain NetworkMainnetTestnet
Ethereumethereumgoerli
ArbitrumarbitrumarbitrumTestnet
BNB chainbscbscTestnet
Polygonpolygonmumbai
Avalancheavalanchefuji
OptimismoptimismoptimismTestnet
OKExchainokcokcTestnet
CronoscronoscronosTestnet
KuCoin chainkcckccTestnet
Conflux (eSpace)confluxconfluxTestnet
Nautilus chain-nautilusTestnet

List of liquidity pools we supported (Mainnet)

Blockchain NetworkPools
ethereumUSDC-ETH
ethereumDAI-USDC
ethereumETH-USDT
ethereumUNI-ETH
ethereumWBTC-ETH
avalancheAVAX-USDC
avalancheWETH.e-AVAX
avalancheUSDt-AVAX
avalancheBTC.b-AVAX
avalancheUSDC.e-AVAX
avalancheAVAX-USDT.e
polygonMATIC-SAND
polygonUSDC-WETH
polygonMATIC-USDC
polygonUSDC-USDT
polygonMATIC-WETH
arbitrumETH-USDC
arbitrumETH-MIM
arbitrumWBTC-ETH
arbitrumETH-USDT
arbitrumSPELL-ETH
bscUSDT-BNB
bscBNB-BUSD
bscUSDT-BUSD
bscCAKE-BNB
bscBTCB-BNB
optimismOP-USDC
optimismETH-USDC
optimismVELO-USDC
optimismUSDC-DAI
okcUSDT-ETHK
okcUSDT-BTCK
okcUSDT-USDC
okcUSDT-OKB
okcUSDT-OKT
cronosWCRO-USDC
cronosVVS-WCRO
cronosUSDT-USDC
cronosWETH-WCRO
cronosVVS-USDC
kccWKCS-KUS
kccUSDT-USDC
kccUSDT-WKCS
kccWKCS-USDC
kccWKCS-BTCK
confluxCFX-ETH
confluxCFX-WBTC
confluxCFX-PPI (Swappi)
confluxCFX-USDT
confluxCFX-USDC
confluxUSDC-USDT

List of liquidity pools we supported (Testnet)

Blockchain NetworkPools
goerliWBTC-USDC
goerliETH-USDC
arbitrumTestnetWBTC-USDC
bscTestnetWBTC-USDC
fujiWBTC-USDC
mumbaiWBTC-USDC
optimismTestnetUSDC-WBTC
kccTestnetUSDC-WKCS
okcTestnetUSDC-WBTC
okcTestnetOKT-USDC
cronosTestnetUSDC-WBTC
confluxTestnetUSDC-WBTC
nautilusTestnetUSDC-WBTC

See https://thirdfi.readme.io/reference/get-dexswap-pools for more information.

Testnet Faucet

Check https://www.faucet.thirdfi.org/ for getting testing ERC20 tokens for testnet testing.