Documentation ¶
Index ¶
- Constants
- func ConstructMedianPokeMessage(wat string, val *bn.DecFloatPointNumber, age time.Time) []byte
- func ConstructScribeOpPokeMessage(wat string, pokeData PokeData, schnorrData SchnorrData, feedIDs FeedIDs) []byte
- func ConstructScribePokeMessage(wat string, pokeData PokeData) []byte
- type Chainlog
- type ConfigResult
- type Deployment
- type ECDSADataStruct
- type FeedIDs
- type FeedRegistry
- type Median
- func (m *Median) Address() types.Address
- func (m *Median) Age() contract.TypedSelfCaller[time.Time]
- func (m *Median) Bar() contract.TypedSelfCaller[int]
- func (m *Median) Client() rpc.RPC
- func (m *Median) Poke(vals []MedianVal) contract.SelfTransactableCaller
- func (m *Median) Val(ctx context.Context) (*bn.DecFixedPointNumber, error)
- func (m *Median) Wat() contract.TypedSelfCaller[string]
- type MedianVal
- type OpScribe
- func (s *OpScribe) Address() types.Address
- func (s *OpScribe) Client() rpc.RPC
- func (s *OpScribe) OpChallengePeriod() contract.TypedSelfCaller[time.Duration]
- func (s *OpScribe) OpPoke(pokeData PokeData, schnorrData SchnorrData, ecdsaData types.Signature) contract.SelfTransactableCaller
- func (s *OpScribe) Read(ctx context.Context) (PokeData, error)
- func (s *OpScribe) ReadAt(ctx context.Context, readTime time.Time) (PokeData, bool, error)
- func (s *OpScribe) ReadNext(ctx context.Context) (PokeData, bool, error)
- func (s *OpScribe) ReadNextAt(ctx context.Context, readTime time.Time) (PokeData, bool, error)
- func (s *OpScribe) ReadOpPokeData(ctx context.Context) (PokeData, error)
- func (s *OpScribe) ReadPokeData(ctx context.Context) (PokeData, error)
- type PokeData
- type PokeDataStruct
- type Registry
- type SchnorrData
- type SchnorrDataStruct
- type Scribe
- func (s *Scribe) Address() types.Address
- func (s *Scribe) Bar() contract.TypedSelfCaller[int]
- func (s *Scribe) Client() rpc.RPC
- func (s *Scribe) Feeds() contract.TypedSelfCaller[[]types.Address]
- func (s *Scribe) Poke(pokeData PokeData, schnorrData SchnorrData) contract.SelfTransactableCaller
- func (s *Scribe) Read(ctx context.Context) (PokeData, error)
- func (s *Scribe) Wat() contract.TypedSelfCaller[string]
- type TryGetResult
- type WatRegistry
- func (w *WatRegistry) Address() types.Address
- func (w *WatRegistry) Chains(wat string) contract.TypedSelfCaller[[]uint64]
- func (w *WatRegistry) Client() rpc.RPC
- func (w *WatRegistry) Config(wat string) contract.TypedSelfCaller[ConfigResult]
- func (w *WatRegistry) Deployment(wat string, chainID uint64) contract.TypedSelfCaller[types.Address]
- func (w *WatRegistry) Exists(wat string) contract.TypedSelfCaller[bool]
- func (w *WatRegistry) Wats() contract.TypedSelfCaller[[]string]
Constants ¶
const MedianPricePrecision = 18
MedianPricePrecision is the precision of the price value in the Median contract as a number of decimal places after the decimal point.
const ScribePricePrecision = 18
ScribePricePrecision is the precision of the price value in the Scribe contract as a number of decimal places after the decimal point.
Variables ¶
This section is empty.
Functions ¶
func ConstructMedianPokeMessage ¶
ConstructMedianPokeMessage returns the message expected to be signed via ECDSA for calling Median.poke method.
The message structure is defined as: H(val ‖ age ‖ wat)
Where: - val: a price value - age: a time when the price was observed - wat: an asset name
func ConstructScribeOpPokeMessage ¶
func ConstructScribeOpPokeMessage(wat string, pokeData PokeData, schnorrData SchnorrData, feedIDs FeedIDs) []byte
ConstructScribeOpPokeMessage returns the message expected to be signed via ECDSA for calling OpScribe.opPoke method.
The message structure is defined as: H(wat ‖ val ‖ age ‖ signature ‖ commitment ‖ signersBlob)
Where: - wat: an asset name - val: a price value - age: a time when the price was observed - signature: a Schnorr signature - commitment: a Schnorr commitment - feedIDs: a feed IDs that are participated in the signing
func ConstructScribePokeMessage ¶
ConstructScribePokeMessage returns the message expected to be signed via ECDSA for calling Scribe.poke method.
The message is defined as: H(wat ‖ val ‖ age)
Where: - wat: an asset name - val: a price value - age: a time when the price was observed
Types ¶
type Chainlog ¶
type Chainlog struct {
// contains filtered or unexported fields
}
Chainlog allows interacting with the Chainlog contract.
func NewChainlog ¶
NewChainlog creates a new Chainlog instance.
func (*Chainlog) Client ¶ added in v0.23.0
Client returns the RPC client used to interact with the Chainlog.
func (*Chainlog) TryGet ¶
func (w *Chainlog) TryGet(wat string) contract.TypedSelfCaller[TryGetResult]
TryGet returns the address of the contract that implements the given wat.
type ConfigResult ¶ added in v0.23.0
type Deployment ¶ added in v0.23.0
type ECDSADataStruct ¶
ECDSADataStruct represents the ECDSAData struct in the IScribe interface.
type FeedIDs ¶ added in v0.23.0
type FeedIDs [256]bool
FeedIDs contains list of feed IDs. A feed ID is the first byte of the feed address.
func FeedIDsFromAddresses ¶ added in v0.23.0
FeedIDsFromAddresses returns a FeedIDs from a list of feed addresses.
func FeedIDsFromIDs ¶ added in v0.23.0
FeedIDsFromIDs returns a FeedIDs from a list of feed IDs.
func (FeedIDs) FeedIDs ¶ added in v0.23.0
FeedIDs returns a feed IDs as a byte slice. Each byte in the slice represents a feed ID.
func (FeedIDs) Has ¶ added in v0.23.0
Has returns true if the given address is included in the feed IDs.
func (*FeedIDs) SetFeedIDs ¶ added in v0.23.0
SetFeedIDs sets the feed IDs from a byte slice.
type FeedRegistry ¶ added in v0.23.0
type FeedRegistry struct {
// contains filtered or unexported fields
}
FeedRegistry allows interacting with the FeedRegistry contract.
func NewFeedRegistry ¶ added in v0.23.0
func NewFeedRegistry(client rpc.RPC, address types.Address) *FeedRegistry
NewFeedRegistry creates a new FeedRegistry instance.
func (*FeedRegistry) Address ¶ added in v0.23.0
func (w *FeedRegistry) Address() types.Address
Address returns the address of the FeedRegistry contract.
func (*FeedRegistry) Client ¶ added in v0.23.0
func (w *FeedRegistry) Client() rpc.RPC
Client returns the RPC client used to interact with the FeedRegistry.
func (*FeedRegistry) FeedExists ¶ added in v0.23.0
func (w *FeedRegistry) FeedExists(feed types.Address) contract.TypedSelfCaller[bool]
FeedExists returns whether address `feed` is a feed.
func (*FeedRegistry) Feeds ¶ added in v0.23.0
func (w *FeedRegistry) Feeds() contract.TypedSelfCaller[[]types.Address]
Feeds returns all of Chronicle Protocol's feeds.
type Median ¶
type Median struct {
// contains filtered or unexported fields
}
Median allows interacting with the Median contract.
func (*Median) Age ¶
func (m *Median) Age() contract.TypedSelfCaller[time.Time]
Age returns the current median price age.
func (*Median) Bar ¶
func (m *Median) Bar() contract.TypedSelfCaller[int]
Bar returns the median price bar.
func (*Median) Poke ¶
func (m *Median) Poke(vals []MedianVal) contract.SelfTransactableCaller
Poke updates the median price value.
type OpScribe ¶
type OpScribe struct {
Scribe
}
OpScribe allows interacting with the OpScribe contract.
func NewOpScribe ¶
NewOpScribe creates a new OpScribe instance.
func (*OpScribe) Client ¶ added in v0.23.0
Client returns the RPC client used to interact with the OpScribe.
func (*OpScribe) OpChallengePeriod ¶
func (s *OpScribe) OpChallengePeriod() contract.TypedSelfCaller[time.Duration]
OpChallengePeriod returns the challenge period for the OpScribe contract.
func (*OpScribe) OpPoke ¶
func (s *OpScribe) OpPoke(pokeData PokeData, schnorrData SchnorrData, ecdsaData types.Signature) contract.SelfTransactableCaller
OpPoke updates the optimistic poke data in the contract.
func (*OpScribe) Read ¶
Read reads the PokeData from the contract using the current time as the reference time for determining if the latest optimistic poke is finalized.
func (*OpScribe) ReadAt ¶
ReadAt reads the PokeData from the contract using the given readTime as the reference time for determining if the latest optimistic poke is finalized.
If the latest optimistic poke is finalized, the returned PokeData will be the latest optimistic poke. Otherwise, the returned PokeData will be the latest poke.
The returned boolean indicates if the latest optimistic poke is finalized.
func (*OpScribe) ReadNext ¶
ReadNext reads the next poke data from the contract without checking if the latest optimistic poke is already finalized.
func (*OpScribe) ReadNextAt ¶
ReadNextAt reads the next poke data from the contract without checking if the latest optimistic poke is already finalized.
The returned boolean indicates if the latest optimistic poke is finalized.
func (*OpScribe) ReadOpPokeData ¶
ReadOpPokeData reads the PokeData from the last optimistic poke.
type PokeDataStruct ¶
PokeDataStruct represents the PokeData struct in the IScribe interface.
type Registry ¶ added in v0.23.0
type Registry struct {
// contains filtered or unexported fields
}
Registry is a wrapper around the FeedRegistry and WatRegistry contracts.
It provides a single interface for querying on-chain registries.
func NewRegistry ¶ added in v0.23.0
func NewRegistry(feedRegistry *FeedRegistry, watRegistry *WatRegistry) (*Registry, error)
func (*Registry) Deployments ¶ added in v0.23.0
func (r *Registry) Deployments(ctx context.Context) ([]Deployment, error)
Deployments returns a list of all deployed contracts from the WatRegistry.
type SchnorrData ¶
type SchnorrDataStruct ¶
type SchnorrDataStruct struct { Signature *big.Int `abi:"signature"` Commitment types.Address `abi:"commitment"` FeedIDs []byte `abi:"feedIDs"` }
SchnorrDataStruct represents the SchnorrData struct in the IScribe interface.
type Scribe ¶
type Scribe struct {
// contains filtered or unexported fields
}
Scribe allows interacting with the Scribe contract.
func (*Scribe) Bar ¶
func (s *Scribe) Bar() contract.TypedSelfCaller[int]
Bar returns the bar value from the contract.
func (*Scribe) Feeds ¶
func (s *Scribe) Feeds() contract.TypedSelfCaller[[]types.Address]
Feeds returns Chronicle Protocol's feeds that are lifted in the contract.
func (*Scribe) Poke ¶
func (s *Scribe) Poke(pokeData PokeData, schnorrData SchnorrData) contract.SelfTransactableCaller
Poke updates the poke data in the contract.
type TryGetResult ¶
type WatRegistry ¶
type WatRegistry struct {
// contains filtered or unexported fields
}
WatRegistry allows interacting with the WatRegistry contract.
func NewWatRegistry ¶
func NewWatRegistry(client rpc.RPC, address types.Address) *WatRegistry
NewWatRegistry creates a new WatRegistry instance.
func (*WatRegistry) Address ¶
func (w *WatRegistry) Address() types.Address
Address returns the address of the WatRegistry contract.
func (*WatRegistry) Chains ¶ added in v0.23.0
func (w *WatRegistry) Chains(wat string) contract.TypedSelfCaller[[]uint64]
Chains returns wat `wat`'s list of chain ids its deployed to.
func (*WatRegistry) Client ¶ added in v0.23.0
func (w *WatRegistry) Client() rpc.RPC
Client returns the RPC client used to interact with the WatRegistry
func (*WatRegistry) Config ¶ added in v0.23.0
func (w *WatRegistry) Config(wat string) contract.TypedSelfCaller[ConfigResult]
Config returns wat `wat`'s configuration.
func (*WatRegistry) Deployment ¶ added in v0.23.0
func (w *WatRegistry) Deployment(wat string, chainID uint64) contract.TypedSelfCaller[types.Address]
Deployment returns wat `wat`'s deployment address for chain `chainId`.
func (*WatRegistry) Exists ¶ added in v0.23.0
func (w *WatRegistry) Exists(wat string) contract.TypedSelfCaller[bool]
Exists returns whether wat `wat` exists in registry.
func (*WatRegistry) Wats ¶ added in v0.23.0
func (w *WatRegistry) Wats() contract.TypedSelfCaller[[]string]
Wats returns all of Chronicle Protocol's wat identifiers.