chronicle

package
v0.22.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MedianPricePrecision = 18
View Source
const ScribePricePrecision = 18

Variables

This section is empty.

Functions

func ConstructMedianPokeMessage

func ConstructMedianPokeMessage(wat string, val *bn.DecFloatPointNumber, age time.Time) []byte

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, signersBlob []byte) []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 - signersBlob: a byte slice with signers indexes obtained from a contract

func ConstructScribePokeMessage

func ConstructScribePokeMessage(wat string, pokeData PokeData) []byte

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

func SignersBlob

func SignersBlob(signers []types.Address, feeds []types.Address, indices []uint8) ([]byte, error)

SignersBlob helps to generate signersBlob for PokeData struct.

Types

type Chainlog

type Chainlog struct {
	// contains filtered or unexported fields
}

func NewChainlog

func NewChainlog(client rpc.RPC, address types.Address) *Chainlog

func (*Chainlog) Address

func (w *Chainlog) Address() types.Address

func (*Chainlog) TryGet

type ECDSADataStruct

type ECDSADataStruct struct {
	V uint8    `abi:"v"`
	R *big.Int `abi:"r"`
	S *big.Int `abi:"s"`
}

ECDSADataStruct represents the ECDSAData struct in the IScribe interface.

type FeedsResult

type FeedsResult struct {
	Feeds       []types.Address `abi:"feeds"`
	FeedIndices []uint8         `abi:"feedIndexes"`
}

type Median

type Median struct {
	// contains filtered or unexported fields
}

func NewMedian

func NewMedian(client rpc.RPC, address types.Address) *Median

func (*Median) Address

func (m *Median) Address() types.Address

func (*Median) Age

func (*Median) Bar

func (m *Median) Bar() contract.TypedSelfCaller[int]

func (*Median) Client

func (m *Median) Client() rpc.RPC

func (*Median) Poke

func (*Median) Val

func (*Median) Wat

type MedianVal

type MedianVal struct {
	Val *bn.DecFixedPointNumber
	Age time.Time
	V   uint8
	R   *big.Int
	S   *big.Int
}

type OpScribe

type OpScribe struct {
	Scribe
}

func NewOpScribe

func NewOpScribe(client rpc.RPC, address types.Address) *OpScribe

func (*OpScribe) OpChallengePeriod

func (s *OpScribe) OpChallengePeriod() contract.TypedSelfCaller[time.Duration]

func (*OpScribe) OpPoke

func (s *OpScribe) OpPoke(pokeData PokeData, schnorrData SchnorrData, ecdsaData types.Signature) contract.SelfTransactableCaller

func (*OpScribe) Read

func (s *OpScribe) Read(ctx context.Context) (PokeData, error)

func (*OpScribe) ReadAt

func (s *OpScribe) ReadAt(ctx context.Context, readTime time.Time) (PokeData, bool, error)

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

func (s *OpScribe) ReadNext(ctx context.Context) (PokeData, bool, error)

func (*OpScribe) ReadNextAt

func (s *OpScribe) ReadNextAt(ctx context.Context, readTime time.Time) (PokeData, bool, error)

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

func (s *OpScribe) ReadOpPokeData(ctx context.Context) (PokeData, error)

func (*OpScribe) ReadPokeData

func (s *OpScribe) ReadPokeData(ctx context.Context) (PokeData, error)

type PokeData

type PokeData struct {
	Val *bn.DecFixedPointNumber
	Age time.Time
}

type PokeDataStruct

type PokeDataStruct struct {
	Val *big.Int `abi:"val"`
	Age uint32   `abi:"age"`
}

PokeDataStruct represents the PokeData struct in the IScribe interface.

type SchnorrData

type SchnorrData struct {
	Signature   *big.Int
	Commitment  types.Address
	SignersBlob []byte
}

type SchnorrDataStruct

type SchnorrDataStruct struct {
	Signature   *big.Int      `abi:"signature"`
	Commitment  types.Address `abi:"commitment"`
	SignersBlob []byte        `abi:"signersBlob"`
}

SchnorrDataStruct represents the SchnorrData struct in the IScribe interface.

type Scribe

type Scribe struct {
	// contains filtered or unexported fields
}

func NewScribe

func NewScribe(client rpc.RPC, address types.Address) *Scribe

func (*Scribe) Address

func (s *Scribe) Address() types.Address

func (*Scribe) Bar

func (s *Scribe) Bar() contract.TypedSelfCaller[int]

func (*Scribe) Client

func (s *Scribe) Client() rpc.RPC

func (*Scribe) Feeds

func (*Scribe) Poke

func (s *Scribe) Poke(pokeData PokeData, schnorrData SchnorrData) contract.SelfTransactableCaller

func (*Scribe) Read

func (s *Scribe) Read(ctx context.Context) (PokeData, error)

func (*Scribe) Wat

type TryGetResult

type TryGetResult struct {
	Ok      bool          `abi:"ok"`
	Address types.Address `abi:"address"`
}

type WatRegistry

type WatRegistry struct {
	// contains filtered or unexported fields
}

func NewWatRegistry

func NewWatRegistry(client rpc.RPC, address types.Address) *WatRegistry

func (*WatRegistry) Address

func (w *WatRegistry) Address() types.Address

func (*WatRegistry) Bar

func (*WatRegistry) Feeds

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL