PriceProvidersRepository
PriceProvidersRepository
A repository of price providers. It manages price providers as well as maps assets to their price provider. It acts as a entry point for Silo for token prices.

Methods

acceptOwnership

function acceptOwnership() external nonpayable
Transfers ownership of the contract to a pending owner Can only be called by the pending owner.

addPriceProvider

function addPriceProvider(contract IPriceProvider _provider) external nonpayable
Register new price provider

Parameters

Name
Type
Description
_provider
contract IPriceProvider
undefined

changeManager

function changeManager(address _manager) external nonpayable
Change manager address
Callable by manager or external owner role

Parameters

Name
Type
Description
_manager
address
new manager address

getPrice

function getPrice(address _asset) external view returns (uint256)
Returns "Time-Weighted Average Price" for an asset

Parameters

Name
Type
Description
_asset
address
address of an asset for which to read price

Returns

Name
Type
Description
_0
uint256
TWAP price of a token with 18 decimals

isPriceProvider

function isPriceProvider(contract IPriceProvider _provider) external view returns (bool)
Returns true if address is a registered price provider

Parameters

Name
Type
Description
_provider
contract IPriceProvider
address of price provider to be removed

Returns

Name
Type
Description
_0
bool
true if address is a registered price provider, otherwise false

manager

function manager() external view returns (address)
Gets manager role address

Returns

Name
Type
Description
_0
address
manager role address

owner

function owner() external view returns (address)
Returns the address of the current owner.

Returns

Name
Type
Description
_0
address
undefined

pendingOwner

function pendingOwner() external view returns (address)
Returns the address of the pending owner.

Returns

Name
Type
Description
_0
address
undefined

priceProviders

function priceProviders(address) external view returns (contract IPriceProvider)
Maps asset address to its price provider
Each asset must have a price provider contract assigned, otherwise it's not supported

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
contract IPriceProvider
undefined

priceProvidersRepositoryPing

function priceProvidersRepositoryPing() external pure returns (bool)
Sanity check funciton

Returns

Name
Type
Description
_0
bool
returns always TRUE

providerList

function providerList() external view returns (address[])
Gets an array of price providers

Returns

Name
Type
Description
_0
address[]
array of price providers

providersCount

function providersCount() external view returns (uint256)
Gets number of pice providers registerd

Returns

Name
Type
Description
_0
uint256
number of pice providers registerd

providersReadyForAsset

function providersReadyForAsset(address _asset) external view returns (bool)
Check if prices are available for an asset

Parameters

Name
Type
Description
_asset
address
asset address to check

Returns

Name
Type
Description
_0
bool
returns TRUE if price feed is ready, otherwise false

quoteToken

function quoteToken() external view returns (address)
Token in which prices are quoted. It's most likely WETH, however it could vary from deployment to deployment. For example 1 SILO costs X amount of quoteToken.

Returns

Name
Type
Description
_0
address
undefined

removePriceProvider

function removePriceProvider(contract IPriceProvider _provider) external nonpayable
Unregister price provider

Parameters

Name
Type
Description
_provider
contract IPriceProvider
undefined

renounceOwnership

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.

setPriceProviderForAsset

function setPriceProviderForAsset(address _asset, contract IPriceProvider _provider) external nonpayable
Sets price provider for asset
Request for asset price is forwarded to the price provider assigned to that asset

Parameters

Name
Type
Description
_asset
address
address of an asset for which price provider will be used
_provider
contract IPriceProvider
undefined

siloRepository

function siloRepository() external view returns (address)
SiloRepository contract address

Returns

Name
Type
Description
_0
address
undefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable
Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

Name
Type
Description
newOwner
address
undefined

transferPendingOwnership

function transferPendingOwnership(address newPendingOwner) external nonpayable
Transfers pending ownership of the contract to a new account (newPendingOwner). Can only be called by the current owner.

Parameters

Name
Type
Description
newPendingOwner
address
undefined

Events

ManagerChanged

event ManagerChanged(address manager)
Emitted when manager is changed

Parameters

Name
Type
Description
manager
address
undefined

NewPriceProvider

event NewPriceProvider(contract IPriceProvider newPriceProvider)
Emitted when price provider is added

Parameters

Name
Type
Description
newPriceProvider
contract IPriceProvider
undefined

OwnershipPending

event OwnershipPending(address indexed previousOwner, address indexed newOwner)
Emitted when ownership transfer is proposed, aka pending owner is set

Parameters

Name
Type
Description
previousOwner indexed
address
undefined
newOwner indexed
address
undefined

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Emitted when ownership is transferred on transferOwnership and acceptOwnership

Parameters

Name
Type
Description
previousOwner indexed
address
undefined
newOwner indexed
address
undefined

PriceProviderForAsset

event PriceProviderForAsset(address indexed asset, contract IPriceProvider priceProvider)
Emitted when asset is assigned to price provider

Parameters

Name
Type
Description
asset indexed
address
undefined
priceProvider
contract IPriceProvider
undefined

PriceProviderRemoved

event PriceProviderRemoved(contract IPriceProvider priceProvider)
Emitted when price provider is removed

Parameters

Name
Type
Description
priceProvider
contract IPriceProvider
undefined
Copy link
On this page
Methods
acceptOwnership
addPriceProvider
changeManager
getPrice
isPriceProvider
manager
owner
pendingOwner
priceProviders
priceProvidersRepositoryPing
providerList
providersCount
providersReadyForAsset
quoteToken
removePriceProvider
renounceOwnership
setPriceProviderForAsset
siloRepository
transferOwnership
transferPendingOwnership
Events
ManagerChanged
NewPriceProvider
OwnershipPending
OwnershipTransferred
PriceProviderForAsset
PriceProviderRemoved