Documentation ¶
Overview ¶
Package checkers provides functions and structures to verify common types and aggregate errors.
Index ¶
- Variables
- func AssertGovAuthority(authority string) error
- func BigNumPositive[T interface{ ... }](a T, note string) error
- func DecInZeroOne(a sdk.Dec, name string, oneInclusive bool) error
- func DecMaxDiff(a, b, maxDiff sdk.Dec, note string) error
- func DecNotNegative(a sdk.Dec, paramName string) error
- func DecPositive(a sdk.Dec, paramName string) error
- func Description(d string) error
- func EmergencyGroupAuthority(authority string, eg WithEmergencyGroup) (bool, error)
- func IntegerMaxDiff[T constraints.Integer](a, b, maxDiff T, note string) error
- func IsGovAuthority(authority string) bool
- func Merge(errs1, errs2 []error) []error
- func NumberMin[T constraints.Integer](a, minVal T, note string) error
- func NumberPositive[T constraints.Integer](a T, note string) error
- func PositiveCoins(note string, coins ...sdk.Coin) []error
- func Proposal(authority, description string) error
- func RequireDecMaxDiff(t *testing.T, a, b, maxDiff sdk.Dec, note string)
- func Signers(signers ...string) []sdk.AccAddress
- func ValidateAddr(addr, name string) error
- type WithEmergencyGroup
Constants ¶
This section is empty.
Variables ¶
var GovModuleAddr string
GovModuleAddr is set during the first call of ValidateProposal
Functions ¶
func AssertGovAuthority ¶
AssertGovAuthority errors is the authority is not the gov module address. Panics if the gov module address is not set during the package initialization.
func BigNumPositive ¶ added in v6.6.0
func DecInZeroOne ¶
DecInZeroOne asserts that 0 <= a <= 1 when oneInclusive=True, otherwise asserts 0 <= a < 1
func DecNotNegative ¶ added in v6.3.0
DecNotNegative checks if a is defined and a >= 0
func DecPositive ¶ added in v6.3.0
DecPositive checks if a is defined and a > 0
func Description ¶
func EmergencyGroupAuthority ¶
func EmergencyGroupAuthority(authority string, eg WithEmergencyGroup) (bool, error)
EmergencyGroupAuthority returns true if the authority is EmergencyGroup. Returns false if authority is the x/gov address. Returns error otherwise. Note: we use WithEmergencyGroup rather than emergency group AccAddress to avoid storage read if it's not necessary.
func IntegerMaxDiff ¶
func IntegerMaxDiff[T constraints.Integer](a, b, maxDiff T, note string) error
func IsGovAuthority ¶
IsGovAuthority returns true if the authority is the gov module address. Panics if the gov module address is not set during the package initialization.
func NumberMin ¶ added in v6.6.0
func NumberMin[T constraints.Integer](a, minVal T, note string) error
func NumberPositive ¶ added in v6.6.0
func NumberPositive[T constraints.Integer](a T, note string) error
func PositiveCoins ¶ added in v6.6.0
PositiveCoins checks if all coins are valida and amount is positive.
func Proposal ¶
Proposal checks the format of the description in relation to the authority (x/gov account or other valid account). Authority must be a correct bech32 address.
func Signers ¶
func Signers(signers ...string) []sdk.AccAddress
Signers converts signer bech32 addresses to sdk.AccAddress list. The function ignores errors. It is supposed to be used within Msg.GetSigners implementation.
func ValidateAddr ¶
Types ¶
type WithEmergencyGroup ¶
type WithEmergencyGroup interface {
EmergencyGroup() sdk.AccAddress
}
WithEmergencyGroup is a copy of ugov.WithEmergencyGroup to avoid import cycle