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
to
address
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
value
uint144
The new observation value to be updated
signers
address[]
An array of addresses representing the signers involved in the update
deadline
uint256[]
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
maximumDeltaPercentage
uint32
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
theshold
uint8
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
*
bytes
The function does not take any input parameters
Returns
isValid
bool
observation
uint256
Latest price observation
Events
LogUpdateObservation
Parameters
timestamp
uint256
No
observation
uint144
No
LogFrozenChanged
Parameters
timestamp
uint256
No
frozen
uint8
No
LogMaxDeltaPercentageChanged
Parameters
timestamp
uint256
No
maxDeltaPercentage
uint32
No
LogSignerThresholdChanged
Parameters
timestamp
uint256
No
signerThreshold
uint8
No
Last updated