Reserve Oracle
Last updated
Last updated
The Reserve Oracle contract accounts price data for the reserves in the Unlockd protocol and manages price sources. The protocol’s LendPool contract uses it as a source of truth for reserves prices, which are updated by Chainlink Price Feeds and Aggregators. Aggregators are added to the Oracle and tracked by a mapping, which maps each unique key (_priceFeedKeys)
to a single aggregator address. Each aggregator then provides price data for a specific reserve.
The source code of the proxy reserve price provider can be found on Github.
Always get the latest reserve price oracle address by calling getReserveOracle()
on the LendPoolAddressesProvider
contract.
function getAssetPrice(address _priceFeedKey) external view override returns (uint256)
Returns the price for a specific reserve
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
function getAggregator(address _priceFeedKey) public view returns (AggregatorV3Interface)
Returns the aggregator address for a given price feed key
function getLatestTimestamp(address _priceFeedKey) public view returns (uint256)
Returns the aggregator's latest timestamp
function getTwapPrice(address _priceFeedKey, uint256 _interval) external view override returns (uint256)
Returns the TWAP price for a reserve, depending on _interval
function isExistedKey(address _priceFeedKey) private view returns (bool)
Checks if the pricefeed key exists in the pricefeeds currently tracked by the oracle.
function getPriceFeedLength() public view returns (uint256 length)
Returns the amount of pricefeeds tracked by the oracle.
function setAggregators(address[] calldata _priceFeedKeys, address[] calldata _aggregators) external onlyOwner
Sets a list of pricefeed aggregators to be tracked by the oracle.
function addAggregator(address _priceFeedKey, address _aggregator) external onlyOwner
Adds a single pricefeed aggregator to be tracked by the oracle.
function removeAggregator(address _priceFeedKey) external onlyOwner
Removes a single pricefeed aggregator from the tracked pricefeeds currently tracked by the oracle.
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|