types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = 2

	CodeInvalidAddress      sdk.CodeType = 101
	CodeInvalidOIndex       sdk.CodeType = 102
	CodeInvalidDenomination sdk.CodeType = 103
	CodeInvalidIOF          sdk.CodeType = 104
	CodeInvalidUTXO         sdk.CodeType = 105
	CodeInvalidTransaction  sdk.CodeType = 106
)

Reserve errors 100 ~ 199

Variables

This section is empty.

Functions

func ErrInvalidAddress

func ErrInvalidAddress(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidDenom

func ErrInvalidDenom(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidIOF

func ErrInvalidIOF(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidOIndex

func ErrInvalidOIndex(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidTransaction

func ErrInvalidTransaction(codespace sdk.CodespaceType, msg string) sdk.Error

---------------------------------------- Error constructors

func ErrInvalidUTXO

func ErrInvalidUTXO(codespace sdk.CodespaceType, msg string) sdk.Error

func RegisterAmino

func RegisterAmino(cdc *amino.Codec)

Types

type BaseTx

type BaseTx struct {
	Msg        SpendMsg
	Signatures []Signature
}

func NewBaseTx

func NewBaseTx(msg SpendMsg, sigs []Signature) BaseTx

func (BaseTx) GetMsgs added in v0.2.0

func (tx BaseTx) GetMsgs() []sdk.Msg

func (BaseTx) GetSignatures

func (tx BaseTx) GetSignatures() []Signature

type BaseUTXO

type BaseUTXO struct {
	InputAddresses [2]common.Address
	Address        common.Address
	Denom          uint64
	Position       Position
}

Implements UTXO interface

func (*BaseUTXO) GetAddress

func (utxo *BaseUTXO) GetAddress() common.Address

Implements UTXO

func (*BaseUTXO) GetDenom

func (utxo *BaseUTXO) GetDenom() uint64

Implements UTXO

func (*BaseUTXO) GetInputAddresses

func (utxo *BaseUTXO) GetInputAddresses() [2]common.Address

func (*BaseUTXO) GetPosition

func (utxo *BaseUTXO) GetPosition() Position

func (*BaseUTXO) SetAddress

func (utxo *BaseUTXO) SetAddress(addr common.Address) error

Implements UTXO

func (*BaseUTXO) SetDenom

func (utxo *BaseUTXO) SetDenom(denom uint64) error

Implements UTXO

func (*BaseUTXO) SetInputAddresses

func (utxo *BaseUTXO) SetInputAddresses(addrs [2]common.Address) error

func (*BaseUTXO) SetPosition

func (utxo *BaseUTXO) SetPosition(blockNum uint64, txIndex uint16, oIndex uint8, depositNum uint64) error

type Position

type Position struct {
	Blknum     uint64
	TxIndex    uint16
	Oindex     uint8
	DepositNum uint64
}

func NewPosition

func NewPosition(blknum uint64, txIndex uint16, oIndex uint8, depositNum uint64) Position

func (Position) GetSignBytes

func (position Position) GetSignBytes() []byte

Used to determine Sign Bytes for confirm signatures

type Signature added in v0.2.0

type Signature struct {
	Sig []byte
}

----------------------------------------- Wrapper for signature byte arrays

func (Signature) Bytes added in v0.2.0

func (s Signature) Bytes() []byte

type SpendMsg

type SpendMsg struct {
	Blknum1      uint64
	Txindex1     uint16
	Oindex1      uint8
	DepositNum1  uint64
	Owner1       common.Address
	ConfirmSigs1 [2]Signature
	Blknum2      uint64
	Txindex2     uint16
	Oindex2      uint8
	DepositNum2  uint64
	Owner2       common.Address
	ConfirmSigs2 [2]Signature
	Newowner1    common.Address
	Denom1       uint64
	Newowner2    common.Address
	Denom2       uint64
	Fee          uint64
}

func (SpendMsg) GetSignBytes

func (msg SpendMsg) GetSignBytes() []byte

Implements Msg.

func (SpendMsg) GetSigners

func (msg SpendMsg) GetSigners() []sdk.AccAddress

Implements Msg.

func (SpendMsg) Type

func (msg SpendMsg) Type() string

Implements Msg.

func (SpendMsg) ValidateBasic

func (msg SpendMsg) ValidateBasic() sdk.Error

Implements Msg.

type UTXO

type UTXO interface {
	// Address that owns UTXO
	GetAddress() common.Address
	SetAddress(common.Address) error // errors if already set

	GetInputAddresses() [2]common.Address
	SetInputAddresses([2]common.Address) error

	GetDenom() uint64
	SetDenom(uint64) error //errors if already set

	GetPosition() Position
	SetPosition(uint64, uint16, uint8, uint64) error
}

UTXO is a standard unspent transaction output

func NewBaseUTXO

func NewBaseUTXO(addr common.Address, inputaddr [2]common.Address, denom uint64,
	position Position) UTXO

type UTXOMapper

type UTXOMapper interface {
	GetUTXO(ctx sdk.Context, addr common.Address, position Position) UTXO
	GetUTXOsForAddress(ctx sdk.Context, addr common.Address) []UTXO
	AddUTXO(ctx sdk.Context, utxo UTXO)
	DeleteUTXO(ctx sdk.Context, addr common.Address, position Position)
}

UTXOMapper stores and retrieves UTXO's from stores retrieved from the context.

Jump to

Keyboard shortcuts

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