SiloRepository
SiloRepository
SiloRepository handles the creation and configuration of Silos.
Stores configuration for each asset in each silo. Each asset in each Silo starts with a default config can later be changed by the contract owner. Stores registry of Factory contracts that deploy different versions of Silos. It is possible to have multiple versions/implementations of Silo and use different versions for different tokens. For example, one version can be used for UNI (ERC20) and the other can be used for UniV3LP tokens (ERC721). Manages bridge assets. Each Silo can have 1 or more bridge assets. New Silos are created with all currently active bridge assets. Silos that are already developed must synchronize bridge assets. Sync can be done by anyone, function has public access. Is a single source of truth for other contract addresses.
function acceptOwnership() external nonpayable
Transfers ownership of the contract to a pending owner Can only be called by the pending owner.
function addBridgeAsset(address _newBridgeAsset) external nonpayable
Adds new bridge asset
New bridge asset must be unique. Duplicates in bridge assets are not allowed. It's possible to add bridge asset that has been removed in the past. Note that all Silos must be synced manually. Callable only by owner.
Name | Type | Description |
---|---|---|
_newBridgeAsset | address | bridge asset address |
function assetConfigs(address, address) external view returns (uint64 maxLoanToValue, uint64 liquidationThreshold, contract IInterestRateModel interestRateModel)
maps silo => asset => config
Name | Type | Description |
---|---|---|
_0 | address | undefined |
_1 | address | undefined |
Name | Type | Description |
---|---|---|
maxLoanToValue | uint64 | undefined |
liquidationThreshold | uint64 | undefined |
interestRateModel | contract IInterestRateModel | undefined |
function bridgePool() external view returns (address)
Silo for bridge asset. We can have only one bridge pool
Name | Type | Description |
---|---|---|
_0 | address | undefined |
function defaultAssetConfig() external view returns (uint64 maxLoanToValue, uint64 liquidationThreshold, contract IInterestRateModel interestRateModel)
Default values for AssetConfig. Used if values are not configured manually.
Name | Type | Description |
---|---|---|
maxLoanToValue | uint64 | undefined |
liquidationThreshold | uint64 | undefined |
interestRateModel | contract IInterestRateModel | undefined |
function ensureCanCreateSiloFor(address _asset, bool _assetIsABridge) external view
checks all conditions for new silo creation and throws when not possible to create
Name | Type | Description |
---|---|---|
_asset | address | address of asset for which you want to create silo |
_assetIsABridge | bool | bool TRUE when _asset is bridge asset, FALSE when it is not |
function entryFee() external view returns (uint256)
Get protocol fee for opening a borrow position
Name | Type | Description |
---|---|---|
_0 | uint256 | fee in precision points (BaseSilo.PRECISION_DECIMALS() == 100%) |
function fees() external view returns (uint64 entryFee, uint64 protocolShareFee, uint64 protocolLiquidationFee)
Name | Type | Description |
---|---|---|
entryFee | uint64 | undefined |
protocolShareFee | uint64 | undefined |
protocolLiquidationFee | uint64 | undefined |
function getBridgeAssets() external view returns (address[])
Get current bridge assets
Keep in mind that not all Silos may be synced with current bridge assets so it's possbile that some assets in that list are not part of given Silo.
Name | Type | Description |
---|---|---|
_0 | address[] | address array of bridge assets |
function getInterestRateModel(address _silo, address _asset) external view returns (contract IInterestRateModel model)
Get Interest Rate Model address for asset in given Silo
If dedicated config is not set, method returns default config
Name | Type | Description |
---|---|---|
_silo | address | address of Silo |
_asset | address | address of an asset |
Name | Type | Description |
---|---|---|
model | contract IInterestRateModel | address of interest rate model |
function getLiquidationThreshold(address _silo, address _asset) external view returns (uint256)
Get liquidation threshold for asset in given Silo
If dedicated config is not set, method returns default config
Name | Type | Description |
---|---|---|
_silo | address | address of Silo |
_asset | address | address of an asset |
Name | Type | Description |
---|---|---|
_0 | uint256 | liquidation threshold in precision points (BaseSilo.PRECISION_DECIMALS()) |
function getMaxSiloDeposits(address _silo, address _asset) external view returns (uint256)
Gets deposit limit for Silo
Name | Type | Description |
---|---|---|
_silo | address | Silo address for which to set limit |
_asset | address | Silo asset for which to set limit |
Name | Type | Description |
---|---|---|
_0 | uint256 | deposit limit for Silo |
function getMaximumLTV(address _silo, address _asset) external view returns (uint256)
Get maximum LTV for asset in given Silo
If dedicated config is not set, method returns default config
Name | Type | Description |
---|---|---|
_silo | address | address of Silo |
_asset | address | address of an asset |
Name | Type | Description |
---|---|---|
_0 | uint256 | maximum LTV in precision points (BaseSilo.PRECISION_DECIMALS()) |
function getNotificationReceiver(address) external view returns (contract INotificationReceiver)
Maps Silo address to incentive contract that will distribute rewards for that Silo
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Name | Type | Description |
---|---|---|
_0 | contract INotificationReceiver | undefined |
function getRemovedBridgeAssets() external view returns (address[])
Get removed bridge assets
Keep in mind that not all Silos may be synced with bridge assets so it's possbile that some assets in that list are still part of given Silo.
Name | Type | Description |
---|---|---|
_0 | address[] | address array of bridge assets |
function getSilo(address) external view returns (address)
maps token address to silo address, asset => silo
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Name | Type | Description |
---|---|---|
_0 | address | undefined |
function isPaused() external view returns (bool globalPause)
Name | Type | Description |
---|---|---|
globalPause | bool | undefined |
function isSilo(address _silo) external view returns (bool)
Check if contract address is a Silo deployment
Name | Type | Description |
---|---|---|
_silo | address | address of expected Silo |
Name | Type | Description |
---|---|---|
_0 | bool | true if address is Silo deployment, otherwise false |
function isSiloPaused(address _silo, address _asset) external view returns (bool)
Check given asset in a Silo is paused
Name | Type | Description |
---|---|---|
_silo | address | address of Silo |
_asset | address | address of an asset |
Name | Type | Description |
---|---|---|
_0 | bool | true if given asset in a Silo is paused, otherwise false |
function maxLiquidity() external view returns (bool globalToggle, uint256 defaultMaxLiquidity)
Name | Type | Description |
---|---|---|
globalToggle | bool | undefined |
defaultMaxLiquidity | uint256 | undefined |
function newSilo(address _siloAsset, uint128 _siloVersion, bytes _siloData) external nonpayable
use this method only when off-chain verification is OFF
Silo does NOT support rebase and deflationary tokens
Name | Type | Description |
---|---|---|
_siloAsset | address | silo asset |
_siloVersion | uint128 | version of silo implementation |
_siloData | bytes | (optional) data that may be needed during silo creation |
function owner() external view returns (address)
Get owner role address of Repository
Name | Type | Description |
---|---|---|
_0 | address | owner role address |
function pendingOwner() external view returns (address)
Returns the address of the pending owner.
Name | Type | Description |
---|---|---|
_0 | address | undefined |
function priceProvidersRepository() external view returns (contract IPriceProvidersRepository)
PriceProvidersRepository contract that manages ProceProviders implementations and is an entry point for reading prices for Silos.
Name | Type | Description |
---|---|---|
_0 | contract IPriceProvidersRepository | undefined |
function protocolLiquidationFee() external view returns (uint256)
Get protocol liquidation fee
Name | Type | Description |
---|---|---|
_0 | uint256 | protocol liquidation fee in precision points (BaseSilo.PRECISION_DECIMALS() == 100%) |
function protocolShareFee() external view returns (uint256)
Get protocol share fee
Name | Type | Description |
---|---|---|
_0 | uint256 | protocol share fee in precision points (BaseSilo.PRECISION_DECIMALS() == 100%) |
function registerSiloVersion(contract ISiloFactory _factory, bool _isDefault) external nonpayable
Registers new Silo version
User can choose which Silo version he wants to deploy. It's possible to have multiple versions of Silo. Callable only by owner.
Name | Type | Description |
---|---|---|
_factory | contract ISiloFactory | factory contract that deploys new version of Silo |
_isDefault | bool | true if this version should be used as default |
function removeBridgeAsset(address _bridgeAssetToRemove) external nonpayable
Removes bridge asset
Note that all Silos must be synced manually. Callable only by owner.
Name | Type | Description |
---|---|---|
_bridgeAssetToRemove | address | bridge asset address to be removed |
function renounceOwnership() external nonpayable
Leaves the contract without owner. It will not be possible to call
onlyOwner
functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.function replaceSilo(address _siloAsset, uint128 _siloVersion, bytes _siloData) external nonpayable
use this method to deploy new version of Silo for an asset that already has Silo deployed. Only owner (DAO) can replace.
Silo does NOT support rebase and deflationary tokens
Name | Type | Description |
---|---|---|
_siloAsset | address | silo asset |
_siloVersion | uint128 | version of silo implementation. Use 0 for default version which is fine for 99% of cases. |
_siloData | bytes | (optional) data that may be needed during silo creation |
function router() external view returns (address)
SiloRouter utility contract that combines number of actions (Deposit, Withdraw, Borrow, Repay) for batch execution in single transaction.
Name | Type | Description |
---|---|---|
_0 | address | undefined |
function setAssetConfig(address _silo, address _asset, ISiloRepository.AssetConfig _assetConfig) external nonpayable
Set configuration for given asset in given Silo
Callable only by owner
Name | Type | Description |
---|---|---|
_silo | address | Silo address for which config applies |
_asset | address | asset address for which config applies |
_assetConfig | ISiloRepository.AssetConfig | : - _maxLoanToValue maximum Loan-to-Value, for detailes see Repository.AssetConfig.maxLoanToValue - _liquidationThreshold liquidation threshold, for detailes see Repository.AssetConfig.maxLoanToValue - _interestRateModel interest rate model address, for detailes see Repository.AssetConfig.interestRateModel |
function setDefaultInterestRateModel(contract IInterestRateModel _defaultInterestRateModel) external nonpayable
Set default interest rate model
Callable only by owner
Name | Type | Description |
---|---|---|
_defaultInterestRateModel | contract IInterestRateModel | default interest rate model |
function setDefaultLiquidationThreshold(uint64 _defaultLiquidationThreshold) external nonpayable
Set default liquidation threshold
Callable only by owner
Name | Type | Description |
---|---|---|
_defaultLiquidationThreshold | uint64 | default liquidation threshold in precision points (BaseSilo.PRECISION_DECIMALS()) |
function setDefaultMaximumLTV(uint64 _defaultMaxLTV) external nonpayable
Set default maximum LTV
Callable only by owner
Name | Type | Description |
---|---|---|
_defaultMaxLTV | uint64 | default maximum LTV in precision points (BaseSilo.PRECISION_DECIMALS()) |
function setDefaultSiloMaxDepositsLimit(uint256 _maxDeposits) external nonpayable
Sets default deposit limit for all Silos
Name | Type | Description |
---|---|---|
_maxDeposits | uint256 | deposit limit amount in ETH |
function setDefaultSiloVersion(uint128 _defaultVersion) external nonpayable
Set default Silo version
Callable only by owner.
Name | Type | Description |
---|---|---|
_defaultVersion | uint128 | Silo version to be set as default |
function setFees(ISiloRepository.Fees _fees) external nonpayable
Set default fees
Callable only by owner
Name | Type | Description |
---|---|---|
_fees | ISiloRepository.Fees | : - _entryFee one time protocol fee for opening a borrow position in precision points (BaseSilo.PRECISION_DECIMALS()) - _protocolShareFee protocol revenue share in interest paid in precision points (BaseSilo.PRECISION_DECIMALS()) - _protocolLiquidationFee protocol share in liquidation profit in precision points (BaseSilo.PRECISION_DECIMALS()). It's calculated from total collateral amount to be transferred to liquidator. |
function setGlobalPause(bool _globalPause) external nonpayable
Pause all Silos
Callable only by owner.
Name | Type | Description |
---|