OracleV1
Kiln
Oracle (v1)
This contract handles the input from the allowed oracle members. Highly inspired by Lido's implementation.
Methods
acceptAdmin
Accept the transfer of ownership
Only callable by the pending admin. Resets the pending admin if succesful.
addMember
Adds new address as oracle member, giving the ability to push cl reports.
Only callable by the adminstratorModifying the quorum clears all the reporting data
Parameters
Name | Type | Description |
---|---|---|
_newOracleMember | address | Address of the new member |
_newQuorum | uint256 | New quorum value |
getAdmin
Retrieves the current admin address
Returns
Name | Type | Description |
---|---|---|
_0 | address | The admin address |
getCLSpec
Retrieve the current cl spec
Returns
Name | Type | Description |
---|---|---|
_0 | CLSpec.CLSpecStruct | The Consensus Layer Specification |
getCurrentEpochId
Retrieve the current epoch id based on block timestamp
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The current epoch id |
getCurrentFrame
Retrieve the current frame details
Returns
Name | Type | Description |
---|---|---|
_startEpochId | uint256 | The epoch at the beginning of the frame |
_startTime | uint256 | The timestamp of the beginning of the frame in seconds |
_endTime | uint256 | The timestamp of the end of the frame in seconds |
getExpectedEpochId
Retrieve expected epoch id
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The current expected epoch id |
getFrameFirstEpochId
Retrieve the first epoch id of the frame of the provided epoch id
Parameters
Name | Type | Description |
---|---|---|
_epochId | uint256 | Epoch id used to get the frame |
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The first epoch id of the frame containing the given epoch id |
getGlobalReportStatus
Retrieve member report status
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The raw report status value |
getLastCompletedEpochId
Retrieve the last completed epoch id
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The last completed epoch id |
getMemberReportStatus
Retrieve member report status
Parameters
Name | Type | Description |
---|---|---|
_oracleMember | address | Address of member to check |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | True if member has reported |
getOracleMembers
Retrieve the list of oracle members
Returns
Name | Type | Description |
---|---|---|
_0 | address[] | The oracle members |
getPendingAdmin
Retrieve the current pending admin address
Returns
Name | Type | Description |
---|---|---|
_0 | address | The pending admin address |
getQuorum
Retrieve the current quorum
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The current quorum |
getReportBounds
Retrieve the report bounds
Returns
Name | Type | Description |
---|---|---|
_0 | ReportBounds.ReportBoundsStruct | The report bounds |
getReportVariant
Retrieve decoded report at provided index
Parameters
Name | Type | Description |
---|---|---|
_idx | uint256 | Index of report |
Returns
Name | Type | Description |
---|---|---|
_clBalance | uint64 | The reported consensus layer balance sum of River's validators |
_clValidators | uint32 | The reported validator count |
_reportCount | uint16 | The number of similar reports |
getReportVariantsCount
Retrieve report variants count
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The count of report variants |
getRiver
Retrieve River address
Returns
Name | Type | Description |
---|---|---|
_0 | address | The address of River |
getTime
Retrieve the block timestamp
Returns
Name | Type | Description |
---|---|---|
_0 | uint256 | The current timestamp from the EVM context |
initOracleV1
Initializes the oracle
Parameters
Name | Type | Description |
---|---|---|
_river | address | Address of the River contract, able to receive oracle input data after quorum is met |
_administratorAddress | address | Address able to call administrative methods |
_epochsPerFrame | uint64 | CL spec parameter. Number of epochs in a frame. |
_slotsPerEpoch | uint64 | CL spec parameter. Number of slots in one epoch. |
_secondsPerSlot | uint64 | CL spec parameter. Number of seconds between slots. |
_genesisTime | uint64 | CL spec parameter. Timestamp of the genesis slot. |
_annualAprUpperBound | uint256 | CL bound parameter. Maximum apr allowed for balance increase. Delta between updates is extrapolated on a year time frame. |
_relativeLowerBound | uint256 | CL bound parameter. Maximum relative balance decrease. |
isMember
Returns true if address is member
Performs a naive search, do not call this on-chain, used as an off-chain helper
Parameters
Name | Type | Description |
---|---|---|
_memberAddress | address | Address of the member |
Returns
Name | Type | Description |
---|---|---|
_0 | bool | True if address is a member |
proposeAdmin
Proposes a new address as admin
This security prevents setting an invalid address as an admin. The pendingadmin has to claim its ownership of the contract, and prove that the newaddress is able to perform regular transactions.
Parameters
Name | Type | Description |
---|---|---|
_newAdmin | address | New admin address |
removeMember
Removes an address from the oracle members.
Only callable by the adminstratorModifying the quorum clears all the reporting dataRemaining members that have already voted should vote again for the same frame.
Parameters
Name | Type | Description |
---|---|---|
_oracleMember | address | Address to remove |
_newQuorum | uint256 | New quorum value |
reportConsensusLayerData
Report cl chain data
Only callable by an oracle memberThe epoch id is expected to be >= to the expected epoch id stored in the contractThe epoch id is expected to be the first epoch of its frameThe Consensus Layer Validator count is the amount of running validators managed by River.Until withdrawals are enabled, this count also takes into account any exited and slashed validatoras funds are still locked on the consensus layer.
Parameters
Name | Type | Description |
---|---|---|
_epochId | uint256 | Epoch where the balance and validator count has been computed |
_clValidatorsBalance | uint64 | Total balance of River validators |
_clValidatorCount | uint32 | Total River validator count |
setCLSpec
Edits the cl spec parameters
Only callable by the adminstrator
Parameters
Name | Type | Description |
---|---|---|
_epochsPerFrame | uint64 | Number of epochs in a frame. |
_slotsPerEpoch | uint64 | Number of slots in one epoch. |
_secondsPerSlot | uint64 | Number of seconds between slots. |
_genesisTime | uint64 | Timestamp of the genesis slot. |
setMember
Changes the address of an oracle member
Only callable by the adminitratorCannot use an address already in useThis call will clear all the reporting data
Parameters
Name | Type | Description |
---|---|---|
_oracleMember | address | Address to change |
_newAddress | address | New address for the member |
setQuorum
Edits the quorum required to forward cl data to River
Modifying the quorum clears all the reporting data
Parameters
Name | Type | Description |
---|---|---|
_newQuorum | uint256 | New quorum parameter |
setReportBounds
Edits the cl bounds parameters
Only callable by the adminstrator
Parameters
Name | Type | Description |
---|---|---|
_annualAprUpperBound | uint256 | Maximum apr allowed for balance increase. Delta between updates is extrapolated on a year time frame. |
_relativeLowerBound | uint256 | Maximum relative balance decrease. |
Events
AddMember
A member has been added to the oracle member list
Parameters
Name | Type | Description |
---|---|---|
member | address | undefined |
CLReported
Consensus Layer data has been reported by an oracle member
Parameters
Name | Type | Description |
---|---|---|
epochId | uint256 | undefined |
newCLBalance | uint128 | undefined |
newCLValidatorCount | uint32 | undefined |
oracleMember | address | undefined |
ExpectedEpochIdUpdated
The expected epoch id has been changed
Parameters
Name | Type | Description |
---|---|---|
epochId | uint256 | undefined |
Initialize
Emitted when the contract is properly initialized
Parameters
Name | Type | Description |
---|---|---|
version | uint256 | undefined |
cdata | bytes | undefined |
PostTotalShares
The report has been submitted to river
Parameters
Name | Type | Description |
---|---|---|
postTotalEth | uint256 | undefined |
prevTotalEth | uint256 | undefined |
timeElapsed | uint256 | undefined |
totalShares | uint256 | undefined |
RemoveMember
A member has been removed from the oracle member list
Parameters
Name | Type | Description |
---|---|---|
member | address | undefined |
SetAdmin
The admin address changed
Parameters
Name | Type | Description |
---|---|---|
admin | address | undefined |
SetBounds
The report bounds have been changed
Parameters
Name | Type | Description |
---|---|---|
annualAprUpperBound | uint256 | undefined |
relativeLowerBound | uint256 | undefined |
SetMember
A member address has been edited
Parameters
Name | Type | Description |
---|---|---|
oldAddress | address | undefined |
newAddress | address | undefined |
SetPendingAdmin
The pending admin address changed
Parameters
Name | Type | Description |
---|---|---|
pendingAdmin | address | undefined |
SetQuorum
The storage quorum value has been changed
Parameters
Name | Type | Description |
---|---|---|
newQuorum | uint256 | undefined |
SetRiver
The storage river address value has been changed
Parameters
Name | Type | Description |
---|---|---|
_river | address | undefined |
SetSpec
The consensus layer spec has been changed
Parameters
Name | Type | Description |
---|---|---|
epochsPerFrame | uint64 | undefined |
slotsPerEpoch | uint64 | undefined |
secondsPerSlot | uint64 | undefined |
genesisTime | uint64 | undefined |
Errors
AddressAlreadyInUse
The address is already in use by an oracle member
Parameters
Name | Type | Description |
---|---|---|
newAddress | address | The address already in use |
AlreadyReported
The member already reported on the given epoch id
Parameters
Name | Type | Description |
---|---|---|
epochId | uint256 | The epoch id provided as input |
member | address | The oracle member |
EpochTooOld
The provided epoch is too old compared to the expected epoch id
Parameters
Name | Type | Description |
---|---|---|
providedEpochId | uint256 | The epoch id provided as input |
minExpectedEpochId | uint256 | The minimum epoch id expected |
InvalidArgument
The argument was invalid
InvalidCall
The call was invalid
InvalidInitialization
An error occured during the initialization
Parameters
Name | Type | Description |
---|---|---|
version | uint256 | The version that was attempting to be initialized |
expectedVersion | uint256 | The version that was expected |
InvalidZeroAddress
The address is zero
NotFrameFirstEpochId
The provided epoch is not at the beginning of its frame
Parameters
Name | Type | Description |
---|---|---|
providedEpochId | uint256 | The epoch id provided as input |
expectedFrameFirstEpochId | uint256 | The frame first epoch id that was expected |
TotalValidatorBalanceDecreaseOutOfBound
The negative delta in balance is above the allowed lower bound
Parameters
Name | Type | Description |
---|---|---|
prevTotalEth | uint256 | The previous total balance |
postTotalEth | uint256 | The new total balance |
timeElapsed | uint256 | The time since last report |
relativeLowerBound | uint256 | The maximum relative decrease allowed |
TotalValidatorBalanceIncreaseOutOfBound
The delta in balance is above the allowed upper bound
Parameters
Name | Type | Description |
---|---|---|
prevTotalEth | uint256 | The previous total balance |
postTotalEth | uint256 | The new total balance |
timeElapsed | uint256 | The time since last report |
annualAprUpperBound | uint256 | The maximum apr allowed |
Unauthorized
The operator is unauthorized for the caller
Parameters
Name | Type | Description |
---|---|---|
caller | address | Address performing the call |
Last updated