accounts

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	FuncBalance           = "balance"
	FuncTotalAssets       = "totalAssets"
	FuncDeposit           = "deposit"
	FuncWithdrawToAddress = "withdrawToAddress"
	FuncWithdrawToChain   = "withdrawToChain"
	FuncAccounts          = "accounts"

	ParamAgentID = "a"
)
View Source
const (
	Name = "accounts"
)

Variables

View Source
var (
	Interface = &coreutil.ContractInterface{
		Name:        Name,
		Description: description,
		ProgramHash: hashing.HashStrings(Name),
	}
)

Functions

func Accrue

func Accrue(ctx coretypes.Sandbox, target coretypes.AgentID, tokens coretypes.ColoredBalances) error

Accrue calls "deposit" entry point of the accounts contract. Can only be called from full sandbox context

func CreditToAccount

func CreditToAccount(state kv.KVStore, agentID coretypes.AgentID, transfer coretypes.ColoredBalances)

CreditToAccount brings new funds to the on chain ledger.

func DebitFromAccount

func DebitFromAccount(state kv.KVStore, agentID coretypes.AgentID, transfer coretypes.ColoredBalances) bool

DebitFromAccount removes funds from the chain ledger.

func DecodeBalances

func DecodeBalances(balances dict.Dict) (map[balance.Color]int64, error)

func EncodeBalances

func EncodeBalances(balances map[balance.Color]int64) dict.Dict

func GetAccountBalances

func GetAccountBalances(state kv.KVStoreReader, agentID coretypes.AgentID) (map[balance.Color]int64, bool)

GetAccountBalances returns all colored balances belonging to the agentID on the state. Normally, the state is the partition of the 'accountsc'

func GetBalance

func GetBalance(state kv.KVStoreReader, agentID coretypes.AgentID, color balance.Color) int64

func MoveBetweenAccounts

func MoveBetweenAccounts(state kv.KVStore, fromAgentID, toAgentID coretypes.AgentID, transfer coretypes.ColoredBalances) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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