account

package
v0.0.0-...-9098a98 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package account manages the accounts in the network.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBalanceOverflow  = errors.New("account balance overflow")
	ErrBalanceUnderflow = errors.New("account balance underflow")
	ErrBalanceUnderfund = errors.New("account balance underfund")
	ErrTrustOverLimit   = errors.New("trust balance over limit")
	ErrTrustUnderflow   = errors.New("trust balance underflow")
	ErrInvalidUpdate    = errors.New("account update invalid")
)

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Master *ultpb.Account
	// contains filtered or unexported fields
}

Manager manages accounts and trusts.

func NewManager

func NewManager(d db.Database, baseReserve int64) *Manager

func (*Manager) CreateAccount

func (am *Manager) CreateAccount(putter db.Putter, accountID string, balance int64, signer string, seqNum uint64) error

Create a new account with initial balance. Note that this method simply save the account info in database and all the necessary validity checks should be done before invoking this method.

func (*Manager) CreateMasterAccount

func (am *Manager) CreateMasterAccount(networkID []byte, balance int64, seqNum uint64) error

Create master account with native asset (ULT) and initial balances.

func (*Manager) CreateTrust

func (am *Manager) CreateTrust(putter db.Putter, accountID string, asset *ultpb.Asset, limit int64) error

Create a new trust for issued asset.

func (*Manager) DeleteTrust

func (am *Manager) DeleteTrust(deleter db.Deleter, accountID string, asset *ultpb.Asset) error

Delete the trust.

func (*Manager) GetAccount

func (am *Manager) GetAccount(getter db.Getter, accountID string) (*ultpb.Account, error)

Get account information.

func (*Manager) GetBalance

func (am *Manager) GetBalance(acc *ultpb.Account) int64

Get the balance of the account.

func (*Manager) GetRestLimit

func (am *Manager) GetRestLimit(acc *ultpb.Account) int64

Get the rest limit of native asset the account can have.

func (*Manager) GetTrust

func (am *Manager) GetTrust(getter db.Getter, accountID string, asset *ultpb.Asset) (*ultpb.Trust, error)

Get trust information.

func (*Manager) GetTrustBalance

func (am *Manager) GetTrustBalance(trust *ultpb.Trust) int64

Get available balance for trust.

func (*Manager) GetTrustRestLimit

func (am *Manager) GetTrustRestLimit(trust *ultpb.Trust) int64

Get rest limit of custom asset the trust can have.

func (*Manager) SaveAccount

func (am *Manager) SaveAccount(putter db.Putter, acc *ultpb.Account) error

Update account information.

func (*Manager) SaveTrust

func (am *Manager) SaveTrust(putter db.Putter, trust *ultpb.Trust) error

Update trust information.

func (*Manager) UpdateBalance

func (am *Manager) UpdateBalance(acc *ultpb.Account, balance int64) error

Update account balance.

func (*Manager) UpdateEntryCount

func (am *Manager) UpdateEntryCount(acc *ultpb.Account, count int32) error

Update entry count.

func (*Manager) UpdateLiability

func (am *Manager) UpdateLiability(acc *ultpb.Account, amount int64, buy bool) error

Update account liability.

func (*Manager) UpdateTrustBalance

func (am *Manager) UpdateTrustBalance(trust *ultpb.Trust, balance int64) error

Update trust balance.

func (*Manager) UpdateTrustLiability

func (am *Manager) UpdateTrustLiability(trust *ultpb.Trust, amount int64, buy bool) error

Update trust liability.

Jump to

Keyboard shortcuts

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