Oracle
Initialization
constructor
Description
The constructor initializes the smart contract and sets the default roles. It also transfers ownership to the specified address and calculates the domain separator for EIP-712 signatures.
Parameters
Name | Type | Description |
---|---|---|
to |
| The address to which ownership of the contract will be transferred during initialization. |
Write Methods
updateObservation
Description
The updateObservation
function is used to update the Oracle price if the following conditions are satisfied
All signers must reach a consensus and produce a signed message containing the same price observation
Each signed message must be created by a different signer
Each signed message must have a deadline not already passed
The number of signers is equal to or greater than the signer threshold
The cooldown period has elapsed since the last update
The percentage change between the old and new price observation is within an allowed delta
Parameters
Name | Type | Description |
---|---|---|
value |
| The new observation value to be updated |
signers |
| An array of addresses representing the signers involved in the update |
deadline |
| An array of deadlines corresponding to each signatures |
v | uint8[] | An array of the 'v' components of the ECDSA signatures |
r | bytes32[] | An array of the 'r' components of the ECDSA signatures |
s | bytes32[] | An array of the s' components of the ECDSA signatures |
Emits
freeze
Description
The freeze
function is an external function that allows designated operators to freeze the contract in case of emergency.
Emits
unfreeze
Description
The unfreeze
function is an external function that allows the contract owner operators to unfreeze the contract to resume normal operativity.
Emits
setMaximumDeltaPercentage
Description
The setMaximumDeltaPercentage
function is an external function that allows the owner of the contract to set the maximum allowed delta percentage for updates to the price observation.
Parameters
Name | Type | Description |
---|---|---|
maximumDeltaPercentage |
| The new maximum allowed delta percentage for updates |
Emits
setThreshold
Description
The setThreshold
function is an external function that allows the owner of the contract to set the minimum required number of signers for updates to the observation state.
Parameters
Name | Type | Description |
---|---|---|
theshold |
| The new minimum required number of signers |
Emit
View Methods
PRECISION
Description
The precision used by the contract to handle the observation value
HEARTBEAT
Description
The number of seconds the latest price observation is considered valid and up to date
get
Description
The get
function is a public view function that allows external callers to retrieve information about the current observation state stored in the contract. It returns a boolean indicating the validity of the observation and the actual observation value.
Parameters
Name | Type | Description |
---|---|---|
* |
| The function does not take any input parameters |
Returns
Name | Type | Description |
---|---|---|
isValid |
| If true the observation has been updated within HEARTBEAT seconds |
observation |
| Latest price observation |
Events
LogUpdateObservation
Parameters
Name | Type | Index? |
---|---|---|
timestamp |
| No |
observation |
| No |
LogFrozenChanged
Parameters
Name | Type | Index? |
---|---|---|
timestamp |
| No |
frozen |
| No |
LogMaxDeltaPercentageChanged
Parameters
Name | Type | Index? |
---|---|---|
timestamp |
| No |
maxDeltaPercentage |
| No |
LogSignerThresholdChanged
Parameters
Name | Type | Index? |
---|---|---|
timestamp |
| No |
signerThreshold |
| No |
Last updated