ava

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSortedAndUniqueTransferableInputs

func IsSortedAndUniqueTransferableInputs(ins []*TransferableInput) bool

IsSortedAndUniqueTransferableInputs ...

func IsSortedAndUniqueTransferableInputsWithSigners

func IsSortedAndUniqueTransferableInputsWithSigners(ins []*TransferableInput, signers [][]*crypto.PrivateKeySECP256K1R) bool

IsSortedAndUniqueTransferableInputsWithSigners returns true if the inputs are sorted and unique

func IsSortedAndUniqueUTXOIDs

func IsSortedAndUniqueUTXOIDs(utxos []*UTXOID) bool

IsSortedAndUniqueUTXOIDs ...

func IsSortedTransferableOutputs

func IsSortedTransferableOutputs(outs []*TransferableOutput, c codec.Codec) bool

IsSortedTransferableOutputs returns true if output objects are sorted

func SortTransferableInputs

func SortTransferableInputs(ins []*TransferableInput)

SortTransferableInputs ...

func SortTransferableInputsWithSigners

func SortTransferableInputsWithSigners(ins []*TransferableInput, signers [][]*crypto.PrivateKeySECP256K1R)

SortTransferableInputsWithSigners sorts the inputs and signers based on the input's utxo ID

func SortTransferableOutputs

func SortTransferableOutputs(outs []*TransferableOutput, c codec.Codec)

SortTransferableOutputs sorts output objects

func SortUTXOIDs

func SortUTXOIDs(utxos []*UTXOID)

SortUTXOIDs ...

func UniqueID

func UniqueID(id ids.ID, prefix uint64, cacher cache.Cacher) ids.ID

UniqueID returns a unique identifier

Types

type Addressable

type Addressable interface {
	Addresses() [][]byte
}

Addressable is the interface a feature extension must provide to be able to be tracked as a part of the utxo set for a set of addresses

type Asset

type Asset struct {
	ID ids.ID `serialize:"true" json:"assetID"`
}

Asset ...

func (*Asset) AssetID

func (asset *Asset) AssetID() ids.ID

AssetID returns the ID of the contained asset

func (*Asset) Verify

func (asset *Asset) Verify() error

Verify implements the verify.Verifiable interface

type FlowChecker

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

FlowChecker ...

func NewFlowChecker

func NewFlowChecker() *FlowChecker

NewFlowChecker ...

func (*FlowChecker) Consume

func (fc *FlowChecker) Consume(assetID ids.ID, amount uint64)

Consume ...

func (*FlowChecker) Produce

func (fc *FlowChecker) Produce(assetID ids.ID, amount uint64)

Produce ...

func (*FlowChecker) Verify

func (fc *FlowChecker) Verify() error

Verify ...

type Metadata

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

Metadata ...

func (*Metadata) Bytes

func (md *Metadata) Bytes() []byte

Bytes returns the binary representation of this data

func (*Metadata) ID

func (md *Metadata) ID() ids.ID

ID returns the unique ID of this data

func (*Metadata) Initialize

func (md *Metadata) Initialize(bytes []byte)

Initialize set the bytes and ID

func (*Metadata) Verify

func (md *Metadata) Verify() error

Verify implements the verify.Verifiable interface

type PrefixedState

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

PrefixedState wraps a state object. By prefixing the state, there will be no collisions between different types of objects that have the same hash.

func NewPrefixedState

func NewPrefixedState(db database.Database, codec codec.Codec) *PrefixedState

NewPrefixedState ...

func (*PrefixedState) AVMFunds

func (s *PrefixedState) AVMFunds(id ids.ID) ([]ids.ID, error)

AVMFunds returns the mapping from the 32 byte representation of an address to a list of utxo IDs that reference the address.

func (*PrefixedState) AVMUTXO

func (s *PrefixedState) AVMUTXO(id ids.ID) (*UTXO, error)

AVMUTXO attempts to load a utxo from avm's storage.

func (*PrefixedState) FundAVMUTXO

func (s *PrefixedState) FundAVMUTXO(utxo *UTXO) error

FundAVMUTXO adds the provided utxo to the database

func (*PrefixedState) FundPlatformUTXO

func (s *PrefixedState) FundPlatformUTXO(utxo *UTXO) error

FundPlatformUTXO adds the provided utxo to the database

func (*PrefixedState) PlatformFunds

func (s *PrefixedState) PlatformFunds(id ids.ID) ([]ids.ID, error)

PlatformFunds returns the mapping from the 32 byte representation of an address to a list of utxo IDs that reference the address.

