Converts token amounts into their equivalent USD values using one of three supported adapters:
Oracle Ids:
Adapter identifiers are hardcoded as keccak256 hashes of their names:
bytes32 public constant REDSTONE_ORACLE_ID = keccak256("REDSTONE_ADAPTER_ID");
bytes32 public constant CHAINLINK_ORACLE_ID = keccak256("CHAINLINK_ADAPTER_ID");
bytes32 public constant UNISWAP_ORACLE_ID = keccak256("UNISWAP_ADAPTER_ID");
These IDs must be mapped to their corresponding adapter contracts using (Guardian only):
function updateOracleAdapter(bytes32 _oracleId, address _adapter, bool isPull) external onlyGuardian {
adapters[_oracleId] = Adapter(_adapter, isPull);
emit AdapterUpdated(_oracleId, _adapter, isPull);
}
_oracleId: One of the predefined Oracle IDs_adapter: Address of the adapter contractisPull: Whether the adapter uses a pull-based pricing modelOnly Chainlink, Redstone, and Uniswap are supported. Adding new adapters requires a contract upgrade.
Also removeOracleAdapter can be used to delete the assigned adapter to an oracle Id:
function removeOracleAdapter(bytes32 _oracleId) external onlyGuardian { if (adapters[_oracleId].adapter == address(0)) { revert AdapterDoesNotExist(); }
delete adapters[_oracleId];
emit AdapterRemoved(_oracleId);
}
Assigning oracle ids to tokens:
Each token can be assigned a specific price oracle adapter. Once configured, the AspisLiquidityCalculatorV3 will exclusively use the assigned adapter to fetch that token’s price. Configuration functions (Guardian-restricted):
function setOracleForToken(address _token, bytes32 _oracleId) external onlyGuardian {}
function setOracleForTokens(address[] memory _tokens, bytes32[] memory _oracleIds) external onlyGuardian {}
_token: address of token to update the adapter for.*