Skip to main content

Oracle

To manage the price of assets in the protocol, we need a way to get the price of assets during strategy operations execution. The Portal oracle module provides a flexible price feed system through oracle aggregation with custom oracle creation capabilities.

Supported Oracle Sources

  • Chainlink
  • Majora custom oracles

Custom Oracle Creation

We can create and integrate our own oracles into the aggregator. The price is computed by our operators and the price is submitted to the chain. Assets prices are labeled in USD with 8 decimals.

Usage

getOracleRate

Get the price of an asset _from in the given currency _to.

function getOracleRate(
address _from,
address _to,
uint256 _amount
) external view returns (uint256)

getOracleRate

Get the prices of a list of assets _from in the given currencies _to.

function getOracleRates(
address[] memory _froms,
address[] memory _to,
uint256[] memory _amount
) external view returns (uint256[] memory)

getUSDOraclePrice

Get the price of an asset _assets in USD.

function getUSDOraclePrice(
address _assets
) external view returns (uint256)

getUSDOraclePrices

Get the prices of a list of assets _assets in USD.

function getUSDOraclePrices(
address[] memory _assets
) external view returns (uint256[] memory)

updateOraclePrice

Update the price of an asset _addresses in USD.

function updateOraclePrice(
address[] memory _addresses,
uint256[] memory _prices
) external

oraclePricesAreEnable

Check if the prices of a list of assets _assets are enabled.

function oraclePricesAreEnable(
address[] calldata _assets
) external view returns (bool[] memory)

getOracleConfiguration

Get the configuration of an asset _asset.

function getOracleConfiguration(address _asset) external view returns (LibOracle.OracleEntry memory configuration)

configureOracle

Configure an asset _asset.

function configureOracle(
bool _enabled,
address _asset,
uint8 _assetDecimals,
StrategOracleAdaptersType _adapterType,
address _adapter
) external

Where:

  • _enabled is the status of the oracle.
  • _asset is the address of the asset.
  • _assetDecimals is the number of decimals of the asset.
  • _adapterType is the type of adapter.
  • _adapter is the address of the adapter.

batchConfigureOracle

Configure a list of assets _assets.

function batchConfigureOracle(
bool[] calldata _enabled,
address[] calldata _asset,
uint8[] calldata _assetDecimals,
StrategOracleAdaptersType[] calldata _adapterType,
address[] calldata _adapter
) external

Where:

  • _enabled is the status of the oracle.
  • _asset is the address of the asset.
  • _assetDecimals is the number of decimals of the asset.
  • _adapterType is the type of adapter.
  • _adapter is the address of the adapter.