func (*PrefixedState) PlatformUTXO

func (s *PrefixedState) PlatformUTXO(id ids.ID) (*UTXO, error)

PlatformUTXO attempts to load a utxo from platform's storage.

func (*PrefixedState) SpendAVMUTXO

func (s *PrefixedState) SpendAVMUTXO(utxoID ids.ID) error

SpendAVMUTXO consumes the provided platform utxo.

func (*PrefixedState) SpendPlatformUTXO

func (s *PrefixedState) SpendPlatformUTXO(utxoID ids.ID) error

SpendPlatformUTXO consumes the provided platform utxo.

type State

type State struct {
	Cache cache.Cacher
	DB    database.Database
	Codec codec.Codec
}

State is a thin wrapper around a database to provide, caching, serialization, and de-serialization.

func (*State) IDs

func (s *State) IDs(id ids.ID) ([]ids.ID, error)

IDs returns a slice of IDs from storage

func (*State) SetIDs

func (s *State) SetIDs(id ids.ID, idSlice []ids.ID) error

SetIDs saves a slice of IDs to the database.

func (*State) SetStatus

func (s *State) SetStatus(id ids.ID, status choices.Status) error

SetStatus saves a status in storage.

func (*State) SetUTXO

func (s *State) SetUTXO(id ids.ID, utxo *UTXO) error

SetUTXO saves the provided utxo to storage.

func (*State) Status

func (s *State) Status(id ids.ID) (choices.Status, error)

Status returns a status from storage.

func (*State) UTXO

func (s *State) UTXO(id ids.ID) (*UTXO, error)

UTXO attempts to load a utxo from storage.

type TestTransferable

type TestTransferable struct {
	TestVerifiable

	Val uint64 `serialize:"true"`
}

TestTransferable ...

func (*TestTransferable) Amount

func (t *TestTransferable) Amount() uint64

Amount ...

type TestVerifiable

type TestVerifiable struct{ Err error }

TestVerifiable ...

func (*TestVerifiable) Verify

func (v *TestVerifiable) Verify() error

Verify ...

type Transferable

type Transferable interface {
	verify.Verifiable

	// Amount returns how much value this output consumes of the asset in its
	// transaction.
	Amount() uint64
}

Transferable is the interface a feature extension must provide to transfer value between features extensions.

type TransferableInput

type TransferableInput struct {
	UTXOID `serialize:"true"`
	Asset  `serialize:"true"`

	In Transferable `serialize:"true" json:"input"`
}

TransferableInput ...

func (*TransferableInput) Input

func (in *TransferableInput) Input() Transferable

Input returns the feature extension input that this Input is using.

func (*TransferableInput) Verify

func (in *TransferableInput) Verify() error

Verify implements the verify.Verifiable interface

type TransferableOutput

type TransferableOutput struct {
	Asset `serialize:"true"`

	Out Transferable `serialize:"true" json:"output"`
}

TransferableOutput ...

func (*TransferableOutput) Output

func (out *TransferableOutput) Output() Transferable

Output returns the feature extension output that this Output is using.

func (*TransferableOutput) Verify

func (out *TransferableOutput) Verify() error

Verify implements the verify.Verifiable interface

type UTXO

type UTXO struct {
	UTXOID `serialize:"true"`
	Asset  `serialize:"true"`

	Out verify.Verifiable `serialize:"true" json:"output"`
}

UTXO ...

func (*UTXO) Verify

func (utxo *UTXO) Verify() error

Verify implements the verify.Verifiable interface

type UTXOID

type UTXOID struct {
	// Serialized:
	TxID        ids.ID `serialize:"true" json:"txID"`
	OutputIndex uint32 `serialize:"true" json:"outputIndex"`

	// Symbol is false if the UTXO should be part of the DB
	Symbol bool
	// contains filtered or unexported fields
}

UTXOID ...

func (*UTXOID) InputID

func (utxo *UTXOID) InputID() ids.ID

InputID returns a unique ID of the UTXO that this input is spending

func (*UTXOID) InputSource

func (utxo *UTXOID) InputSource() (ids.ID, uint32)

InputSource returns the source of the UTXO that this input is spending

func (*UTXOID) Symbolic

func (utxo *UTXOID) Symbolic() bool

Symbolic returns if this is the ID of a UTXO in the DB, or if it is a symbolic input

func (*UTXOID) Verify

func (utxo *UTXOID) Verify() error

Verify implements the verify.Verifiable interface

Jump to

Keyboard shortcuts

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