contract

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 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 added in v0.19.2

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 added in v0.19.2

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 added in v0.19.2

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 IsRevert added in v0.20.0

func IsRevert(err error) bool

IsRevert returns true if execution of the call was reverted.

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

func (w *Chainlog) TryGet(ctx context.Context, wat string) (ok bool, address types.Address, ere error)

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 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 (m *Median) Age(ctx context.Context) (time.Time, error)

func (*Median) Bar

func (m *Median) Bar(ctx context.Context) (int, error)

func (*Median) Poke

func (m *Median) Poke(ctx context.Context, vals []MedianVal) (*types.Hash, *types.Transaction, error)

func (*Median) Val

func (*Median) Wat

func (m *Median) Wat(ctx context.Context) (string, error)

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 added in v0.16.0

func (s *OpScribe) OpChallengePeriod(ctx context.Context) (time.Duration, error)

func (*OpScribe) OpPoke

func (s *OpScribe) OpPoke(
	ctx context.Context,
	pokeData PokeData,
	schnorrData SchnorrData,
	ecdsaData types.Signature,
) (
	*types.Hash,
	*types.Transaction,
	error,
)

func (*OpScribe) Read added in v0.16.0

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

func (*OpScribe) ReadAt added in v0.16.0

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

func (*OpScribe) ReadOpPokeData added in v0.16.0

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

func (*OpScribe) ReadPokeData added in v0.16.0

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(ctx context.Context) (int, error)

func (*Scribe) Feeds

func (s *Scribe) Feeds(ctx context.Context) ([]types.Address, []uint8, error)

func (*Scribe) Poke

func (s *Scribe) Poke(ctx context.Context, pokeData PokeData, schnorrData SchnorrData) (*types.Hash, *types.Transaction, error)

func (*Scribe) Read

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

func (*Scribe) Wat

func (s *Scribe) Wat(ctx context.Context) (string, error)

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 (w *WatRegistry) Bar(ctx context.Context, wat string) (int, error)

func (*WatRegistry) Feeds

func (w *WatRegistry) Feeds(ctx context.Context, wat string) ([]types.Address, error)

Jump to

Keyboard shortcuts

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