utils

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectParamGet

func ExpectParamGet[T any](obj *T, paramKeeper *mocks.MockParamKeeper, key []byte, times int)

ExpectParamGet is a helper function that sets up an expected mock call for the provided type.

func GetBalance

func GetBalance(ctx context.Context, table api.BatchBalanceTable, addr types.AccAddress, key uint64) (*api.BatchBalance, error)

GetBalance gets the balance from the account, returning a default, zero value balance if no balance is found. NOTE: the default value is not inserted into the balance table in the `not found` case. Calling Update when the default value is returned will cause an error. The `Save` method should be used when dealing with balances from this function.

func GetCreditTypeFromBatchDenom

func GetCreditTypeFromBatchDenom(ctx context.Context, store api.StateStore, denom string) (*api.CreditType, error)

GetCreditTypeFromBatchDenom extracts the classId from a batch denom string, then retrieves it from the params.

func GetNonNegativeFixedDecs

func GetNonNegativeFixedDecs(precision uint32, decimals ...string) ([]math.Dec, error)

GetNonNegativeFixedDecs takes an arbitrary amount of decimal strings, and returns their corresponding fixed decimals in a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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