helpers

package
v0.0.0-...-b1d75aa Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a *big.Int, b *big.Int) *big.Int

Add two big Int numbers

func BufferToBigInt

func BufferToBigInt(buffer []byte) *big.Int

BufferToBigInt convert array of bytes to big.Int

func CheckApproved

func CheckApproved(approved *big.Int, key string) error

CheckApproved checks if approved amount is > 0

func CheckArgsLength

func CheckArgsLength(args []string, expectedLength int) error

CheckArgsLength compares length of string with `expectedLength`

func CheckBalance

func CheckBalance(balance *big.Int, mspID string) error

CheckBalance checks if sender's balance is > 0

func CheckCallerIsOwner

func CheckCallerIsOwner(caller string, owner string) error

CheckCallerIsOwner compares two strings

func CheckGreaterThanZero

func CheckGreaterThanZero(value string) error

CheckGreaterThanZero parses a string value to number and check if it's >= 0

func CheckTotalSupply

func CheckTotalSupply(amount *big.Int) error

CheckTotalSupply checks if totalSupplyAmount is valid

func DefaultToZeroIfEmpty

func DefaultToZeroIfEmpty(value []byte) []byte

DefaultToZeroIfEmpty return empty array of bytes (0) if the input is empty

func GetCallerID

func GetCallerID(stub shim.ChaincodeStubInterface) (string, error)

GetCallerID returns the unique ID (inside ledger) of chaicode caller.

The ID is a key of: `[mspID],[SubjectCN],[IssuerCN]`; this ID is used as "key" in the world-state database to identity a token owner.

- `mspID`: the MspID of the calling org

- `IssuerCN`: the common name from the calling identity's certificate CA provider

- `SubjectCN`: the common name from the calling identity's x509 certificate

func IsSmallerOrEqual

func IsSmallerOrEqual(a *big.Int, b *big.Int) error

IsSmallerOrEqual returns `nil` if a is <= b

func JSONToMap

func JSONToMap(str string) map[string]interface{}

JSONToMap returns a map from the input JSON string

func MalshalJSON

func MalshalJSON(payload interface{}) []byte

MalshalJSON returns the JSON encoding of `payload`

func Mul

func Mul(a *big.Int, b *big.Int) *big.Int

Mul two big Int numbers

func Pow

func Pow(a int64, b int64) *big.Int

Pow returns the a raised to the power of b in big Int type

func StringToBigInt

func StringToBigInt(str string) *big.Int

StringToBigInt converts type string to type big.Int

func StringToInt

func StringToInt(str string) int64

StringToInt converts type string to type int64

func Sub

func Sub(a *big.Int, b *big.Int) *big.Int

Sub two big Int numbers

Types

This section is empty.

Jump to

Keyboard shortcuts

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