Implementing the liquidity removal page
In this section, we will go through the implementation of the liquidity removal page, RemoveLiquidity.js
. A snapshot of this page is shown in Figure 6.10:
Figure 6.10 – Snapshot of the liquidity removal page
With the liquidity removal page, a user can select the percentage of liquidity or the amount of LP tokens they want to remove. By removing the liquidity, the user can receive the pooled tokens in return, meanwhile, the LP tokens are automatically burned.
Next, let’s dive into the frontend workflow of liquidity removal.
Frontend workflow of liquidity removal
Before implementing the UI of liquidity removal, let’s go through the frontend workflow first. When removing liquidity, the UI page should allow the user to input the amount of LP tokens they want to remove, then the UI code should check with the LP token smart contract to see whether the AMM router can transfer the LP token from...