ledger

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBalanceLockReason   = "token balance lock"
	DefaultBalanceUnlockReason = "token balance unlock"

	DefaultAllowedBalanceLockReason   = "allowed balance lock"
	DefaultAllowedBalanceUnlockReason = "allowed balance unlock"

	DefaultIndustrialBalanceLockReason   = "industrial balance lock"
	DefaultIndustrialBalanceUnlockReason = "industrial balance unlock"
)

Variables

This section is empty.

Functions

func AllowedBalanceAdd

func AllowedBalanceAdd(
	stub shim.ChaincodeStubInterface,
	token string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func AllowedBalanceBurnLocked

func AllowedBalanceBurnLocked(
	stub shim.ChaincodeStubInterface,
	token string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func AllowedBalanceGet

func AllowedBalanceGet(
	stub shim.ChaincodeStubInterface,
	token string,
	address *types.Address,
) (*big.Int, error)

func AllowedBalanceGetAll

func AllowedBalanceGetAll(
	stub shim.ChaincodeStubInterface,
	address *types.Address,
) (map[string]string, error)

func AllowedBalanceGetLocked

func AllowedBalanceGetLocked(
	stub shim.ChaincodeStubInterface,
	token string,
	address *types.Address,
) (*big.Int, error)

func AllowedBalanceLock

func AllowedBalanceLock(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	address *types.Address,
	amount *big.Int,
	opts ...LockOpt,
) error

func AllowedBalanceSub

func AllowedBalanceSub(
	stub shim.ChaincodeStubInterface,
	token string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func AllowedBalanceTransfer

func AllowedBalanceTransfer(
	stub shim.ChaincodeStubInterface,
	token string,
	from *types.Address,
	to *types.Address,
	amount *big.Int,
	reason string,
) error

func AllowedBalanceTransferLocked

func AllowedBalanceTransferLocked(
	stub shim.ChaincodeStubInterface,
	token string,
	from *types.Address,
	to *types.Address,
	amount *big.Int,
	reason string,
) error

func AllowedBalanceUnlock

func AllowedBalanceUnlock(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	address *types.Address,
	amount *big.Int,
	opts ...LockOpt,
) error

func AllowedIndustrialBalanceAdd

func AllowedIndustrialBalanceAdd(
	stub shim.ChaincodeStubInterface,
	address *types.Address,
	industrialAssets []*pb.Asset,
	reason string,
) error

func AllowedIndustrialBalanceSub

func AllowedIndustrialBalanceSub(
	stub shim.ChaincodeStubInterface,
	address *types.Address,
	industrialAssets []*pb.Asset,
	reason string,
) error

func AllowedIndustrialBalanceTransfer

func AllowedIndustrialBalanceTransfer(
	stub shim.ChaincodeStubInterface,
	from *types.Address,
	to *types.Address,
	industrialAssets []*pb.Asset,
	reason string,
) error

func GivenBalanceGet added in v0.0.6

func GivenBalanceGet(
	stub shim.ChaincodeStubInterface,
	token string,
) (*big.Int, error)

func IndustrialBalanceAdd

func IndustrialBalanceAdd(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func IndustrialBalanceBurnLocked

func IndustrialBalanceBurnLocked(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func IndustrialBalanceGet

func IndustrialBalanceGet(
	stub shim.ChaincodeStubInterface,
	address *types.Address,
) (map[string]string, error)

func IndustrialBalanceGetLocked

func IndustrialBalanceGetLocked(
	stub shim.ChaincodeStubInterface,
	address *types.Address,
) (map[string]string, error)

func IndustrialBalanceLock

func IndustrialBalanceLock(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	address *types.Address,
	amount *big.Int,
	opts ...LockOpt,
) error

func IndustrialBalanceSub

func IndustrialBalanceSub(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func IndustrialBalanceTransfer

func IndustrialBalanceTransfer(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	from *types.Address,
	to *types.Address,
	amount *big.Int,
	reason string,
) error

func IndustrialBalanceTransferLocked

func IndustrialBalanceTransferLocked(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	from *types.Address,
	to *types.Address,
	amount *big.Int,
	reason string,
) error

func IndustrialBalanceUnlock

func IndustrialBalanceUnlock(
	stub shim.ChaincodeStubInterface,
	symbol string,
	token string,
	address *types.Address,
	amount *big.Int,
	opts ...LockOpt,
) error

func TokenBalanceAdd

func TokenBalanceAdd(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func TokenBalanceAddWithReason

func TokenBalanceAddWithReason(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func TokenBalanceAddWithTicker

func TokenBalanceAddWithTicker(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	ticker string,
	reason string,
) error

func TokenBalanceBurnLocked

func TokenBalanceBurnLocked(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func TokenBalanceGet

func TokenBalanceGet(stub shim.ChaincodeStubInterface, address *types.Address) (*big.Int, error)

func TokenBalanceGetLocked

func TokenBalanceGetLocked(
	stub shim.ChaincodeStubInterface,
	address *types.Address,
) (*big.Int, error)

func TokenBalanceLock

func TokenBalanceLock(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	opts ...LockOpt,
) error

func TokenBalanceSub

func TokenBalanceSub(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	reason string,
) error

func TokenBalanceSubWithTicker

func TokenBalanceSubWithTicker(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	ticker string,
	reason string,
) error

func TokenBalanceTransfer

func TokenBalanceTransfer(
	stub shim.ChaincodeStubInterface,
	symbol string,
	from *types.Address,
	to *types.Address,
	amount *big.Int,
	reason string,
) error

func TokenBalanceTransferLocked

func TokenBalanceTransferLocked(
	stub shim.ChaincodeStubInterface,
	symbol string,
	from *types.Address,
	to *types.Address,
	amount *big.Int,
	reason string,
) error

func TokenBalanceUnlock

func TokenBalanceUnlock(
	stub shim.ChaincodeStubInterface,
	symbol string,
	address *types.Address,
	amount *big.Int,
	opts ...LockOpt,
) error

Types

type Accounting

type Accounting interface {
	AddAccountingRecord(
		token string,
		from *types.Address,
		to *types.Address,
		amount *big.Int,
		senderBalanceType balance.BalanceType,
		recipientBalanceType balance.BalanceType,
		reason string,
	)
}

type ListBalancePaginatedResponse added in v0.0.6

type ListBalancePaginatedResponse struct {
	Bookmark         string           `json:"bookmark"`
	Sum              []*RecordBalance `json:"sum"`
	RecordsOfBalance []*RecordBalance `json:"records"`
}

func AllowedBalancesGetWithPagination added in v0.0.6

func AllowedBalancesGetWithPagination(
	stub shim.ChaincodeStubInterface,
	bookmark string,
	pageSize uint64,
) (*ListBalancePaginatedResponse, error)

func GivenBalancesGetWithPagination added in v0.0.6

func GivenBalancesGetWithPagination(
	stub shim.ChaincodeStubInterface,
	bookmark string,
	pageSize uint64,
) (*ListBalancePaginatedResponse, error)

func IndustrialBalancesGetWithPagination added in v0.0.6

func IndustrialBalancesGetWithPagination(
	stub shim.ChaincodeStubInterface,
	bookmark string,
	pageSize uint64,
) (*ListBalancePaginatedResponse, error)

func LockedAllowedBalancesGetWithPagination added in v0.0.6

func LockedAllowedBalancesGetWithPagination(
	stub shim.ChaincodeStubInterface,
	bookmark string,
	pageSize uint64,
) (*ListBalancePaginatedResponse, error)

func LockedIndustrialBalancesGetWithPagination added in v0.0.6

func LockedIndustrialBalancesGetWithPagination(
	stub shim.ChaincodeStubInterface,
	bookmark string,
	pageSize uint64,
) (*ListBalancePaginatedResponse, error)

func LockedTokenBalancesGetWithPagination added in v0.0.6

func LockedTokenBalancesGetWithPagination(
	stub shim.ChaincodeStubInterface,
	bookmark string,
	pageSize uint64,
) (*ListBalancePaginatedResponse, error)

func TokenBalancesGetWithPagination added in v0.0.6

func TokenBalancesGetWithPagination(
	stub shim.ChaincodeStubInterface,
	bookmark string,
	pageSize uint64,
) (*ListBalancePaginatedResponse, error)

type LockOpt added in v0.0.8

type LockOpt func(*lockOpt)

func WithLockReason added in v0.0.8

func WithLockReason(reason string) LockOpt

type RecordBalance added in v0.0.6

type RecordBalance struct {
	Key   string   `json:"key"`
	Value *big.Int `json:"value"`
}

RecordBalance - one entry

Jump to

Keyboard shortcuts

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