Documentation ¶
Index ¶
- Variables
- func ApplyFuncIfNoError(ctx sdk.Context, f func(ctx sdk.Context) error) (err error)
- func CanCreateModuleAccountAtAddr(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) error
- func ContainsString(s []string, e string) bool
- func ConvertAddressToStrideAddress(address string) string
- func CreateModuleAccount(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) error
- func FilterDepositRecords(arr []recordstypes.DepositRecord, ...) (ret []recordstypes.DepositRecord)
- func GetFromBech32(bech32str, prefix string) ([]byte, error)
- func GetVestedCoinsAt(vAt int64, vStart int64, vLength int64, vCoins sdk.Coins) sdk.Coins
- func HostZoneDenomFromStAssetDenom(stAssetDenom string) string
- func Int32MapKeys[V any](m map[int32]V) []int32
- func Int64ToCoinString(amount int64, denom string) string
- func IsIBCToken(denom string) bool
- func IsOutOfGasError(err any) (bool, string)
- func LogHeader(s string, a ...any) string
- func LogICACallbackStatusWithHostZone(chainId string, callbackId string, status icacallbacktypes.AckResponseStatus, ...) string
- func LogICACallbackWithHostZone(chainId string, callbackId string, s string, a ...any) string
- func LogICQCallbackWithHostZone(chainId string, callbackId string, s string, a ...any) string
- func LogModuleMigration(ctx sdk.Context, versionMap module.VersionMap, moduleName string)
- func LogWithHostZone(chainId string, s string, a ...any) string
- func Max64(i, j int64) int64
- func Min(a int, b int) int
- func Min64(i, j int64) int64
- func PrintPanicRecoveryError(ctx sdk.Context, recoveryError interface{})
- func StAssetDenomFromHostZoneDenom(hostZoneDenom string) string
- func StringMapKeys[V any](m map[string]V) []string
- func ValidateAdminAddress(address string) error
- func VerifyAddressFormat(bz []byte) error
- func VerifyTxHash(txHash string) (err error)
- type AccAddress
- type AccountKeeper
Constants ¶
This section is empty.
Variables ¶
var Admins = map[string]bool{ "stride1k8c2m5cn322akk5wy8lpt87dd2f4yh9azg7jlh": true, "stride10d07y265gmmuvt4z0w9aw880jnsr700jefnezl": true, }
Functions ¶
func ApplyFuncIfNoError ¶
This function lets you run the function f, but if theres an error or panic drop the state machine change and log the error. If there is no error, proceeds as normal (but with some slowdown due to SDK store weirdness) Try to avoid usage of iterators in f.
If its an out of gas panic, this function will also panic like in normal tx execution flow. This is still safe for beginblock / endblock code though, as they do not have out of gas panics.
func CanCreateModuleAccountAtAddr ¶
func CanCreateModuleAccountAtAddr(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) error
CanCreateModuleAccountAtAddr tells us if we can safely make a module account at a given address. By collision resistance of the address (given API safe construction), the only way for an account to be already be at this address is if its claimed by the same pre-image from the correct module, or some SDK command breaks assumptions and creates an account at designated address. This function checks if there is an account at that address, and runs some safety checks to be extra-sure its not a user account (e.g. non-zero sequence, pubkey, of fore-seen account types). If there is no account, or if we believe its not a user-spendable account, we allow module account creation at the address. else, we do not.
func ConvertAddressToStrideAddress ¶
Convert any bech32 to stride address
func CreateModuleAccount ¶
func CreateModuleAccount(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) error
CreateModuleAccount creates a module account at the provided address. It overrides an account if it exists at that address, with a non-zero sequence number & pubkey Contract: addr is derived from `address.Module(ModuleName, key)`
func FilterDepositRecords ¶
func FilterDepositRecords(arr []recordstypes.DepositRecord, condition func(recordstypes.DepositRecord) bool) (ret []recordstypes.DepositRecord)
func GetFromBech32 ¶
GetFromBech32 decodes a bytestring from a Bech32 encoded string.
func GetVestedCoinsAt ¶
Compute coin amount for specific period using linear vesting calculation algorithm.
func HostZoneDenomFromStAssetDenom ¶
Returns the native denom from an stDenom by removing the st prefix
func Int32MapKeys ¶
func Int64ToCoinString ¶
func IsIBCToken ¶
isIBCToken checks if the token came from the IBC module Each IBC token starts with an ibc/ denom, the check is rather simple
func IsOutOfGasError ¶
Frustratingly, this has to return the error descriptor, not an actual error itself because the SDK errors here are not actually errors. (They don't implement error interface)
func LogHeader ¶
Returns a log header string with a dash padding on either side Ex:
------------------------------ string ------------------------------
func LogICACallbackStatusWithHostZone ¶
func LogICACallbackStatusWithHostZone(chainId string, callbackId string, status icacallbacktypes.AckResponseStatus, packet channeltypes.Packet) string
Returns a log string with a chain Id and icacallback as a prefix, and status of the callback Ex:
| COSMOSHUB-4 | DELEGATE ICACALLBACK | ICA SUCCESS, Packet: ...
func LogICACallbackWithHostZone ¶
Returns a log string with a chain Id and icacallback as a prefix Ex:
| COSMOSHUB-4 | DELEGATE ICACALLBACK | string
func LogICQCallbackWithHostZone ¶
Returns a log string with a chain Id and icqcallback as a prefix Ex:
| COSMOSHUB-4 | WITHDRAWALHOSTBALANCE ICQCALLBACK | string
func LogModuleMigration ¶
func LogModuleMigration(ctx sdk.Context, versionMap module.VersionMap, moduleName string)
Logs a module's migration info
func LogWithHostZone ¶
Returns a log string with a chainId and tab as the prefix Ex:
| COSMOSHUB-4 | string
func Max64 ¶
============================== AIRDROP UTILS ================================ max64 returns the maximum of its inputs.
func PrintPanicRecoveryError ¶
PrintPanicRecoveryError error logs the recoveryError, along with the stacktrace, if it can be parsed. If not emits them to stdout.
func StAssetDenomFromHostZoneDenom ¶
Returns the stDenom from a native denom by appending a st prefix
func StringMapKeys ¶
func ValidateAdminAddress ¶
func VerifyAddressFormat ¶
VerifyAddressFormat verifies that the provided bytes form a valid address according to the default address rules or a custom address verifier set by GetConfig().SetAddressVerifier(). TODO make an issue to get rid of global Config ref: https://github.com/cosmos/cosmos-sdk/issues/9690
Types ¶
type AccAddress ¶
type AccAddress []byte
AccAddress a wrapper around bytes meant to represent an account address. When marshaled to a string or JSON, it uses Bech32.
func AccAddressFromBech32 ¶
func AccAddressFromBech32(address string, bech32prefix string) (addr AccAddress, err error)
AccAddressFromBech32 creates an AccAddress from a Bech32 string.