asset

package
v0.0.0-...-d8d50ae Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AccountModel account
	AccountModel = iota
	// UtxoModel account
	UtxoModel
)

Variables

This section is empty.

Functions

func InitZip

func InitZip(db StateDB, total *big.Int, decimals uint64) error

InitZip Genesis asset ZIP

Types

type Account

type Account struct {
	Nonce uint64
}

Account .

type AccountAssetInfo

type AccountAssetInfo struct {
	Name     string
	Symbol   string
	Total    *big.Int
	Decimals uint64
	Owner    common.Address
}

AccountAssetInfo .

type Asset

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

Asset operating user assets

func NewAsset

func NewAsset(db StateDB) *Asset

NewAsset create Asset

func (*Asset) AddBalance

func (a *Asset) AddBalance(targetAddr common.Address, assetAddr common.Address, value interface{}) error

AddBalance add account balance

func (*Asset) CreateAccount

func (a *Asset) CreateAccount(addr common.Address) error

CreateAccount create account

func (*Asset) Empty

func (a *Asset) Empty(targetAddr common.Address) bool

Empty returns whether the account is empty

func (*Asset) EnoughBalance

func (a *Asset) EnoughBalance(targetAddr common.Address, assetAddr common.Address, value interface{}) (bool, error)

EnoughBalance .

func (*Asset) Exist

func (a *Asset) Exist(targetAddr common.Address) bool

Exist returns whether the account is exist

func (*Asset) GetBalance

func (a *Asset) GetBalance(targetAddr common.Address, assetAddr common.Address) interface{}

GetBalance get account balance

func (*Asset) GetNonce

func (a *Asset) GetNonce(targetAddr common.Address) uint64

GetNonce get nonce

func (*Asset) GetUserAssets

func (a *Asset) GetUserAssets(address common.Address) ([]UserAsset, error)

GetUserAssets .

func (*Asset) IssueAsset

func (a *Asset) IssueAsset(ownerAddr common.Address, assetAddr common.Address, value interface{}) error

IssueAsset issue asset

func (*Asset) RegisterAsset

func (a *Asset) RegisterAsset(baseType int, accountAddr common.Address, desc string) (common.Address, error)

RegisterAsset create asset

func (*Asset) SetNewOwner

func (a *Asset) SetNewOwner(oldOwner common.Address, assetAddr common.Address, newOwner common.Address) (bool, error)

SetNewOwner .

func (*Asset) SetNonce

func (a *Asset) SetNonce(targetAddr common.Address, nonce uint64) error

SetNonce set nonce

func (*Asset) SubBalance

func (a *Asset) SubBalance(targetAddr common.Address, assetAddr common.Address, value interface{}) error

SubBalance sub account balance

type StateDB

type StateDB interface {
	GetAccount(addr common.Address, key string) []byte
	SetAccount(addr common.Address, key string, value []byte)
}

StateDB is an Asset database for full state querying.

type UserAsset

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

UserAsset user asset info

Jump to

Keyboard shortcuts

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