CoreOracle

The contract provides price feeds to other contracts, such as the BlueberryBank.sol Contract

State Variables

The CoreOracle contract contains the following state variables:

routes

mapping(address => address) public routes;

This mapping stores the oracle source routes for tokens. For each token address t, the mapping stores the oracle source route address for t.

liqThresholds

mapping(address => uint256) public liqThresholds;

This mapping stores the liquidation threshold for tokens. The number is multiplied by 1e4. For volatile tokens 85% and 90% for stablecoins as a negative Profit loss on the position in comparison to the supplied tokens as isolated collateral.

whitelistedERC1155

mapping(address => bool) public whitelistedERC1155;

This mapping stores the wrapper addresses for the whitelisted status of ERC1155 tokens in the protocol.

Functions

initialize

function initialize() external initializer

This function initializes the CoreOracle contract. It is called during contract deployment.

setRoutes

function setRoutes(address[] calldata tokens, address[] calldata oracleRoutes) external onlyOwner

This function sets the oracle source routes for tokens. It takes two arrays as inputs, tokens and oracleRoutes, both of which must have the same length. For each index i, the function sets the oracle source route for the token at index i to the address in oracleRoutes[i].

setLiqThresholds

function setLiqThresholds(address[] memory tokens, uint256[] memory thresholds) external onlyOwner

This function sets the token liquidation thresholds. It takes two arrays as inputs, tokens and thresholds, both of which must have the same length. For each index i, the function sets the liquidation threshold for the token at index i to the value in thresholds[i].

setWhitelistERC1155

function setWhitelistERC1155(address[] memory tokens, bool ok) external onlyOwner

This function whitelists ERC1155 tokens. It takes an array tokens of tokens to whitelist and a boolean ok indicating whether to whitelist or blacklist the tokens. For each token in tokens, the function sets its whitelist status to the value in ok.

_getPrice

function _getPrice(address token) internal view returns (uint256)

This internal function returns the USD price of a given token, multiplied by 10^18.

getPrice

function getPrice(address token) external view override returns (uint256)

This function returns the USD price of a given token, multiplied by 10^18

isWrappedTokenSupported

function isWrappedTokenSupported(address token,uint256 tokenId) external view override returns (bool)

This function returns a boolean indicating whether the oracle supports the underlying token of a given wrapper token. Only validate wrappers of Blueberry protocol such as WERC20

isTokenSupported

function isTokenSupported(address token) external view override returns (bool)

This function returns a boolean indicating whether the oracle supports a given ERC20 token.

Last updated