oracle
Oracle contract client for interacting with the Autonity Protocol Oracle. Provides methods to read oracle configuration, rounds, reports, and voter information.
Methods
CallFailed()
CallFailed(
startBlock?,
endBlock?,
to?): Promise<ICallFailed[]>
emitted when a call to an address fails in a protocol function (like finalize())
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional starting block number for event filtering |
endBlock ? | number | optional ending block number for event filtering |
to ? | AddressLike | optional address to filter events by recipient |
Returns
Promise
<ICallFailed
[]>
CommitRevealMissed()
CommitRevealMissed(
startBlock?,
endBlock?,
_voter?): Promise<ICommitRevealMissed[]>
Emitted when a participant submitted commit in the previous round but did not submit reveal in the current round.
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional starting block number for event filtering |
endBlock ? | number | optional ending block number for event filtering |
_voter ? | AddressLike | optional address to filter events by voter |
Returns
Promise
<ICommitRevealMissed
[]>
getConfig()
getConfig(): Promise<ConfigStruct>
Returns the current Oracle configuration
Returns
Promise
<ConfigStruct
>
getDecimals()
getDecimals(): Promise<bigint>
Returns the decimal places used for price reports
Returns
Promise
<bigint
>
getLastRoundBlock()
getLastRoundBlock(): Promise<bigint>
Returns the block number of the last completed round
Returns
Promise
<bigint
>
getLatestRoundData()
getLatestRoundData(_symbol): Promise<RoundDataStruct>
Returns the latest round data for a symbol
Parameters
Parameter | Type |
---|---|
_symbol | string |
Returns
Promise
<RoundDataStruct
>
getNewVotePeriod()
getNewVotePeriod(): Promise<bigint>
Returns the upcoming vote period
Returns
Promise
<bigint
>
getNewVoters()
getNewVoters(): Promise<string[]>
Returns the list of new voters in the Oracle process
Returns
Promise
<string
[]>
getNonRevealThreshold()
getNonRevealThreshold(): Promise<bigint>
Returns the non-reveal threshold for voters
Returns
Promise
<bigint
>
getReports()
getReports(_symbol, _voter): Promise<Report>
Returns the latest report for a voter and symbol
Parameters
Parameter | Type | Description |
---|---|---|
_symbol | string | target symbol |
_voter | AddressLike | target voter address |
Returns
Promise
<Report
>
getRewardPeriodPerformance()
getRewardPeriodPerformance(_voter): Promise<bigint>
Returns the performance of a voter in the current reward period
Parameters
Parameter | Type | Description |
---|---|---|
_voter | AddressLike | voter address |
Returns
Promise
<bigint
>
getRound()
getRound(): Promise<bigint>
Returns the current round ID
Returns
Promise
<bigint
>
getRoundData()
getRoundData(_round, _symbol): Promise<RoundDataStruct>
Returns price data for a specific round and symbol.
Parameters
Parameter | Type | Description |
---|---|---|
_round | BigNumberish | round number |
_symbol | string | symbol for the price |
Returns
Promise
<RoundDataStruct
>
getSymbols()
getSymbols(): Promise<string[]>
Returns the list of symbols to be voted on
Returns
Promise
<string
[]>
getSymbolUpdatedRound()
getSymbolUpdatedRound(): Promise<bigint>
Returns the round when symbols were last updated
Returns
Promise
<bigint
>
getVotePeriod()
getVotePeriod(): Promise<bigint>
Returns the current vote period
Returns
Promise
<bigint
>
getVoterInfo()
getVoterInfo(_voter): Promise<VoterInfo>
Returns voter info for a given address
Parameters
Parameter | Type |
---|---|
_voter | AddressLike |
Returns
Promise
<VoterInfo
>
getVoters()
getVoters(): Promise<string[]>
Returns the list of current voters
Returns
Promise
<string
[]>
getVoterTreasuries()
getVoterTreasuries(_oracleAddress): Promise<string>
Returns treasury address for a given validator
Parameters
Parameter | Type |
---|---|
_oracleAddress | AddressLike |
Returns
Promise
<string
>
getVoterValidators()
getVoterValidators(_oracleAddress): Promise<string>
Returns node address for a given validator
Parameters
Parameter | Type |
---|---|
_oracleAddress | AddressLike |
Returns
Promise
<string
>
InvalidVote()
InvalidVote(
startBlock?,
endBlock?,
reporter?): Promise<IInvalidVote[]>
Emitted when an invalid report is submitted
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional starting block number for event filtering |
endBlock ? | number | optional ending block number for event filtering |
reporter ? | AddressLike | optional address to filter events by reporter |
Returns
Promise
<IInvalidVote
[]>
NewRound()
NewRound(
startBlock?,
endBlock?,
_round?): Promise<INewRound[]>
Emitted when a new voting round is started
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional starting block number for event filtering |
endBlock ? | number | optional ending block number for event filtering |
_round ? | bigint | optional round ID to filter events by |
Returns
Promise
<INewRound
[]>
NoRevealPenalty()
NoRevealPenalty(
startBlock?,
endBlock?,
_voter?): Promise<INoRevealPenalty[]>
Emitted when a participant gets penalized for missing too many reveals in a certain window
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional starting block number for event filtering |
endBlock ? | number | optional ending block number for event filtering |
_voter ? | AddressLike | optional address to filter events by voter |
Returns
Promise
<INoRevealPenalty
[]>
PriceUpdated()
PriceUpdated(
startBlock?,
endBlock?,
price?): Promise<IPriceUpdated[]>
Emitted when a new price is calculated for a symbol
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional starting block number for event filtering |
endBlock ? | number | optional ending block number for event filtering |
price ? | bigint | optional price to filter events by price |
Returns
Promise
<IPriceUpdated
[]>
SuccessfulVote()
SuccessfulVote(
startBlock?,
endBlock?,
reporter?): Promise<ISuccessfulVote[]>
Emitted when a valid report is accepted
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional starting block number for event filtering |
endBlock ? | number | optional ending block number for event filtering |
reporter ? | AddressLike | optional address to filter events by reporter |
Returns
Promise
<ISuccessfulVote
[]>