balance

package
v0.0.0-...-c9d2d86 Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: ISC Imports: 2 Imported by: 0

Documentation

Overview

Copyright (C) 2017, Zipper Team. All rights reserved.

This file is part of zipper

The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ISC License for more details.

You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Amounts map[uint32]int64
	// contains filtered or unexported fields
}

Balance Contain all asset amounts and nonce

func NewBalance

func NewBalance() *Balance

NewBalance Create an balance object

func (*Balance) Add

func (b *Balance) Add(id uint32, amount int64) int64

Add Set amount of asset to sum +y and return.

func (*Balance) Deserialize

func (b *Balance) Deserialize(balanceBytes []byte) error

Deserialize deserializes bytes to a balance

func (*Balance) Get

func (b *Balance) Get(id uint32) int64

Get Get amount of asset

func (*Balance) Serialize

func (b *Balance) Serialize() []byte

Serialize returns the serialized bytes of a balance

func (*Balance) Set

func (b *Balance) Set(id uint32, amount int64)

Set Set amount of asset

Jump to

Keyboard shortcuts

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