account

package
v6.4.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package account 实现chain33 区块链资产操作

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB for account

func NewAccountDB

func NewAccountDB(cfg *types.Chain33Config, execer string, symbol string, db dbm.KV) (*DB, error)

NewAccountDB 新建DB账户

func NewCoinsAccount

func NewCoinsAccount(cfg *types.Chain33Config) *DB

NewCoinsAccount 新建账户

func (*DB) AccountKey

func (acc *DB) AccountKey(address string) (key []byte)

AccountKey return the key of address in DB

func (*DB) Burn

func (acc *DB) Burn(addr string, amount int64) (*types.Receipt, error)

Burn 然收

func (*DB) CheckTransfer

func (acc *DB) CheckTransfer(from, to string, amount int64) error

CheckTransfer 检查交易

func (*DB) ExecActive

func (acc *DB) ExecActive(addr, execaddr string, amount int64) (*types.Receipt, error)

ExecActive 执行激活资金

func (*DB) ExecAddress

func (acc *DB) ExecAddress(name string) string

ExecAddress 根据执行器名称获取执行器地址

func (*DB) ExecDeposit

func (acc *DB) ExecDeposit(addr, execaddr string, amount int64) (*types.Receipt, error)

ExecDeposit 在当前addr的execaddr地址中存款

func (*DB) ExecDepositFrozen

func (acc *DB) ExecDepositFrozen(addr, execaddr string, amount int64) (*types.Receipt, error)

ExecDepositFrozen 执行增发coins到具体的地址,并冻结

func (*DB) ExecFrozen

func (acc *DB) ExecFrozen(addr, execaddr string, amount int64) (*types.Receipt, error)

ExecFrozen 执行冻结资金,四个操作中 Deposit 自动完成,不需要模块外的函数来调用

func (*DB) ExecIssueCoins

func (acc *DB) ExecIssueCoins(execaddr string, amount int64) (*types.Receipt, error)

ExecIssueCoins 增发coins到具体的挖矿合约

func (*DB) ExecTransfer

func (acc *DB) ExecTransfer(from, to, execaddr string, amount int64) (*types.Receipt, error)

ExecTransfer 执行转帐

func (*DB) ExecTransferFrozen

func (acc *DB) ExecTransferFrozen(from, to, execaddr string, amount int64) (*types.Receipt, error)

ExecTransferFrozen 从自己冻结的钱里面扣除,转移到别人的活动钱包里面去

func (*DB) ExecWithdraw

func (acc *DB) ExecWithdraw(execaddr, addr string, amount int64) (*types.Receipt, error)

ExecWithdraw 执行撤回转帐

func (*DB) GenesisInit

func (acc *DB) GenesisInit(addr string, amount int64) (receipt *types.Receipt, err error)

GenesisInit 生成创世地址账户收据

func (*DB) GenesisInitExec

func (acc *DB) GenesisInitExec(addr string, amount int64, execaddr string) (receipt *types.Receipt, err error)

GenesisInitExec 生成创世地址执行器账户收据

func (*DB) GetBalance

func (acc *DB) GetBalance(api client.QueueProtocolAPI, in *types.ReqBalance) ([]*types.Account, error)

GetBalance 获取某个状态下账户余额

func (*DB) GetExecBalance

func (acc *DB) GetExecBalance(api client.QueueProtocolAPI, in *types.ReqGetExecBalance) (reply *types.ReplyGetExecBalance, err error)

GetExecBalance 通过account模块获取地址账户在合约中的余额

func (*DB) GetExecKVSet

func (acc *DB) GetExecKVSet(execaddr string, acc1 *types.Account) (kvset []*types.KeyValue)

GetExecKVSet 将执行账户数据转为数据库存储kv

func (*DB) GetKVSet

func (acc *DB) GetKVSet(acc1 *types.Account) (kvset []*types.KeyValue)

GetKVSet 将账户数据转为数据库存储kv

func (*DB) GetTotalCoins

func (acc *DB) GetTotalCoins(api client.QueueProtocolAPI, in *types.ReqGetTotalCoins) (reply *types.ReplyGetTotalCoins, err error)

GetTotalCoins 获取代币总量

func (*DB) LoadAccount

func (acc *DB) LoadAccount(addr string) *types.Account

LoadAccount 根据地址载入账户

func (*DB) LoadAccounts

func (acc *DB) LoadAccounts(api client.QueueProtocolAPI, addrs []string) (accs []*types.Account, err error)

LoadAccounts 从stateDB中载入若干账户 TODO:使用API的方式访问,暂时与LoadAccounts()共存,后续将删除LoadAccounts()

func (*DB) LoadAccountsDB

func (acc *DB) LoadAccountsDB(addrs []string) (accs []*types.Account, err error)

LoadAccountsDB 载入账户

func (*DB) LoadExecAccount

func (acc *DB) LoadExecAccount(addr, execaddr string) *types.Account

LoadExecAccount Load exec account from address and exec

func (*DB) LoadExecAccountHistoryQueue

func (acc *DB) LoadExecAccountHistoryQueue(api client.QueueProtocolAPI, addr, execaddr string, stateHash []byte) (*types.Account, error)

LoadExecAccountHistoryQueue 载入当前statehash,载入执行账户数据

func (*DB) LoadExecAccountQueue

func (acc *DB) LoadExecAccountQueue(api client.QueueProtocolAPI, addr, execaddr string) (*types.Account, error)

LoadExecAccountQueue load exec account from statedb

func (*DB) Mint

func (acc *DB) Mint(addr string, amount int64) (*types.Receipt, error)

Mint 铸币

func (*DB) SaveAccount

func (acc *DB) SaveAccount(acc1 *types.Account)

SaveAccount 保存账户到数据库

func (*DB) SaveExecAccount

func (acc *DB) SaveExecAccount(execaddr string, acc1 *types.Account)

SaveExecAccount save exec account data to db

func (*DB) SaveKVSet

func (acc *DB) SaveKVSet(set []*types.KeyValue)

SaveKVSet 保存Key Value set

func (*DB) SetDB

func (acc *DB) SetDB(db dbm.KV) *DB

SetDB set db

func (*DB) Transfer

func (acc *DB) Transfer(from, to string, amount int64) (*types.Receipt, error)

Transfer 执行交易

func (*DB) TransferToExec

func (acc *DB) TransferToExec(from, to string, amount int64) (*types.Receipt, error)

TransferToExec transfer coins from address to exec address

func (*DB) TransferWithdraw

func (acc *DB) TransferWithdraw(from, to string, amount int64) (*types.Receipt, error)

TransferWithdraw 撤回转帐

Jump to

Keyboard shortcuts

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