From 782919645395249ea659024d59fb35e2702b8aa4 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sat, 23 Nov 2024 07:17:47 +0700 Subject: [PATCH] Create README.me --- .../pi_network/defi/README.me | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 blockchain_integration/pi_network/defi/README.me diff --git a/blockchain_integration/pi_network/defi/README.me b/blockchain_integration/pi_network/defi/README.me new file mode 100644 index 000000000..02bbc432e --- /dev/null +++ b/blockchain_integration/pi_network/defi/README.me @@ -0,0 +1,45 @@ +# DeFi Protocol + +This directory contains the implementation of a lending protocol and a yield farming contract for decentralized finance (DeFi) applications. + +## Directory Structure + +- `lending_protocol.sol`: Smart contract for managing lending and borrowing. +- `yield_farming.sol`: Smart contract for yield farming. +- `README.md`: Documentation for the DeFi protocol. + +## Lending Protocol (`lending_protocol.sol`) + +The Lending Protocol allows users to request loans and repay them. It tracks active loans and calculates the total repayment amount based on the interest rate. + +### Functions + +- `requestLoan(uint256 _amount, uint256 _interestRate, uint256 _duration)`: Allows users to request a loan. +- `repayLoan()`: Allows users to repay their active loan. +- `getLoanDetails(address _borrower)`: Retrieves details of a specific loan. + +### Events + +- `LoanRequested(address indexed borrower, uint256 amount, uint256 interestRate, uint256 duration)`: Emitted when a loan is requested. +- `LoanRepaid(address indexed borrower, uint256 amount)`: Emitted when a loan is repaid. + +## Yield Farming (`yield_farming.sol`) + +The Yield Farming contract allows users to stake tokens and earn rewards over time. It tracks the amount staked by each user and calculates rewards based on the staking amount. + +### Functions + +- `stake(uint256 _amount)`: Allows users to stake tokens. +- `unstake(uint256 _amount)`: Allows users to unstake tokens. +- `claimRewards()`: Allows users to claim their earned rewards. +- `getStakerDetails(address _staker)`: Retrieves details of a specific staker. + +### Events + +- `Staked(address indexed user, uint256 amount)`: Emitted when tokens are staked. +- `Unstaked(address indexed user, uint256 amount)`: Emitted when tokens are unstaked. +- `RewardClaimed(address indexed user, uint256 amount)`: Emitted when rewards are claimed. + +## License + +This project is licensed under the MIT License.