Swapify is a decentralized exchange (DEX) platform where users can create their own liquidity pools, manage liquidity, and swap tokens.
-
Create Tokens
- Users can create their own ERC-20 tokens and have the ability to mint these tokens into other accounts.
-
Liquidity Pools
- Users can create liquidity pools for their tokens, add liquidity to existing pools, and remove liquidity based on the LP tokens they hold.
-
Swap Tokens
- Users can check the availability of token pools and swap tokens if liquidity is available.
-
Create Tokens
- Implemented an ERC-20 standard contract
MockToken.sol
that takes token name and symbol as input, generating corresponding tokens. The contract is deployed using the connected MetaMask wallet via a signer provided by MetaMask.
- Implemented an ERC-20 standard contract
-
Pool Factory
- The
PoolFactory.sol
contract manages liquidity pool addresses corresponding to token pairs. If no pool exists for a pair, it creates a new one, deploying theLiquidityPool.sol
contract and saving its address.
- The
-
Liquidity Pool
- The
LiquidityPool.sol
contract handles liquidity management, including:- Adding liquidity while maintaining the pool ratio.
- Removing liquidity based on LP tokens.
- Managing token price rate conversions (token A to token B).
- Charging a 0.1% fee on all transactions.
- The
All contracts were thoroughly tested using Hardhat in the Backend/test
directory.
-
Limited testnet tokens
- Deployment issues were solved by using a local Hardhat network, enabling more flexibility for multiple test scenarios.
-
Contract testing issues
- Faced challenges while testing the contracts' functionality.
-
Updates to Ethers.js documentation
- Spent extra time researching current methods due to changes in the Ethers library documentation.
-
Understanding how DEXs work
- Initially had limited knowledge of DEX mechanics, which required additional learning through videos and documentation.
-
MetaMask integration
- First-time integration of MetaMask for signing transactions.
-
Deployment challenges
- Running two servers simultaneously (local Hardhat chain and the main backend server) complicated the deployment process.
-
Cross-Chain
- Lack of time and multiple local chain were difficult to handle.