Documentation ¶
Index ¶
- Constants
- Variables
- func CreditToAccount(state kv.KVStore, agentID *iscp.AgentID, transfer colored.Balances)
- func DebitFromAccount(state kv.KVStore, agentID *iscp.AgentID, transfer colored.Balances) bool
- func DecodeBalances(balances dict.Dict) (colored.Balances, error)
- func EncodeBalances(balances colored.Balances) dict.Dict
- func GetAccountBalances(state kv.KVStoreReader, agentID *iscp.AgentID) (colored.Balances, bool)
- func GetBalance(state kv.KVStoreReader, agentID *iscp.AgentID, col colored.Color) uint64
- func GetMaxAssumedNonce(state kv.KVStoreReader, address ledgerstate.Address) uint64
- func GetTotalAssets(state kv.KVStoreReader) colored.Balances
- func MoveBetweenAccounts(state kv.KVStore, fromAgentID, toAgentID *iscp.AgentID, ...) bool
- func RecordMaxAssumedNonce(state kv.KVStore, address ledgerstate.Address, nonce uint64)
Constants ¶
View Source
const ( ParamAgentID = "a" ParamWithdrawColor = "c" ParamWithdrawAmount = "m" ParamAccountNonce = "n" )
Variables ¶
View Source
var ( FuncViewBalance = coreutil.ViewFunc("balance") FuncViewTotalAssets = coreutil.ViewFunc("totalAssets") FuncViewAccounts = coreutil.ViewFunc("accounts") FuncDeposit = coreutil.Func("deposit") FuncWithdraw = coreutil.Func("withdraw") FuncHarvest = coreutil.Func("harvest") FuncGetAccountNonce = coreutil.ViewFunc("getAccountNonce") )
View Source
var Contract = coreutil.NewContract(coreutil.CoreContractAccounts, "Chain account ledger contract")
View Source
var Processor = Contract.Processor(initialize, FuncViewBalance.WithHandler(viewBalance), FuncViewTotalAssets.WithHandler(viewTotalAssets), FuncViewAccounts.WithHandler(viewAccounts), FuncDeposit.WithHandler(deposit), FuncWithdraw.WithHandler(withdraw), FuncHarvest.WithHandler(harvest), FuncGetAccountNonce.WithHandler(getAccountNonce), )
Functions ¶
func CreditToAccount ¶
CreditToAccount brings new funds to the on chain ledger.
func DebitFromAccount ¶
DebitFromAccount removes funds from the chain ledger.
func GetAccountBalances ¶
GetAccountBalances returns all colored balances belonging to the agentID on the state. Normally, the state is the partition of the 'accountsc'
func GetBalance ¶
func GetMaxAssumedNonce ¶ added in v0.2.0
func GetMaxAssumedNonce(state kv.KVStoreReader, address ledgerstate.Address) uint64
func GetTotalAssets ¶ added in v0.2.0
func GetTotalAssets(state kv.KVStoreReader) colored.Balances
func MoveBetweenAccounts ¶
func RecordMaxAssumedNonce ¶ added in v0.2.0
func RecordMaxAssumedNonce(state kv.KVStore, address ledgerstate.Address, nonce uint64)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.