Silo
ISilo
Silo is the main component of the protocol. It implements lending logic, manages and isolates risk, acts as a vault for assets, and performs liquidations. Each Silo is composed of the unique asset for which it was created (ie. UNI) and bridge assets (ie. ETH and SiloDollar). There may be multiple bridge assets at any given time.
Main Silo contact that inherits from Base contract. It implements all user/UI facing methods.
Methods
ASSET_DECIMAL_POINTS
Returns
VERSION
It tells us which SiloRepository.siloFactory(version)
created this Silo
Returns
accrueInterest
Function to update interests for _asset
token since the last saved state
Parameters
allSiloAssets
Parameters
Returns
assetInterestData
Parameters
Returns
assetStorage
Get asset storage data
Parameters
Returns
borrow
Borrow _amount
of _asset
tokens from the Silo to msg.sender
Parameters
borrowFor
Router function to borrow _amount
of _asset
tokens from the Silo for the _receiver
Parameters
borrowPossible
Check if borrowing an asset for given account is possible
Borrowing an asset that has been already deposited (and vice versa) is disallowed
Parameters
Returns
deposit
Deposit _amount
of _asset
tokens from msg.sender
to the Silo
Parameters
depositFor
Router function to deposit _amount
of _asset
tokens to the Silo for the _depositor
Parameters
depositPossible
Check if depositing an asset for given account is possible
Depositing an asset that has been already borrowed (and vice versa) is disallowed
Parameters
Returns
flashLiquidate
this methods does not requires to have tokens in order to liquidate user
during liquidation process, msg.sender will be notified once all collateral will be send to him msg.sender needs to be IFlashLiquidationReceiver
Parameters
Returns
getAssets
Returns all initialized (synced) assets of Silo including current and removed bridge assets
Returns
getAssetsWithState
Returns all initialized (synced) assets of Silo including current and removed bridge assets with corresponding state
Returns
harvestProtocolFees
harvest protocol fees from an array of assets
Parameters
initAssetsTokens
this is exposed only for test purposes, but it is safe to leave it like that
interestData
Get asset interest data
Parameters
Returns
isSolvent
Calculates solvency of an account
Parameters
Returns
repay
Repay _amount
of _asset
tokens from msg.sender
to the Silo
Parameters
repayFor
Allows to repay in behalf of borrower to execute liquidation
Parameters
siloAsset
Returns
siloRepository
Get Silo Repository contract address
Returns
state
Parameters
Returns
syncBridgeAssets
Synchronize current bridge assets with Silo
This function needs to be called on Silo deployment to setup all assets for Silo. It needs to be called every time a bridged asset is added or removed. When bridge asset is removed, depositing and borrowing should be disabled during asset sync.
utilizationData
helper method for InterestRateModel calculations
Parameters
Returns
withdraw
Withdraw _amount
of _asset
tokens from the Silo to msg.sender
Parameters
withdrawFor
Router function to withdraw _amount
of _asset
tokens from the Silo for the _depositor
Parameters
Events
Borrow
Emitted on asset borrow
Parameters
Deposit
Emitted when deposit is made
Parameters
Liquidate
Emitted on user liquidation
Parameters
Repay
Emitted on asset repay
Parameters
Withdraw
Emitted when withdraw is made
Parameters
Errors
IncorrectDataLength
Last updated