basicAssetsLedger

package
v0.0.0-...-fdc5c16 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MarketAddress = "MarketAddress"

Variables

View Source
var AssetsTypes struct {
	General   enum.Element
	Copyright enum.Element
}
View Source
var QueryTypes struct {
	Assets      enum.Element
	AllAssets   enum.Element
	UnspentList enum.Element
	Transaction enum.Element
	SellingList enum.Element
	Copyright   enum.Element
}
View Source
var StoragePrefixes struct {
	Assets                   enum.Element
	Copyright                enum.Element
	Unspent                  enum.Element
	Transactions             enum.Element
	TransactionWithBlockInfo enum.Element

	Balance     enum.Element
	SellingList enum.Element
}
View Source
var TransactionTypes struct {
	IssueAssets    enum.Element
	Transfer       enum.Element
	IncreaseSupply enum.Element

	StartSelling enum.Element
	StopSelling  enum.Element
	BuyAssets    enum.Element
}

Functions

func Load

func Load()

Types

type Assets

type Assets struct {
	AssetsData

	DateTime   string
	IssuedSeal seal.Entity
	MetaSeal   seal.Entity
}

type AssetsData

type AssetsData struct {
	Name        string
	Symbol      string
	Supply      uint64 `json:",string"`
	Type        uint32 `json:",string"`
	Increasable bool
	ExtraInfo   []byte
}

type AssetsList

type AssetsList struct {
	List []Assets
}

type Balance

type Balance struct {
	Address []byte
	Assets  Assets
	Amount  uint64
}
type Copyright struct {
	Assets
	Owner []byte
}

type Ledger

type Ledger struct {
	CryptoTools crypto.Tools
	Storage     kvDatabase.IDriver
	// contains filtered or unexported fields
}

func NewLedger

func NewLedger(storage kvDatabase.IDriver) (ledger *Ledger)

func (*Ledger) DoQuery

func (l *Ledger) DoQuery(req QueryRequest) (data interface{}, err error)

func (*Ledger) ExecuteTransaction

func (l *Ledger) ExecuteTransaction(tx Transaction) (ret interface{}, err error)

func (*Ledger) GetOriginalTransactionWithBlockInfo

func (l *Ledger) GetOriginalTransactionWithBlockInfo(hash []byte) (tx TransactionWithBlockInfo, err error)

func (*Ledger) GetTransactionsFromPool

func (l *Ledger) GetTransactionsFromPool() (txList []blockchainRequest.Entity, count uint32)

func (*Ledger) PushTransaction

func (l *Ledger) PushTransaction(req blockchainRequest.Entity) (err error)

func (*Ledger) RemoveTransactionFromPool

func (l *Ledger) RemoveTransactionFromPool(txKey string)

func (*Ledger) SaveTransactionWithBlockInfo

func (l *Ledger) SaveTransactionWithBlockInfo(tx Transaction, reqHash []byte, blockHeight uint64, actIndex uint32) (err error)

func (*Ledger) VerifyTransaction

func (l *Ledger) VerifyTransaction(tx Transaction) (err error)

wrap verify transaction method to solve interlock

type QueryRequest

type QueryRequest struct {
	DBType    string
	QueryType string
	Parameter []string
}

type SellingData

type SellingData struct {
	Price         uint64 `json:",string"`
	Amount        uint64 `json:",string"`
	Seller        []byte
	SellingAssets []byte
	PaymentAssets []byte
	Transaction   []byte
}

type SellingOperationResult

type SellingOperationResult struct {
	UnspentListWithBalance
	SellingData
}

type Transaction

type Transaction struct {
	TransactionData

	CreateTime int64
	Seal       seal.Entity
}

func (*Transaction) HashString

func (t *Transaction) HashString() string

func (*Transaction) Verify

func (t *Transaction) Verify(tools crypto.Tools) (err error)

type TransactionData

type TransactionData struct {
	TxType string
	Assets Assets
	Memo   string

	Input  []UTXOInput
	Output []UTXOOutput

	ExtraData []byte
}

type TransactionWithBlockInfo

type TransactionWithBlockInfo struct {
	Transaction
	BlockInfo struct {
		RequestHash []byte
		BlockHeight uint64
		ActionIndex uint32
	}
}

type UTXOInput

type UTXOInput struct {
	Transaction []byte
	OutputIndex uint64 `json:",string"`
}

type UTXOOutput

type UTXOOutput struct {
	To    []byte
	Value uint64 `json:",string"`
}

type Unspent

type Unspent struct {
	Owner       []byte
	AssetsHash  []byte
	Transaction []byte
	Singer      []byte
	OutputIndex uint64 `json:",string"`
	Value       uint64 `json:",string"`
}

type UnspentList

type UnspentList struct {
	List map[string]*UnspentUnderAssets
}

type UnspentListWithBalance

type UnspentListWithBalance struct {
	UnspentList []Unspent
	BalanceList []Balance
}

type UnspentQueryParameter

type UnspentQueryParameter struct {
	Address []byte
	Assets  []byte
}

type UnspentUnderAssets

type UnspentUnderAssets struct {
	Assets      Assets
	UnspentList []Unspent
}

Jump to

Keyboard shortcuts

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