Skip to main content

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​

ParameterTypeDescription
startBlock?numberoptional starting block number for event filtering
endBlock?numberoptional ending block number for event filtering
to?AddressLikeoptional 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​

ParameterTypeDescription
startBlock?numberoptional starting block number for event filtering
endBlock?numberoptional ending block number for event filtering
_voter?AddressLikeoptional 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​

ParameterType
_symbolstring

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​

ParameterTypeDescription
_symbolstringtarget symbol
_voterAddressLiketarget voter address

Returns​

Promise<Report>


getRewardPeriodPerformance()​

getRewardPeriodPerformance(_voter): Promise<bigint>

Returns the performance of a voter in the current reward period

Parameters​

ParameterTypeDescription
_voterAddressLikevoter 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​

ParameterTypeDescription
_roundBigNumberishround number
_symbolstringsymbol 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​

ParameterType
_voterAddressLike

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​

ParameterType
_oracleAddressAddressLike

Returns​

Promise<string>


getVoterValidators()​

getVoterValidators(_oracleAddress): Promise<string>

Returns node address for a given validator

Parameters​

ParameterType
_oracleAddressAddressLike

Returns​

Promise<string>


InvalidVote()​

InvalidVote(
startBlock?,
endBlock?,
reporter?): Promise<IInvalidVote[]>

Emitted when an invalid report is submitted

Parameters​

ParameterTypeDescription
startBlock?numberoptional starting block number for event filtering
endBlock?numberoptional ending block number for event filtering
reporter?AddressLikeoptional 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​

ParameterTypeDescription
startBlock?numberoptional starting block number for event filtering
endBlock?numberoptional ending block number for event filtering
_round?bigintoptional 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​

ParameterTypeDescription
startBlock?numberoptional starting block number for event filtering
endBlock?numberoptional ending block number for event filtering
_voter?AddressLikeoptional 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​

ParameterTypeDescription
startBlock?numberoptional starting block number for event filtering
endBlock?numberoptional ending block number for event filtering
price?bigintoptional price to filter events by price

Returns​

Promise<IPriceUpdated[]>


SuccessfulVote()​

SuccessfulVote(
startBlock?,
endBlock?,
reporter?): Promise<ISuccessfulVote[]>

Emitted when a valid report is accepted

Parameters​

ParameterTypeDescription
startBlock?numberoptional starting block number for event filtering
endBlock?numberoptional ending block number for event filtering
reporter?AddressLikeoptional address to filter events by reporter

Returns​

Promise<ISuccessfulVote[]>