Documentation ¶
Overview ¶
Package account 实现chain33 区块链资产操作
Index ¶
- type DB
- func (acc *DB) AccountKey(address string) (key []byte)
- func (acc *DB) CheckTransfer(from, to string, amount int64) error
- func (acc *DB) ExecActive(addr, execaddr string, amount int64) (*types.Receipt, error)
- func (acc *DB) ExecAddress(name string) string
- func (acc *DB) ExecDeposit(addr, execaddr string, amount int64) (*types.Receipt, error)
- func (acc *DB) ExecDepositFrozen(addr, execaddr string, amount int64) (*types.Receipt, error)
- func (acc *DB) ExecFrozen(addr, execaddr string, amount int64) (*types.Receipt, error)
- func (acc *DB) ExecTransfer(from, to, execaddr string, amount int64) (*types.Receipt, error)
- func (acc *DB) ExecTransferFrozen(from, to, execaddr string, amount int64) (*types.Receipt, error)
- func (acc *DB) ExecWithdraw(execaddr, addr string, amount int64) (*types.Receipt, error)
- func (acc *DB) GenesisInit(addr string, amount int64) (receipt *types.Receipt, err error)
- func (acc *DB) GenesisInitExec(addr string, amount int64, execaddr string) (receipt *types.Receipt, err error)
- func (acc *DB) GetBalance(api client.QueueProtocolAPI, in *types.ReqBalance) ([]*types.Account, error)
- func (acc *DB) GetExecBalance(api client.QueueProtocolAPI, in *types.ReqGetExecBalance) (reply *types.ReplyGetExecBalance, err error)
- func (acc *DB) GetExecKVSet(execaddr string, acc1 *types.Account) (kvset []*types.KeyValue)
- func (acc *DB) GetKVSet(acc1 *types.Account) (kvset []*types.KeyValue)
- func (acc *DB) GetTotalCoins(api client.QueueProtocolAPI, in *types.ReqGetTotalCoins) (reply *types.ReplyGetTotalCoins, err error)
- func (acc *DB) LoadAccount(addr string) *types.Account
- func (acc *DB) LoadAccounts(api client.QueueProtocolAPI, addrs []string) (accs []*types.Account, err error)
- func (acc *DB) LoadAccountsDB(addrs []string) (accs []*types.Account, err error)
- func (acc *DB) LoadExecAccount(addr, execaddr string) *types.Account
- func (acc *DB) LoadExecAccountHistoryQueue(api client.QueueProtocolAPI, addr, execaddr string, stateHash []byte) (*types.Account, error)
- func (acc *DB) LoadExecAccountQueue(api client.QueueProtocolAPI, addr, execaddr string) (*types.Account, error)
- func (acc *DB) SaveAccount(acc1 *types.Account)
- func (acc *DB) SaveExecAccount(execaddr string, acc1 *types.Account)
- func (acc *DB) SetDB(db dbm.KV) *DB
- func (acc *DB) Transfer(from, to string, amount int64) (*types.Receipt, error)
- func (acc *DB) TransferToExec(from, to string, amount int64) (*types.Receipt, error)
- func (acc *DB) TransferWithdraw(from, to string, amount int64) (*types.Receipt, error)
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 ¶
NewAccountDB 新建DB账户
func (*DB) AccountKey ¶
AccountKey return the key of address in DB
func (*DB) CheckTransfer ¶
CheckTransfer 检查交易
func (*DB) ExecActive ¶
ExecActive 执行激活资金
func (*DB) ExecDeposit ¶
ExecDeposit 在当前addr的execaddr地址中存款
func (*DB) ExecDepositFrozen ¶
ExecDepositFrozen 执行
func (*DB) ExecFrozen ¶
ExecFrozen 执行冻结资金,四个操作中 Deposit 自动完成,不需要模块外的函数来调用
func (*DB) ExecTransfer ¶
ExecTransfer 执行转帐
func (*DB) ExecTransferFrozen ¶
ExecTransferFrozen 从自己冻结的钱里面扣除,转移到别人的活动钱包里面去
func (*DB) ExecWithdraw ¶
ExecWithdraw 执行撤回转帐
func (*DB) GenesisInit ¶
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 ¶
GetExecKVSet 将执行账户数据转为数据库存储kv
func (*DB) GetTotalCoins ¶
func (acc *DB) GetTotalCoins(api client.QueueProtocolAPI, in *types.ReqGetTotalCoins) (reply *types.ReplyGetTotalCoins, err error)
GetTotalCoins 获取代币总量
func (*DB) LoadAccount ¶
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 ¶
LoadAccountsDB 载入账户
func (*DB) LoadExecAccount ¶
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) SaveExecAccount ¶
SaveExecAccount save exec account data to db
func (*DB) TransferToExec ¶
TransferToExec transfer coins from address to exec address