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

NameTypeDescription

_provider

contract IPriceProvider

undefined

changeManager

function changeManager(address _manager) external nonpayable

Change manager address

Callable by manager or external owner role

Parameters

NameTypeDescription

_manager

address

new manager address

getPrice

function getPrice(address _asset) external view returns (uint256)

Returns "Time-Weighted Average Price" for an asset

Parameters

NameTypeDescription

_asset

address

address of an asset for which to read price

Returns

NameTypeDescription

_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

NameTypeDescription

_provider

contract IPriceProvider

address of price provider to be removed

Returns

NameTypeDescription

_0

bool

true if address is a registered price provider, otherwise false

manager

function manager() external view returns (address)

Gets manager role address

Returns

NameTypeDescription

_0

address

manager role address

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription

_0

address

undefined

pendingOwner

function pendingOwner() external view returns (address)

Returns the address of the pending owner.

Returns

NameTypeDescription

_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

NameTypeDescription

_0

address

undefined

Returns

NameTypeDescription

_0

contract IPriceProvider

undefined

priceProvidersRepositoryPing

function priceProvidersRepositoryPing() external pure returns (bool)

Sanity check funciton

Returns

NameTypeDescription

_0

bool

returns always TRUE

providerList

function providerList() external view returns (address[])

Gets an array of price providers

Returns

NameTypeDescription

_0

address[]

array of price providers

providersCount

function providersCount() external view returns (uint256)

Gets number of pice providers registerd

Returns

NameTypeDescription

_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

NameTypeDescription

_asset

address

asset address to check

Returns

NameTypeDescription

_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

NameTypeDescription

_0

address

undefined

removePriceProvider

function removePriceProvider(contract IPriceProvider _provider) external nonpayable

Unregister price provider

Parameters

NameTypeDescription

_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

NameTypeDescription

_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

NameTypeDescription

_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

NameTypeDescription

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

NameTypeDescription

newPendingOwner

address

undefined

Events

ManagerChanged

event ManagerChanged(address manager)

Emitted when manager is changed

Parameters

NameTypeDescription

manager

address

undefined

NewPriceProvider

event NewPriceProvider(contract IPriceProvider newPriceProvider)

Emitted when price provider is added

Parameters

NameTypeDescription

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

NameTypeDescription

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

NameTypeDescription

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

NameTypeDescription

asset indexed

address

undefined

priceProvider

contract IPriceProvider

undefined

PriceProviderRemoved

event PriceProviderRemoved(contract IPriceProvider priceProvider)

Emitted when price provider is removed

Parameters

NameTypeDescription

priceProvider

contract IPriceProvider

undefined

Last updated