Oracle
Oracle contract relying on Chainlink for price
Methods
DEFAULT_ADMIN_ROLE
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
Returns
_0
bytes32
undefined
EMERGENCY_ADMIN
function EMERGENCY_ADMIN() external view returns (bytes32)
Returns
_0
bytes32
undefined
GOVERNANCE
function GOVERNANCE() external view returns (bytes32)
Returns
_0
bytes32
undefined
assetToOracles
function assetToOracles(address) external view returns (uint24 heartBeat, contract AggregatorV3Interface aggregator, bool isVaultAsset, int256 fixedPrice)
Parameters
_0
address
undefined
Returns
heartBeat
uint24
undefined
aggregator
contract AggregatorV3Interface
undefined
isVaultAsset
bool
undefined
fixedPrice
int256
undefined
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
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
Returns
price
int256
undefined
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
role
bytes32
undefined
Returns
_0
bytes32
undefined
gracePeriod
function gracePeriod() external view returns (uint256)
Returns
_0
uint256
undefined
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
role
bytes32
undefined
account
address
undefined
hasRole
function hasRole(bytes32 role, address account) external view returns (bool)
Returns true
if account
has been granted role
.
Parameters
role
bytes32
undefined
account
address
undefined
Returns
_0
bool
undefined
isEmergencyAdmin
function isEmergencyAdmin(address account) external view returns (bool)
Parameters
account
address
undefined
Returns
_0
bool
undefined
isGovernor
function isGovernor(address account) external view returns (bool)
Parameters
account
address
undefined
Returns
_0
bool
undefined
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
role
bytes32
undefined
account
address
undefined
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
role
bytes32
undefined
account
address
undefined
sequencerUptimeFeed
function sequencerUptimeFeed() external view returns (contract AggregatorV3Interface)
Returns
_0
contract AggregatorV3Interface
undefined
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
asset
address
Address of asset to set a fixed price for
fixedPrice
int256
Price to choose as the fixed price. 18 decimals
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
newGracePeriod
uint256
Value of the new grace period. In seconds
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
asset
address
Address of asset to update the heartBeat from
newHeartBeat
uint24
Value of the new heartBeat. In seconds
setOracle
function setOracle(address asset, contract AggregatorV3Interface aggregator, uint24 heartBeat, bool isVault) external nonpayable
Add or update an oracle address
Parameters
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
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
newSequencerUptimeFeed
contract AggregatorV3Interface
Address of the sequencerUptimeFeed contract
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool)
See {IERC165-supportsInterface}.
Parameters
interfaceId
bytes4
undefined
Returns
_0
bool
undefined
Events
AssetGotFixedPrice
event AssetGotFixedPrice(address asset, int256 fixedPrice)
Emitted when an asset got a fixed price when requesting an oracle
Parameters
asset
address
undefined
fixedPrice
int256
undefined
GracePeriodUpdated
event GracePeriodUpdated(uint256 newGracePeriod)
Emitted when grace period is updated
Parameters
newGracePeriod
uint256
undefined
HeartBeatUpdated
event HeartBeatUpdated(address asset, uint24 newHeartBeat)
Emitted when oracle heart beat is updated
Parameters
asset
address
undefined
newHeartBeat
uint24
undefined
OracleUpdated
event OracleUpdated(address asset, contract AggregatorV3Interface aggregator, bool isVault)
Emitted when oracle heart beat is added or updated
Parameters
asset
address
undefined
aggregator
contract AggregatorV3Interface
undefined
isVault
bool
undefined
RoleAdminChanged
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
Parameters
role indexed
bytes32
undefined
previousAdminRole indexed
bytes32
undefined
newAdminRole indexed
bytes32
undefined
RoleGranted
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
Parameters
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined
RoleRevoked
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
Parameters
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined
SequencerUptimeFeedUpdated
event SequencerUptimeFeedUpdated(contract AggregatorV3Interface newSequencerUptimeFeed)
Emitted when sequencer uptime feed is updated
Parameters
newSequencerUptimeFeed
contract AggregatorV3Interface
undefined
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
rAbs
uint256
undefined
PRBMath__MulDivFixedPointOverflow
error PRBMath__MulDivFixedPointOverflow(uint256 prod1)
Emitted when the result overflows uint256.
Parameters
prod1
uint256
undefined
PRBMath__MulDivOverflow
error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator)
Emitted when the result overflows uint256.
Parameters
prod1
uint256
undefined
denominator
uint256
undefined
Last updated