SiloLens
SiloLens
Utility contract that simplifies reading data from Silo protocol contracts
Methods
balanceOfUnderlying
Get underlying balance of collateral or debt token
You can think about debt and collateral tokens as cToken in compound. They represent ownership of debt or collateral in given Silo. This method converts that ownership to exact amount of underlying token.
Parameters
Returns
borrowAPY
Yearly interest rate for borrowing asset token, dynamically calculated for current block timestamp
Parameters
Returns
borrowShare
Get debt token balance of a user
Debt token represents a share in total debt of given asset. This method calls balanceOf(_user) on that token.
Parameters
Returns
calcFee
Calculate amount of entry fee for given amount
Parameters
Returns
calculateBorrowValue
Calculate value of borrowed asset by user
It dynamically adds interest earned to borrowed amount
Parameters
Returns
calculateCollateralValue
Calculate value of collateral asset for user
It dynamically adds interest earned. Takes for account collateral only deposits as well.
Parameters
Returns
collateralBalanceOfUnderlying
Get underlying balance of all deposits of given token of given user including "collateralOnly" deposits
It reads directly from storage so interest generated between last update and now is not taken for account
Parameters
Returns
collateralOnlyDeposits
Get amount of asset token that has been deposited to Silo with option "collateralOnly"
It reads directly from storage so interest generated between last update and now is not taken for account
Parameters
Returns
debtBalanceOfUnderlying
Get amount of debt of underlying token for given user
It reads directly from storage so interest generated between last update and now is not taken for account
Parameters
Returns
depositAPY
Yearly interest rate for depositing asset token, dynamically calculated for current block timestamp
Parameters
Returns
getBorrowAmount
Calculates current borrow amount for user with interest
Interest is calculated based on the provided timestamp with is expected to be current time.
Parameters
Returns
getModel
gets interest rates model object
Parameters
Returns
getUserLTV
Returns Loan-To-Value for an account
Each Silo has multiple asset markets (bridge assets + unique asset). This function calculates a sum of all deposits and all borrows denominated in ETH. Returns fraction between borrow value and deposit value with 18 decimals.
Parameters
Returns
getUserLiquidationThreshold
Get combined liquidation threshold for a user
Methodology for calculating liquidation threshold is as follows. Each Silo is combined form multiple assets (bridge assets + unique asset). Each of these assets may have different liquidation threshold. That means effective liquidation threshold must be calculated per asset based on current deposits and borrows of given account.
Parameters
Returns
getUserMaximumLTV
Get combined maximum Loan-To-Value for a user
Methodology for calculating maximum LTV is as follows. Each Silo is combined form multiple assets (bridge assets + unique asset). Each of these assets may have different maximum Loan-To-Value for opening borrow position. That means effective maximum LTV must be calculated per asset based on current deposits and borrows of given account.
Parameters
Returns
getUtilization
Calculates fraction between borrowed and deposited amount of tokens for given asset denominated in percentage
Utilization is calculated current values in storage so it does not take for account earned interest and ever-increasing total borrow amount. It assumes 1e18 = 100%.
Parameters
Returns
inDebt
Check if user is in debt
Parameters
Returns
lensPing
Method for sanity check
Returns
liquidity
Amount of token that is available for borrowing.
Parameters
Returns
protocolFees
Get amount of fees earned by protocol to date
It reads directly from storage so interest generated between last update and now is not taken for account
Parameters
Returns
siloRepository
Returns
totalBorrowAmount
Get amount of asset that has been borrowed
It reads directly from storage so interest generated between last update and now is not taken for account
Parameters
Returns
totalBorrowAmountWithInterest
returns total borrow amount with interest dynamically calculated at current block timestamp
Parameters
Returns
totalBorrowShare
Get totalSupply of debt token
Debt token represents a share in total debt of given asset
Parameters
Returns
totalDeposits
Get amount of asset token that has been deposited to Silo
It reads directly from storage so interest generated between last update and now is not taken for account
Parameters
Returns
totalDepositsWithInterest
returns total deposits with interest dynamically calculated at current block timestamp
Parameters
Returns
Errors
IncorrectDataLength
Last updated