Vaults
INFO
Vault is a smart contract that Lenders use to store their Assets and Intents.
Lenders create Vaults to deposit assets. They program their intents into the Vault based on the assets deposited. Loans are passively created by the Borrowers and the Matching Filter based on the terms set by the Lenders' Intents.
How is a Vault deployed?
MethLab uses minimal proxy clones to deploy Vaults. The Factory.sol contains the logic. Lenders call the deployVault
function to create a LenderVault.sol.
// Factory.sol
function deployVault() external returns (address vault) {}
Once the Vault is deployed, the lenders can write Intents and deposit assets. Funds can be deposited into the vaults anytime.
There is a Composition relationship between Intent and IntentCollection, a Vault can comprise of multiple intent collections. Collections can be created using createIntentCollection function available in the Vault contract.
Relationship between Vault & Intent Collection.
The borrower interacts with a particular LenderVault to create a Loan and borrow assets. But all of this is abstracted by LoanExecutor contract, Matching Filter and the user interface.
Pause
Vaults have a pause functionality. The pauseVault
allows Lenders to pause the Vault. It does not affect any on-going Loans. Once a Vault is paused, borrowers can not make any more Loans using the intents of the Vault. Similarly, the Vaults can be unpaused using unpauseVault
function.