Transaction Flows
Vault creation
Lender calls the deployVault
function available in the RegistryV2.sol. Factory internally creates the DelegatedLenderVault and initializes it with a Strategy contract.
Loan Creation
The Borrower approves the DLV to use the collateral token. Then the Borrower calls the createLoan
function on DLV. The DLV now calls the deployLoan
function on the RegistryV2.sol to create a new loan.
Repay
To repay the borrow token, the Borrower approves the Loan.sol to use the borrow token. Borrower calls repay
function on the LoanV2.sol. The Loan contract then transfers the collateral token back to the Borrower. The Loan contract calls the safeTransferFrom
to transfer the borrowed assets back to the Vault.
Seize Collateral
If the Borrower doesn't repay the loan amount, the Lender can seize the collateral. The Lender calls the seizeCollateral
function on the LoanV2.sol. The Loan contract transfers the collateral from the Loan to the DelegatedLenderVault.sol. The Lender can withdraw the collateral from the Vault anytime.