ReInvest is a DeFi platform that lets people delegate borrowing power to professional investors and other users, thereby allowing them to earn passively from supplying funds to the protocol and earning from vaults in which they delegate their borrowing power to
ReInvest is a DeFi platform that lets people delegate borrowing power to professional investors and other users, thereby allowing them to earn passively from supplying funds to the protocol and accessing the other proposed upsides from the users to whom their borrowing power has been delegated. The product will be powered by Aave’s credit delegation system and smart contracts.
Reinvest works in 2 parts:
Users supply assets to Aave’s liquidity pools and receive borrowing credits in GHO value.
The borrowing credit can then be delegated by the user to vaults on ReInvest that serve as investment vehicles.
A vault can be created by any 3rd party. To create a vault, a deposit equal to at least 70% of the total funds that can be accepted into the vault is required. This deposit will serve as insurance in case any unforeseen events occur that lead to loss of funds. The borrowing credit delegated to the vault can be used to mint GHO and then be utilized by the vault owner in accordance to the agreement between the credit delegator and the vault owner.
The contract imports essential interfaces and contracts to interact with external systems. It includes ERC-20 token interface (IERC20), Aave pool interface (IPool), and custom token contracts (GhoToken and IGhoToken). Additionally, the contract imports the Vault contract, which handles third party investments
dai: An instance of the ERC-20 token interface representing the DAI token. pool: An instance of the Aave lending pool interface for interacting with Aave protocol functions. gho: An instance of the token representing GHO, allowing interactions with GHO-specific functionalities. vault: An address variable storing the address of a newly deployed Vault contract.
The contract constructor initializes the vault variable by deploying a new instance of the Vault contract. This sets up the infrastructure necessary for the subsequent functionalities.
The invest function allows users to invest a specified amount of DAI into the Aave lending pool. The key steps are: • Approving the Aave Pool to pull DAI funds from the user. • Supplying the specified amount of DAI to the Aave Pool. • Borrowing GHO tokens from the Aave Pool based on the invested DAI. • Approving the vault to spend the borrowed GHO tokens. • Transferring the borrowed GHO tokens to the vault for further management.
The send function facilitates the transfer of GHO tokens from one address to another with an optional fee. The steps include: • Approving the Aave Pool to pull DAI funds from the sender. • Supplying the specified amount of DAI to the Aave Pool. • Borrowing GHO tokens from the Aave Pool based on the supplied DAI amount. • Permitting the contract to spend GHO tokens on behalf of the sender. • Transferring the specified amount of GHO tokens to the receiver. • Deducting a fee from the sender and transferring it to the contract deployer (msg.sender).