virtualtx

package
v0.0.0-...-7ee7fde Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// transfer asset
	VTransferTypeNormal uint8 = 1
	// create new asset
	VTransferTypeCreation uint8 = 2
	// mint existing asset
	VTransferTypeMint uint8 = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TransferResultItem

type TransferResultItem struct {
	Asset  []byte // not used
	Erc20  bool
	Create bool // true if a new asset is created
	Mint   bool // true if asset is mint

	// 721 asset mint record
	Erc721Mint map[int64]struct{}

	// asset transfer record
	Erc20Change  map[common.Address]int64              // 20 asset transfer record
	Erc721Change map[common.Address]map[int64]struct{} // 721 asset transfer record
}

type VTransfer

type VTransfer struct {
	From          []byte
	To            []byte
	Amount        int64
	Asset         *protos.Asset
	VTransferType uint8
}

type VirtualTransaction

type VirtualTransaction struct {
	VTransfer []*VTransfer
	// contains filtered or unexported fields
}

func NewVirtualTransaction

func NewVirtualTransaction() *VirtualTransaction

func (*VirtualTransaction) AppendVCreation

func (vtx *VirtualTransaction) AppendVCreation(to common.Address, amount *big.Int, assets *protos.Asset, vTransferType uint8)

func (*VirtualTransaction) AppendVTransfer

func (vtx *VirtualTransaction) AppendVTransfer(sender common.Address, to common.Address, amount *big.Int, assets *protos.Asset)

func (*VirtualTransaction) GetAllTransfers

func (vtx *VirtualTransaction) GetAllTransfers() map[protos.Asset]*TransferResultItem

func (*VirtualTransaction) GetIncoming

func (vtx *VirtualTransaction) GetIncoming(addr common.Address, assets *protos.Asset, voucherId int64) *big.Int

return total incoming for 20 asset return voucher id for 721 asset; return 0 if voucher id not in change list

Jump to

Keyboard shortcuts

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