This contract records all loans created in the system. Borrowers interact with this contract to
Create a new loan
Partially / wholly repay their loan
Withdraw remaining collateral from liquidated loans
View active, closed, and liquidated loans
Dao-only
Function
Params
Description
initialize
LSTcontract, marketDao
Called only by the ProtocolDao, but initiated by the Deployer. Stores the following information
LST Token contract address
MarketDao address
Common
Function
Params
Description
avail_loan
currency, expiry, underlying, strike_price, X
The caller of this function is typically the borrower, who wishes to borrow X amount of the currency as loan, which she hopes to repay on or before the given expiry. In her balance, the borrower should have:
X amount of ITokens for the given currency and expiry.
X amount of STokens for the given currency, expiry, underlying, and strike_price.
Xstrike_price amount of FTokens for the given underlying and expiry.
Note: The tokens above are stored in the MarketDao until whichever occurs earlier:
Borrower repays the loan.
Loan market expires.
repay_loan
id, Y
The caller of this function is typically the borrower, who has already borrowed a loan and now wishes to repay Y amount of the loan. Note: The caller will need to authorize the CurrencyDAO to transfer Y amount of currency.
close_liquidated_loan
id
This function can be called by anyone. In this function, any remaining collateral after liquidation of the loan with the given id is sent to its borrower. Note: The loan is liquidated during the auction period after the expiry of the corresponding loan market. Since the auction is active until either all FUnderlying has been sold or the required currency amount has been raised, this function will work only after the auction is closed, aka, the corresponding loan market has been settled.