Oracle
Oracle contract relying on Chainlink for price
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
function EMERGENCY_ADMIN() external view returns (bytes32)
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
function GOVERNANCE() external view returns (bytes32)
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
function assetToOracles(address) external view returns (uint24 heartBeat, contract AggregatorV3Interface aggregator, bool isVaultAsset, int256 fixedPrice)
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Name | Type | Description |
---|---|---|
heartBeat | uint24 | undefined |
aggregator | contract AggregatorV3Interface | undefined |
isVaultAsset | bool | undefined |
fixedPrice | int256 | undefined |
function getPrice(address asset, int256 balance) external view returns (int256 price)
Get latest Chainlink price, except if a fixed price is defined for this asset
Use this getter for assets which are ERC-4626 vaultsPass the balance to account for slippage in the ERC4626 contract
Name | Type | Description |
---|---|---|
asset | address | Address of asset to fetch price for |
balance | int256 | Balance is only being used by getPrice if asset is a ERC-4626 token. 1e18 |
Name | Type | Description |
---|---|---|
price | int256 | undefined |
function getRoleAdmin(bytes32 role) external view returns (bytes32)
Returns the admin role that controls
role
. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
function gracePeriod() external view returns (uint256)
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
function grantRole(bytes32 role, address account) external nonpayable
Grants
role
to account
. If account
had not been already granted role
, emits a {RoleGranted} event. Requirements: - the caller must have role
's admin role. May emit a {RoleGranted} event.Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
function hasRole(bytes32 role, address account) external view returns (bool)
Returns
true
if account
has been granted role
.Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
function isEmergencyAdmin(address account) external view returns (bool)
Name | Type | Description |
---|---|---|
account | address | undefined |
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
function isGovernor(address account) external view returns (bool)
Name | Type | Description |
---|---|---|
account | address | undefined |
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
function renounceRole(bytes32 role, address account) external nonpayable
Revokes
role
from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role
, emits a {RoleRevoked} event. Requirements: - the caller must be account
. May emit a {RoleRevoked} event.Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
function revokeRole(bytes32 role, address account) external nonpayable
Revokes
role
from account
. If account
had been granted role
, emits a {RoleRevoked} event. Requirements: - the caller must have role
's admin role. May emit a {RoleRevoked} event.Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
function sequencerUptimeFeed() external view returns (contract AggregatorV3Interface)
Name | Type | Description |
---|---|---|
_0 | contract AggregatorV3Interface | undefined |
function setFixedPrice(address asset, int256 fixedPrice) external nonpayable
Set a fixed prices for assets which do not require a price feed (i.e. UA)
The decimals price must be 18 even if the original price feed is different, e.g. USDC/USD chainlink oracle decimals is 8 but if we set it a fixed price it must be 18 decimals.
Name | Type | Description |
---|---|---|
asset | address | Address of asset to set a fixed price for |
fixedPrice | int256 | Price to choose as the fixed price. 18 decimals |
function setGracePeriod(uint256 newGracePeriod) external nonpayable
Set grace period, i.e. a period that must be elapsed after the sequencer is back to fetch new price
Name | Type | Description |
---|---|---|
newGracePeriod | uint256 | Value of the new grace period. In seconds |
function setHeartBeat(address asset, uint24 newHeartBeat) external nonpayable
Update the heartBeat parameter of an oracle. To be used only if Chainlink updates this parameter
Name | Type | Description |
---|---|---|
asset | address | Address of asset to update the heartBeat from |
newHeartBeat | uint24 | Value of the new heartBeat. In seconds |
function setOracle(address asset, contract AggregatorV3Interface aggregator, uint24 heartBeat, bool isVault) external nonpayable
Add or update an oracle address
Name | Type | Description |
---|---|---|
asset | address | Address of the asset to add an oracle for |
aggregator | contract AggregatorV3Interface | Address of the Chainlink oracle |
heartBeat | uint24 | Minimum update frequency (in seconds) |
isVault | bool | Whether the asset provided is a ERC-4626 vault |
function setSequencerUptimeFeed(contract AggregatorV3Interface newSequencerUptimeFeed) external nonpayable
Set sequencer uptime feed, i.e. an oracle like contract telling whether the L2 sequencer is up or not
Name | Type | Description |
---|---|---|
newSequencerUptimeFeed | contract AggregatorV3Interface | Address of the sequencerUptimeFeed contract |
function supportsInterface(bytes4 interfaceId) external view returns (bool)
See {IERC165-supportsInterface}.
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | undefined |
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
event AssetGotFixedPrice(address asset, int256 fixedPrice)
Emitted when an asset got a fixed price when requesting an oracle
Name | Type | Description |
---|---|---|
asset | address | undefined |
fixedPrice | int256 | undefined |
event GracePeriodUpdated(uint256 newGracePeriod)
Emitted when grace period is updated
Name | Type | Description |
---|---|---|
newGracePeriod | uint256 | undefined |
event HeartBeatUpdated(address asset, uint24 newHeartBeat)
Emitted when oracle heart beat is updated
Name | Type | Description |
---|---|---|
asset | address | undefined |
newHeartBeat | uint24 | undefined |
event OracleUpdated(address asset, contract AggregatorV3Interface aggregator, bool isVault)
Emitted when oracle heart beat is added or updated
Name | Type | Description |
---|---|---|
asset | address | undefined |
aggregator | contract AggregatorV3Interface | undefined |
isVault | bool | undefined |
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
Name | Type | Description |
---|---|---|
role indexed | bytes32 | undefined |
previousAdminRole indexed | bytes32 | undefined |
newAdminRole indexed | bytes32 | undefined |
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
Name | Type | Description |
---|---|---|
role indexed | bytes32 | undefined |
account indexed | address | undefined |
sender indexed | address | undefined |
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
Name | Type | Description |
---|---|---|
role indexed | bytes32 | undefined |
account indexed | address | undefined |
sender indexed | address | undefined |
event SequencerUptimeFeedUpdated(contract AggregatorV3Interface newSequencerUptimeFeed)
Emitted when sequencer uptime feed is updated
Name | Type | Description |
---|---|---|
newSequencerUptimeFeed | contract AggregatorV3Interface | undefined |
error Oracle_AggregatorZeroAddress()
Emitted when the proposed aggregator address is equal to the zero address
error Oracle_AssetZeroAddress()
Emitted when the proposed asset address is equal to the zero address
error Oracle_DataNotFresh()
Emitted when the latest round's data is older than the oracle's max refresh time
error Oracle_GracePeriodNotOver()
Emitted when Zksync sequencer hasn't been back up for long enough
error Oracle_IncorrectGracePeriod()
Emitted when proposed grace period doesn't fit in the defined bounds
error Oracle_IncorrectHeartBeat()
Emitted when the proposed heart beat is less than 1 sec second
error Oracle_InvalidRoundPrice()
Emitted when the latest round's price is invalid
error Oracle_InvalidRoundTimestamp()
Emitted when the latest round is incomplete
error Oracle_SequencerDown()
Emitted when Zksync sequencer is down
error Oracle_SequencerUptimeFeedZeroAddress()
Emitted when the proposed sequencer uptime feed address is equal to the zero address
error Oracle_UnsupportedAsset()
Emitted when owner tries to set fixed price to an unsupported asset
error PRBMathSD59x18__AbsInputTooSmall()
Emitted when the input is MIN_SD59x18.
error PRBMathSD59x18__MulInputTooSmall()
Emitted when one of the inputs is MIN_SD59x18.
error PRBMathSD59x18__MulOverflow(uint256 rAbs)
Emitted when the intermediary absolute result overflows SD59x18.
Name | Type | Description |
---|---|---|
rAbs | uint256 | undefined |
error PRBMath__MulDivFixedPointOverflow(uint256 prod1)
Emitted when the result overflows uint256.
Name | Type | Description |
---|---|---|
prod1 | uint256 | undefined |
error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator)
Emitted when the result overflows uint256.
Name | Type | Description |
---|---|---|
prod1 | uint256 | undefined |
denominator | uint256 | undefined |
Last modified 8mo ago