Tokens-swap is React web application which allows the swap of BEP-20 tokens. It was built using ethers.js and web3-react for the blockchain connection, and TailwindCSS for the styling.
The swap functionality has been implemented using a set of PancakeSwap's contracts:
- FactoryV2: to check if the selected tokens Pair is valid
- RouterV2: to swap tokens and get the expected amount of tokenB as output with a certain amount of tokenA as input based on the Pair's reserves
The tradable tokens are pre-defined in a list consisting of the most traded tokens on PancakeSwap. The list has been taken from the PancakeSwap Github repository.