Aave Credit Delegation
This project combines Bloom data on-ramps, Molecule NFTs, and Aave credit delegation v2 to create a novel unsecured lending application, known as an Unsecured Lending Vault. The vault enables investors to deposit any Aave supported asset into a lending pool controlled by the vault smart contract. The vault then opens unsecured credit lines to qualified borrowers that meet qualifications set by accredited risk assessors. Accredited risk assessors indicate their approval of a borrower by minting an NFT to an individual that has passed their off-chain, proprietary risk assessment process, and has entered into a traditional lending agreement with the lender. This diagram shows the basic entities & functionalities of the unsecured lending vault. https://static.swimlanes.io/485ba9985991ca2ccb96e83eee97dd81.png The risk assessor and lender can be separate entities, but often lenders will have in-house risk assessors. Investors can trade their liquidity provider positions with other investors which allows them to exit from their positions before lockup periods are complete. This also gives other investors exposure to the qualified borrowers of the accredited risk assessors. Borrowers complete KYC & Credit checks in the Bloom app, then share their information with the data on-ramp. the on-ramp evaluates the creditworthiness of the borrower and mints an NFT if they meet the specified requirements. The contract allows for multiple NFT contracts to represent different interest rate & credit limit terms
How It's Made
The contract is based on Aave's v2 credit delegation vault example. We added accounting for multiple investors and a ratio based system for tracking rewards and balances for investors. We added an NFT based system to qualify borrowers. NFT token IDs can only be used once. Different NFT addresses represent different borrowing terms. https://github.com/ipatka/MarketMake/blob/main/contracts/contracts/LendingVault.sol Borrowers completed KYC & Credit checks in the Bloom app (credit available in US only for now). Borrowers share information with a web page which checks the borrower's data against the risk assessor terms. If they qualify, the appropriate NFT is minted. The contract collects premium interest on top of the lending pool base interest. Premium interest is configured as a multiplier of base interest. The contract calculates the principal and total balance of the borrower in the lending pool, calculates the base interest, then multiplies it by the configured multiplier. Borrowers repay the loan via the lending vault contract so premium interest can be extracted and accounted for. Limitations The contract stores investor positions as a mapping that tracks the ratio of their investment to the total investment. In the future this should be replaced by an ERC20 liquidity provider token so they can trade their position. The contract can currently be gamed using flash loans to temporarily inflate the liquidity provider's ratio and claim outsized rewards. This should be mitigated by tracking block times of deposits and adding lockup periods for rewards. Premium interest rates are deposited into the lending pool and distributed via ratios to liquidity providers. It may be useful to track rewards separately from underlying asset pools so investors can draw rewards but leave initial capital in place. NFT minting is not fully hooked up. The contract is susceptible to manipulation by repaying the loan on the lending pool without going through the contract. The contract will revert if manipulation is detected, but it would still cause headaches and require manual intervention.