Oracle

Oracle contract relying on Chainlink for price

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

EMERGENCY_ADMIN

function EMERGENCY_ADMIN() external view returns (bytes32)

Returns

GOVERNANCE

function GOVERNANCE() external view returns (bytes32)

Returns

assetToOracles

function assetToOracles(address) external view returns (uint24 heartBeat, contract AggregatorV3Interface aggregator, bool isVaultAsset, int256 fixedPrice)

Parameters

Returns

getPrice

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

Parameters

Returns

getRoleAdmin

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}.

Parameters

Returns

gracePeriod

function gracePeriod() external view returns (uint256)

Returns

grantRole

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.

Parameters

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

Returns

isEmergencyAdmin

function isEmergencyAdmin(address account) external view returns (bool)

Parameters

Returns

isGovernor

function isGovernor(address account) external view returns (bool)

Parameters

Returns

renounceRole

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.

Parameters

revokeRole

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.

Parameters

sequencerUptimeFeed

function sequencerUptimeFeed() external view returns (contract AggregatorV3Interface)

Returns

setFixedPrice

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.

Parameters

setGracePeriod

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

Parameters

setHeartBeat

function setHeartBeat(address asset, uint24 newHeartBeat) external nonpayable

Update the heartBeat parameter of an oracle. To be used only if Chainlink updates this parameter

Parameters

setOracle

function setOracle(address asset, contract AggregatorV3Interface aggregator, uint24 heartBeat, bool isVault) external nonpayable

Add or update an oracle address

Parameters

setSequencerUptimeFeed

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

Parameters

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See {IERC165-supportsInterface}.

Parameters

Returns

Events

AssetGotFixedPrice

event AssetGotFixedPrice(address asset, int256 fixedPrice)

Emitted when an asset got a fixed price when requesting an oracle

Parameters

GracePeriodUpdated

event GracePeriodUpdated(uint256 newGracePeriod)

Emitted when grace period is updated

Parameters

HeartBeatUpdated

event HeartBeatUpdated(address asset, uint24 newHeartBeat)

Emitted when oracle heart beat is updated

Parameters

OracleUpdated

event OracleUpdated(address asset, contract AggregatorV3Interface aggregator, bool isVault)

Emitted when oracle heart beat is added or updated

Parameters

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Parameters

RoleGranted

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

RoleRevoked

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

SequencerUptimeFeedUpdated

event SequencerUptimeFeedUpdated(contract AggregatorV3Interface newSequencerUptimeFeed)

Emitted when sequencer uptime feed is updated

Parameters

Errors

Oracle_AggregatorZeroAddress

error Oracle_AggregatorZeroAddress()

Emitted when the proposed aggregator address is equal to the zero address

Oracle_AssetZeroAddress

error Oracle_AssetZeroAddress()

Emitted when the proposed asset address is equal to the zero address

Oracle_DataNotFresh

error Oracle_DataNotFresh()

Emitted when the latest round's data is older than the oracle's max refresh time

Oracle_GracePeriodNotOver

error Oracle_GracePeriodNotOver()

Emitted when Zksync sequencer hasn't been back up for long enough

Oracle_IncorrectGracePeriod

error Oracle_IncorrectGracePeriod()

Emitted when proposed grace period doesn't fit in the defined bounds

Oracle_IncorrectHeartBeat

error Oracle_IncorrectHeartBeat()

Emitted when the proposed heart beat is less than 1 sec second

Oracle_InvalidRoundPrice

error Oracle_InvalidRoundPrice()

Emitted when the latest round's price is invalid

Oracle_InvalidRoundTimestamp

error Oracle_InvalidRoundTimestamp()

Emitted when the latest round is incomplete

Oracle_SequencerDown

error Oracle_SequencerDown()

Emitted when Zksync sequencer is down

Oracle_SequencerUptimeFeedZeroAddress

error Oracle_SequencerUptimeFeedZeroAddress()

Emitted when the proposed sequencer uptime feed address is equal to the zero address

Oracle_UnsupportedAsset

error Oracle_UnsupportedAsset()

Emitted when owner tries to set fixed price to an unsupported asset

PRBMathSD59x18__AbsInputTooSmall

error PRBMathSD59x18__AbsInputTooSmall()

Emitted when the input is MIN_SD59x18.

PRBMathSD59x18__MulInputTooSmall

error PRBMathSD59x18__MulInputTooSmall()

Emitted when one of the inputs is MIN_SD59x18.

PRBMathSD59x18__MulOverflow

error PRBMathSD59x18__MulOverflow(uint256 rAbs)

Emitted when the intermediary absolute result overflows SD59x18.

Parameters

PRBMath__MulDivFixedPointOverflow

error PRBMath__MulDivFixedPointOverflow(uint256 prod1)

Emitted when the result overflows uint256.

Parameters

PRBMath__MulDivOverflow

error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator)

Emitted when the result overflows uint256.

Parameters

Last updated