Oracle
Oracle contract relying on Chainlink for price
Methods
DEFAULT_ADMIN_ROLE
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
EMERGENCY_ADMIN
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
GOVERNANCE
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
assetToOracles
Parameters
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Returns
Name | Type | Description |
---|---|---|
heartBeat | uint24 | undefined |
aggregator | contract AggregatorV3Interface | undefined |
isVaultAsset | bool | undefined |
fixedPrice | int256 | undefined |
getPrice
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
Name | Type | Description |
---|---|---|
asset | address | Address of asset to fetch price for |
balance | int256 | Balance is only being used by |
Returns
Name | Type | Description |
---|---|---|
price | int256 | undefined |
getRoleAdmin
Returns the admin role that controls role
. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bytes32 | undefined |
gracePeriod
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
grantRole
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
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
hasRole
Returns true
if account
has been granted role
.
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
isEmergencyAdmin
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
isGovernor
Parameters
Name | Type | Description |
---|---|---|
account | address | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
renounceRole
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
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
revokeRole
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
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
sequencerUptimeFeed
Returns
Name | Type | Description |
---|---|---|
_0 | contract AggregatorV3Interface | undefined |
setFixedPrice
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
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 |
setGracePeriod
Set grace period, i.e. a period that must be elapsed after the sequencer is back to fetch new price
Parameters
Name | Type | Description |
---|---|---|
newGracePeriod | uint256 | Value of the new grace period. In seconds |
setHeartBeat
Update the heartBeat parameter of an oracle. To be used only if Chainlink updates this parameter
Parameters
Name | Type | Description |
---|---|---|
asset | address | Address of asset to update the heartBeat from |
newHeartBeat | uint24 | Value of the new heartBeat. In seconds |
setOracle
Add or update an oracle address
Parameters
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 |
setSequencerUptimeFeed
Set sequencer uptime feed, i.e. an oracle like contract telling whether the L2 sequencer is up or not
Parameters
Name | Type | Description |
---|---|---|
newSequencerUptimeFeed | contract AggregatorV3Interface | Address of the sequencerUptimeFeed contract |
supportsInterface
See {IERC165-supportsInterface}.
Parameters
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | undefined |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
Events
AssetGotFixedPrice
Emitted when an asset got a fixed price when requesting an oracle
Parameters
Name | Type | Description |
---|---|---|
asset | address | undefined |
fixedPrice | int256 | undefined |
GracePeriodUpdated
Emitted when grace period is updated
Parameters
Name | Type | Description |
---|---|---|
newGracePeriod | uint256 | undefined |
HeartBeatUpdated
Emitted when oracle heart beat is updated
Parameters
Name | Type | Description |
---|---|---|
asset | address | undefined |
newHeartBeat | uint24 | undefined |
OracleUpdated
Emitted when oracle heart beat is added or updated
Parameters
Name | Type | Description |
---|---|---|
asset | address | undefined |
aggregator | contract AggregatorV3Interface | undefined |
isVault | bool | undefined |
RoleAdminChanged
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
previousAdminRole | bytes32 | undefined |
newAdminRole | bytes32 | undefined |
RoleGranted
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
sender | address | undefined |
RoleRevoked
Parameters
Name | Type | Description |
---|---|---|
role | bytes32 | undefined |
account | address | undefined |
sender | address | undefined |
SequencerUptimeFeedUpdated
Emitted when sequencer uptime feed is updated
Parameters
Name | Type | Description |
---|---|---|
newSequencerUptimeFeed | contract AggregatorV3Interface | undefined |
Errors
Oracle_AggregatorZeroAddress
Emitted when the proposed aggregator address is equal to the zero address
Oracle_AssetZeroAddress
Emitted when the proposed asset address is equal to the zero address
Oracle_DataNotFresh
Emitted when the latest round's data is older than the oracle's max refresh time
Oracle_GracePeriodNotOver
Emitted when Zksync sequencer hasn't been back up for long enough
Oracle_IncorrectGracePeriod
Emitted when proposed grace period doesn't fit in the defined bounds
Oracle_IncorrectHeartBeat
Emitted when the proposed heart beat is less than 1 sec second
Oracle_InvalidRoundPrice
Emitted when the latest round's price is invalid
Oracle_InvalidRoundTimestamp
Emitted when the latest round is incomplete
Oracle_SequencerDown
Emitted when Zksync sequencer is down
Oracle_SequencerUptimeFeedZeroAddress
Emitted when the proposed sequencer uptime feed address is equal to the zero address
Oracle_UnsupportedAsset
Emitted when owner tries to set fixed price to an unsupported asset
PRBMathSD59x18__AbsInputTooSmall
Emitted when the input is MIN_SD59x18.
PRBMathSD59x18__MulInputTooSmall
Emitted when one of the inputs is MIN_SD59x18.
PRBMathSD59x18__MulOverflow
Emitted when the intermediary absolute result overflows SD59x18.
Parameters
Name | Type | Description |
---|---|---|
rAbs | uint256 | undefined |
PRBMath__MulDivFixedPointOverflow
Emitted when the result overflows uint256.
Parameters
Name | Type | Description |
---|---|---|
prod1 | uint256 | undefined |
PRBMath__MulDivOverflow
Emitted when the result overflows uint256.
Parameters
Name | Type | Description |
---|---|---|
prod1 | uint256 | undefined |
denominator | uint256 | undefined |
Last updated