account

package
v0.0.0-...-4701ab3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: LGPL-3.0 Imports: 6 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMismatchSignaturesCount = errors.New("mismatch signatures count")
	ErrInsufficientBalance     = errors.New("insufficient balance")
)

amount errors

Functions

This section is empty.

Types

type Account

type Account interface {
	io.WriterTo
	io.ReaderFrom
	json.Marshaler
	Type() Type
	Address() common.Address
	Name() string
	Balance() *amount.Amount
	AddBalance(a *amount.Amount)
	SubBalance(a *amount.Amount) error
	Clone() Account
}

Account is a interface that defines common account functions

type Base

type Base struct {
	Type_    Type
	Address_ common.Address
	Name_    string
	Balance_ *amount.Amount
}

Base is the parts of account functions that are not changed by derived one

func (*Base) AddBalance

func (acc *Base) AddBalance(a *amount.Amount)

AddBalance adds the balance to the account

func (*Base) Address

func (acc *Base) Address() common.Address

Address returns the account address

func (*Base) Balance

func (acc *Base) Balance() *amount.Amount

Balance returns the balance of the account

func (*Base) Name

func (acc *Base) Name() string

Name returns the account name

func (*Base) ReadFrom

func (acc *Base) ReadFrom(r io.Reader) (int64, error)

ReadFrom is a deserialization function

func (*Base) SubBalance

func (acc *Base) SubBalance(a *amount.Amount) error

SubBalance subs the balance from the account

func (*Base) Type

func (acc *Base) Type() Type

Type returns the account type

func (*Base) WriteTo

func (acc *Base) WriteTo(w io.Writer) (int64, error)

WriteTo is a serialization function

type Type

type Type uint8

Type is using when serealization and deserialization account

Jump to

Keyboard shortcuts

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