core

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTrace = errors.New("invalid trace")
)

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID             uint            `sql:"PRIMARY_KEY" json:"id"`
	AssetID        string          `json:"asset_id,omitempty"`
	Symbol         string          `json:"symbol,omitempty"`
	Price          decimal.Decimal `sql:"type:decimal(24,12)" json:"price,omitempty"`
	PriceDuration  int64           `json:"price_duration,omitempty"`
	PriceUpdatedAt *time.Time      `json:"price_updated_at,omitempty"`
}

type AssetStore

type AssetStore interface {
	Create(ctx context.Context, assets []*Asset) error
	List(ctx context.Context) ([]*Asset, error)
	Find(ctx context.Context, assetID string) (*Asset, error)
	Update(ctx context.Context, asset *Asset) error
}

type CosiSignature

type CosiSignature struct {
	blst.Signature
	Mask uint64
}

func (*CosiSignature) Bytes

func (s *CosiSignature) Bytes() []byte

func (*CosiSignature) FromBytes

func (s *CosiSignature) FromBytes(bts []byte) error

func (*CosiSignature) MarshalBinary

func (s *CosiSignature) MarshalBinary() (data []byte, err error)

func (*CosiSignature) MarshalJSON

func (s *CosiSignature) MarshalJSON() ([]byte, error)

func (*CosiSignature) Scan

func (s *CosiSignature) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (*CosiSignature) String

func (s *CosiSignature) String() string

func (*CosiSignature) UnmarshalBinary

func (s *CosiSignature) UnmarshalBinary(data []byte) error

func (*CosiSignature) UnmarshalJSON

func (s *CosiSignature) UnmarshalJSON(b []byte) error

func (*CosiSignature) Value

func (s *CosiSignature) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type En256CosiSignature

type En256CosiSignature struct {
	en256.Signature
	Mask uint64
}

func (*En256CosiSignature) Bytes

func (s *En256CosiSignature) Bytes() []byte

func (*En256CosiSignature) FromBytes

func (s *En256CosiSignature) FromBytes(bts []byte) error

func (*En256CosiSignature) MarshalBinary

func (s *En256CosiSignature) MarshalBinary() (data []byte, err error)

func (*En256CosiSignature) MarshalJSON

func (s *En256CosiSignature) MarshalJSON() ([]byte, error)

func (*En256CosiSignature) Scan

func (s *En256CosiSignature) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (*En256CosiSignature) String

func (s *En256CosiSignature) String() string

func (*En256CosiSignature) UnmarshalBinary

func (s *En256CosiSignature) UnmarshalBinary(data []byte) error

func (*En256CosiSignature) UnmarshalJSON

func (s *En256CosiSignature) UnmarshalJSON(b []byte) error

func (*En256CosiSignature) Value

func (s *En256CosiSignature) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type En256Signature

type En256Signature en256.Signature

func (*En256Signature) MarshalBinary

func (s *En256Signature) MarshalBinary() ([]byte, error)

type PriceData

type PriceData struct {
	Timestamp      int64               `json:"t,omitempty"`
	AssetID        string              `json:"a,omitempty"`
	Price          decimal.Decimal     `json:"p,omitempty"`
	Signature      *CosiSignature      `json:"s,omitempty"`
	En256Signature *En256CosiSignature `json:"es,omitempty"`
}

func (*PriceData) MarshalBinary

func (p *PriceData) MarshalBinary() (data []byte, err error)

func (PriceData) Payload

func (p PriceData) Payload() []byte

func (PriceData) PayloadV1

func (p PriceData) PayloadV1() ([]byte, error)

func (*PriceData) UnmarshalBinary

func (p *PriceData) UnmarshalBinary(data []byte) error

type PriceRequest

type PriceRequest struct {
	Asset

	TraceID   string    `json:"trace_id,omitempty"`
	Receiver  *Receiver `json:"receiver,omitempty"`
	Signers   []*Signer `json:"signers,omitempty"`
	Threshold uint8     `json:"threshold"`
}

type Receiver

type Receiver struct {
	Members   []string `json:"members,omitempty"`
	Threshold uint8    `json:"threshold"`
}

type Signer

type Signer struct {
	Index          uint64           `json:"index,omitempty"`
	VerifyKey      *blst.PublicKey  `json:"verify_key,omitempty"`
	En256VerifyKey *en256.PublicKey `json:"en256_verify_key,omitempty"`
}

type Snapshot

type Snapshot struct {
	SnapshotID string
	TraceID    string
	CreatedAt  time.Time
	UserID     string
	OpponentID string
	AssetID    string
	Amount     decimal.Decimal
	Memo       string
}

type System

type System struct {
	Signers         []*Signer
	SignerThreshold uint8

	ClientID string

	MvmProcess   string
	MvmGroups    []string
	MvmThreshold uint8

	GasAsset  string
	GasAmount decimal.Decimal
}

System stores system information.

func (*System) VerifyData

func (s *System) VerifyData(p *PriceData) bool

type Transfer

type Transfer struct {
	AssetID   string
	TraceID   string
	Amount    decimal.Decimal
	Memo      string
	Opponents []string
	Threshold uint8
}

type WalletService

type WalletService interface {
	Poll(ctx context.Context, offset time.Time, limit int) ([]*Snapshot, error)
	Transfer(ctx context.Context, transfer *Transfer) error
}

Jump to

Keyboard shortcuts

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