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) TryGet ¶
func (w *Chainlog) TryGet(wat string) contract.TypedSelfCaller[TryGetResult]
TryGet returns the address of the contract that implements the given wat.
type ConfigResult ¶
type Deployment ¶
type ECDSADataStruct ¶
ECDSADataStruct represents the ECDSAData struct in the IScribe interface.
type FeedIDs ¶
type FeedIDs [256]bool
FeedIDs contains list of feed IDs. A feed ID is the first byte of the feed address.
func FeedIDsFromAddresses ¶
FeedIDsFromAddresses returns a FeedIDs from a list of feed addresses.
func FeedIDsFromIDs ¶
FeedIDsFromIDs returns a FeedIDs from a list of feed IDs.
func (FeedIDs) FeedIDs ¶
FeedIDs returns a feed IDs as a byte slice. Each byte in the slice represents a feed ID.
func (*FeedIDs) SetFeedIDs ¶
SetFeedIDs sets the feed IDs from a byte slice.
type FeedRegistry ¶
type FeedRegistry struct {
// contains filtered or unexported fields
}
FeedRegistry allows interacting with the FeedRegistry contract.
func NewFeedRegistry ¶
func NewFeedRegistry(client rpc.RPC, address types.Address) *FeedRegistry
NewFeedRegistry creates a new FeedRegistry instance.
func (*FeedRegistry) Address ¶
func (w *FeedRegistry) Address() types.Address
Address returns the address of the FeedRegistry contract.
func (*FeedRegistry) Client ¶
func (w *FeedRegistry) Client() rpc.RPC
Client returns the RPC client used to interact with the FeedRegistry.
func (*FeedRegistry) FeedExists ¶
func (w *FeedRegistry) FeedExists(feed types.Address) contract.TypedSelfCaller[bool]
FeedExists returns whether address `feed` is a feed.
func (*FeedRegistry) Feeds ¶
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) 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 ¶
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 ¶
func NewRegistry(feedRegistry *FeedRegistry, watRegistry *WatRegistry) (*Registry, error)
func (*Registry) Deployments ¶
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 ¶
func (w *WatRegistry) Chains(wat string) contract.TypedSelfCaller[[]uint64]
Chains returns wat `wat`'s list of chain ids its deployed to.
func (*WatRegistry) Client ¶
func (w *WatRegistry) Client() rpc.RPC
Client returns the RPC client used to interact with the WatRegistry
func (*WatRegistry) Config ¶
func (w *WatRegistry) Config(wat string) contract.TypedSelfCaller[ConfigResult]
Config returns wat `wat`'s configuration.
func (*WatRegistry) Deployment ¶
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 ¶
func (w *WatRegistry) Exists(wat string) contract.TypedSelfCaller[bool]
Exists returns whether wat `wat` exists in registry.
func (*WatRegistry) Wats ¶
func (w *WatRegistry) Wats() contract.TypedSelfCaller[[]string]
Wats returns all of Chronicle Protocol's wat identifiers.