Build a simple lending protocol that allows users to lend and borrow ERC20 tokens. The contract should have the following functions:

- deposit(address _token, uint256 _amount): Allows a user to deposit a specific amount of an ERC20 token into the contract as collateral.
- borrow(address _token, uint256 _amount): Allows a user to borrow a specific amount of an ERC20 token from the contract.
- repay(address _token, uint256 _amount): Allows a user to repay a specific amount of an ERC20 token to the contract.

The contract should also have the following features:

- It should keep track of the total supply of each ERC20 token in the contract, as well as the total amount borrowed and the total amount of collateral.
- It should allow users to borrow a maximum of 80% of the value of their collateral.
- It should implement a liquidation mechanism to recover collateral if the value of the borrowed tokens drops below a certain threshold.
- It should implement the ERC20 interface to allow for compatibility with other ERC20 contracts.

Notes:

- The contract should be written in Solidity and be compatible with the latest version of the Ethereum Virtual Machine (EVM).
- You should provide clear and concise documentation for each function in the contract.
- You should also write unit tests to ensure the contract is functioning correctly

Jan 29, 2023, 4:18 AM
this is task
Jan 29, 2023, 4:18 AM
well, i'm not into that DeFi zone yet, but you don't wanna pratice on those, it's that kind of contract that you don't wanna reinvent the wheel or at least, you must be really experienced.
Take a look at AAVE lending pools
your contract on github is full of flaws and seems incomplete
what worked for me was forking other contracts, understand how they worked out and started to add little changes
Jan 29, 2023, 4:23 AM
its not full contract , it's simple task for practice
Jan 29, 2023, 4:25 AM
as long as you don't use those with real money, yea it's a way to pratice
Jan 29, 2023, 4:26 AM
sure it's for not real money
Jan 29, 2023, 4:27 AM
Sounds like a test for a job
Jan 29, 2023, 1:24 PM

© 2024 Draquery.com All rights reserved.