Welcome to the Liquidity Pool project, a decentralized liquidity pool designed to facilitate token exchange, liquidity provision, and yield farming. This project brings together key functionalities that empower both the owner and users to participate in a robust decentralized financial ecosystem.
Liquidity providers can add tokens to the pool, earning LP (Liquidity Provider) tokens in return. These tokens represent the share of the liquidity pool that a user owns. The more tokens provided, the larger the share.
Users can swap tokens within the liquidity pool, taking advantage of the automated market maker (AMM) mechanism. The exchange rates are determined by the current balances of the two tokens in the pool, allowing for seamless and decentralized token swaps.
Liquidity providers are rewarded with yield, distributed periodically. Users can claim their yield daily, adding an additional incentive for providing liquidity to the pool.
To ensure the security and stability of the liquidity pool, the owner is required to lock the initial liquidity for 365 days. This time lock mechanism provides confidence to users and stakeholders, knowing that the liquidity pool is secured for an extended period.
The owner can add initial liquidity to the pool by providing a specified amount of both assets.
Users can add more liquidity to the pool by providing one asset, and the contract calculates the required amount of the second asset based on the current ratio.
Users can withdraw a percentage of their liquidity, receiving back the proportional amounts of both assets.
Users can sell the first asset and receive the second asset in return, with a swap fee applied.
Users can sell the second asset and receive the first asset in return, with a swap fee applied.
The owner can change the swap fee percentage.
Users can claim their daily yield, subject to a time lock. Yield can be claimed once a day.
The Liquidity Pool includes time-lock functionality to secure the initial liquidity for 365 days. Certain operations, such as withdrawing initial liquidity, are restricted until the time lock expires.
- Hardhat
- JavaScript
- Solidity
To deploy the Liquidity Pool project, use the following Hardhat deploy command:
yarn hardhat deploy
To deploy only the token, use:
yarn hardhat deploy --tags token
To deploy only the liquidity pool (change the token addresses in 02-deploy-LiquidityPool.js):
yarn hardhat deploy --tags liquiditypool
We welcome contributions from the community. If you'd like to contribute, please follow these guidelines:
- Fork the repository.
- Create a branch:
git checkout -b feature/your-feature-name
. - Commit your changes:
git commit -am 'Add some feature'
. - Push to the branch:
git push origin feature/your-feature-name
. - Submit a pull request.
Please make sure to update tests as appropriate and adhere to the code of conduct.
This project is licensed under the MIT License - see the LICENSE file for details.