Check position
Check position
This tutorial will show you how to get data about deposits, borrows, and other position data.
Everything you need in one file
The tutorial source code is ready to be executed as a Foundry test in this file. The file contains all use cases and all comments from this page. Refer to the file for a forking setup and smart contract interfaces.
Code interacts with the wstETH / WETH silo market. SILO0 is the wstETH ERC4626 vault, SILO1 is the WETH ERC4626 vault. Silo protocol is permissionless, anyone can deploy the market for the same pair of assets using different market setup.
Get borrowable deposit amount
Get an amount of user's deposited assets. ERC4626 shares represent borrowable deposits that earn interest.
Get deposit APR
10**18 current interest rate is equal to 100%/year.
Get protected deposit amount
When liquidity is fully borrowed out, deposits cannot be withdrawn. However, when the deposit is made as Protected (non-borrowable), which doesn't earn interest, the depositor can remove it at any time,
Get full deposit amount (borrowable deposits + protected deposits)
Use SiloLens contracts can to get the total of borrowable + protected deposits per user.
Get borrowed amount
Here is an example of a user supplying ETH collateral in silo1 and borrowing wstETH in silo0. Interest continually accrues to the growing user's debt. In the example, we calculate the user's borrowed amount as the repayable amount.
Get borrow APR
10**18 current interest rate is equal to 100%/year.
Get Loan-to-Value ratio (LTV)
0.5 * 10**18 LTV is for a position with 10$ collateral and 5$ borrowed assets.
Get solvency
Check if the user is solvent. Borrow positions can be liquidated for insolvent positions.
Last updated