smartAssetsLedger

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: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CachedBlockGasKey             = "blockGas"
	CachedContractReturnData      = "contractReturnData"
	CachedContractCreationAddress = "contractCreationAddress"
)
View Source
const ContractAddressLen = 24

Variables

View Source
var Errors struct {
	Success                enum.ErrorElement `code:"0"`
	DBError                enum.ErrorElement
	InvalidTransactionType enum.ErrorElement
	InvalidTransferValue   enum.ErrorElement
	InsufficientBalance    enum.ErrorElement
	NegativeTransferValue  enum.ErrorElement

	InvalidContractCreationAddress enum.ErrorElement
	ContractCreationFailed         enum.ErrorElement
	ContractNotFound               enum.ErrorElement
	ContractExecuteFailed          enum.ErrorElement
	ContractExecuteRevert          enum.ErrorElement

	InvalidQuery     enum.ErrorElement
	InvalidParameter enum.ErrorElement
}
View Source
var QueryParameterFields struct {
	Address enum.Element
	TxHash  enum.Element
	Data    enum.Element
}
View Source
var QueryTypes struct {
	BaseAssets   enum.Element
	Balance      enum.Element
	Transaction  enum.Element
	OffChainCall enum.Element
}
View Source
var StoragePrefixes struct {
	SystemAssets enum.Element
	Assets       enum.Element
	Transaction  enum.Element
	Balance      enum.Element

	ContractLog       enum.Element
	ContractData      enum.Element
	ContractCode      enum.Element
	ContractHash      enum.Element
	ContractDestructs enum.Element
}
View Source
var TxType struct {
	Transfer       enum.Element
	CreateContract enum.Element
	ContractCall   enum.Element
}

Functions

func BuildKey

func BuildKey(el enum.Element, baseKey []byte, extra ...[]byte) []byte

func ContractAddressPrefix

func ContractAddressPrefix() []byte

func GetTxTypeCodeForName

func GetTxTypeCodeForName(name string) int

func Load

func Load()

Types

type BaseAssets

type BaseAssets struct {
	BaseAssetsData

	IssuedSeal seal.Entity
	MetaSeal   seal.Entity
}

type BaseAssetsData

type BaseAssetsData struct {
	Name        string
	Symbol      string
	Supply      string
	Precision   byte
	Increasable bool
	Owner       string
}

type Ledger

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

func NewLedger

func NewLedger(tools crypto.Tools, driver kvDatabase.IDriver) *Ledger

func (*Ledger) AddTx

func (l *Ledger) AddTx(req blockchainRequest.Entity) error

func (*Ledger) BalanceOf

func (l *Ledger) BalanceOf(address []byte) (balance *big.Int, err error)

func (*Ledger) DoQuery

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

func (*Ledger) Execute

func (l *Ledger) Execute(txList TransactionList, blk block.Entity) (result []byte, err error)

func (Ledger) GetTransactionsFromPool

func (l Ledger) GetTransactionsFromPool(blk block.Entity) (txList TransactionList, count uint32, txRoot []byte)

func (*Ledger) LoadGenesisAssets

func (l *Ledger) LoadGenesisAssets(owner []byte, assets BaseAssetsData) error

func (Ledger) PreExecute

func (l Ledger) PreExecute(txList TransactionList, blk block.Entity) (result []byte, err error)

func (*Ledger) SetChain

func (l *Ledger) SetChain(chain chainStructure.IChainInterface)

type QueryRequest

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

type StateData

type StateData struct {
	Key    []byte
	NewVal []byte
	OrgVal []byte
}

type Transaction

type Transaction struct {
	TransactionData
	TransactionResult

	DataSeal seal.Entity
}

type TransactionData

type TransactionData struct {
	Type         string
	From         []byte
	To           []byte
	Value        string
	Data         []byte
	Memo         string
	SerialNumber string
}

type TransactionList

type TransactionList struct {
	Transactions []Transaction
}

type TransactionResult

type TransactionResult struct {
	Success        bool
	ErrorCode      int64
	SequenceNumber uint32
	NewAddress     []byte
	ReturnData     []byte
	NewState       []StateData
}

Jump to

Keyboard shortcuts

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