Documentation ¶
Index ¶
- Variables
- func CreateHoldCoinKey(addr sdk.AccAddress, denom string) []byte
- func CreateHoldCoinKeyAddrPrefix(addr sdk.AccAddress) []byte
- func HoldAccountBalancesInvariant(keeper Keeper) sdk.Invariant
- func ParseHoldCoinKey(key []byte) (sdk.AccAddress, string)
- func ParseHoldCoinKeyUnprefixed(key []byte) (sdk.AccAddress, string)
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
- func UnmarshalHoldCoinValue(value []byte) (sdkmath.Int, error)
- type Keeper
- func (k Keeper) AddHold(ctx sdk.Context, addr sdk.AccAddress, funds sdk.Coins, reason string) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *hold.GenesisState
- func (k Keeper) GetAllAccountHolds(ctx sdk.Context) ([]*hold.AccountHold, error)
- func (k Keeper) GetAllHolds(goCtx context.Context, req *hold.GetAllHoldsRequest) (*hold.GetAllHoldsResponse, error)
- func (k Keeper) GetHoldCoin(ctx sdk.Context, addr sdk.AccAddress, denom string) (sdk.Coin, error)
- func (k Keeper) GetHoldCoins(ctx sdk.Context, addr sdk.AccAddress) (sdk.Coins, error)
- func (k Keeper) GetHolds(goCtx context.Context, req *hold.GetHoldsRequest) (*hold.GetHoldsResponse, error)
- func (k Keeper) GetLockedCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins
- func (k Keeper) InitGenesis(origCtx sdk.Context, genState *hold.GenesisState)
- func (k Keeper) IterateAllHolds(ctx sdk.Context, process func(sdk.AccAddress, sdk.Coin) bool) error
- func (k Keeper) IterateHolds(ctx sdk.Context, addr sdk.AccAddress, process func(sdk.Coin) bool) error
- func (k Keeper) ReleaseHold(ctx sdk.Context, addr sdk.AccAddress, funds sdk.Coins) error
- func (k Keeper) ValidateNewHold(ctx sdk.Context, addr sdk.AccAddress, funds sdk.Coins) error
Constants ¶
This section is empty.
Variables ¶
var ( // KeyPrefixHoldCoin is the prefix of a hold entry for an address and single denom. KeyPrefixHoldCoin = []byte{0x00} )
Keys for store prefixes. Items are stored with the following keys:
Coin on hold: - 0x00<addr len (1 byte)><addr><denom> -> <amount>
Functions ¶
func CreateHoldCoinKey ¶
func CreateHoldCoinKey(addr sdk.AccAddress, denom string) []byte
CreateHoldCoinKey creates a hold coin key for the provided address and denom.
func CreateHoldCoinKeyAddrPrefix ¶
func CreateHoldCoinKeyAddrPrefix(addr sdk.AccAddress) []byte
CreateHoldCoinKeyAddrPrefix creates a hold coin key prefix containing the provided address. It's useful for iterating over all funds on hold for an address.
func HoldAccountBalancesInvariant ¶
HoldAccountBalancesInvariant checks that all funds on hold are also otherwise unlocked in the account.
func ParseHoldCoinKey ¶
func ParseHoldCoinKey(key []byte) (sdk.AccAddress, string)
ParseHoldCoinKey parses a full hold coin key into its address and denom.
func ParseHoldCoinKeyUnprefixed ¶
func ParseHoldCoinKeyUnprefixed(key []byte) (sdk.AccAddress, string)
ParseHoldCoinKeyUnprefixed parses a hold coin key without the type prefix into its address and denom.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
RegisterInvariants registers all quarantine invariants.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, bankKeeper hold.BankKeeper) Keeper
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *hold.GenesisState
ExportGenesis creates a GenesisState from the current state store.
func (Keeper) GetAllAccountHolds ¶
GetAllAccountHolds gets all the AccountHold entries currently in the state store.
func (Keeper) GetAllHolds ¶
func (k Keeper) GetAllHolds(goCtx context.Context, req *hold.GetAllHoldsRequest) (*hold.GetAllHoldsResponse, error)
GetAllHolds returns all addresses with funds on hold, and the amount held.
func (Keeper) GetHoldCoin ¶
GetHoldCoin gets the amount of a denom on hold for a given account. Will return a zero Coin of the given denom if the store does not have an entry for it.
func (Keeper) GetHoldCoins ¶
GetHoldCoins gets all funds on hold for a given account.
func (Keeper) GetHolds ¶
func (k Keeper) GetHolds(goCtx context.Context, req *hold.GetHoldsRequest) (*hold.GetHoldsResponse, error)
GetHolds looks up the funds that are on hold for an address.
func (Keeper) GetLockedCoins ¶
GetLockedCoins gets all the coins that are on hold for the given address.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(origCtx sdk.Context, genState *hold.GenesisState)
InitGenesis loads the provided GenesisState into the state store. Panics if there's an error.
func (Keeper) IterateAllHolds ¶
IterateAllHolds iterates over all hold coin entries for all accounts. The process function should return whether to stop: false = keep iterating, true = stop. If an error is encountered while reading from the store, that entry is skipped and an error is returned for it when iteration is completed.
func (Keeper) IterateHolds ¶
func (k Keeper) IterateHolds(ctx sdk.Context, addr sdk.AccAddress, process func(sdk.Coin) bool) error
IterateHolds iterates over all funds on hold for a given account. The process function should return whether to stop: false = keep iterating, true = stop. If an error is encountered while reading from the store, that entry is skipped and an error is returned for it when iteration is completed.
func (Keeper) ReleaseHold ¶
ReleaseHold releases the hold on the provided funds for the provided account.
func (Keeper) ValidateNewHold ¶
ValidateNewHold checks the account's spendable balance to make sure it has at least as much as the funds provided.