keeper

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the bonds module.

func ModuleAccountInvariant

func ModuleAccountInvariant(k Keeper) sdk.Invariant

ModuleAccountInvariant checks that the 'bond' module account balance is non-negative.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the bond MsgServer interface for the provided Keeper.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all bond invariants

Types

type BondID

type BondID struct {
	Address  sdk.Address
	AccNum   uint64
	Sequence uint64
}

BondID simplifies generation of bond IDs.

func (BondID) Generate

func (bondID BondID) Generate() string

Generate creates the bond ID.

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec,
	accountKeeper auth.AccountKeeper,
	bankKeeper bank.Keeper,
	usageKeepers []types.BondUsageKeeper,
	storeKey storetypes.StoreKey,
	ps paramtypes.Subspace,
) Keeper

NewKeeper creates new instances of the bond Keeper

func (Keeper) CancelBond

func (k Keeper) CancelBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddress) (*types.Bond, error)

CancelBond cancels a bond, returning funds to the owner.

func (Keeper) CreateBond

func (k Keeper) CreateBond(ctx sdk.Context, ownerAddress sdk.AccAddress, coins sdk.Coins) (*types.Bond, error)

CreateBond creates a new bond.

func (Keeper) DeleteBond

func (k Keeper) DeleteBond(ctx sdk.Context, bond types.Bond)

DeleteBond - deletes the bond.

func (Keeper) GetBond

func (k Keeper) GetBond(ctx sdk.Context, id string) types.Bond

GetBond - gets a record from the store.

func (Keeper) GetBondModuleBalances

func (k Keeper) GetBondModuleBalances(ctx sdk.Context) sdk.Coins

GetBondModuleBalances gets the bond module account(s) balances.

func (Keeper) GetMaxBondAmount

func (k Keeper) GetMaxBondAmount(ctx sdk.Context) (res sdk.Coin)

GetMaxBondAmount max bond amount

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams - Get all parameter as types.Params.

func (Keeper) HasBond

func (k Keeper) HasBond(ctx sdk.Context, id string) bool

HasBond - checks if a bond by the given ID exists.

func (Keeper) ListBonds

func (k Keeper) ListBonds(ctx sdk.Context) []*types.Bond

ListBonds - get all bonds.

func (Keeper) MatchBonds

func (k Keeper) MatchBonds(ctx sdk.Context, matchFn func(*types.Bond) bool) []*types.Bond

MatchBonds - get all matching bonds.

func (Keeper) QueryBondsByOwner

func (k Keeper) QueryBondsByOwner(ctx sdk.Context, ownerAddress string) []types.Bond

QueryBondsByOwner - query bonds by owner.

func (Keeper) RefillBond

func (k Keeper) RefillBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddress, coins sdk.Coins) (*types.Bond, error)

RefillBond refills an existing bond.

func (Keeper) SaveBond

func (k Keeper) SaveBond(ctx sdk.Context, bond *types.Bond)

SaveBond - saves a bond to the store.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams - set the params.

func (Keeper) TransferCoinsToModuleAccount

func (k Keeper) TransferCoinsToModuleAccount(ctx sdk.Context, id, moduleAccount string, coins sdk.Coins) error

TransferCoinsToModuleAccount moves funds from the bonds module account to another module account.

func (Keeper) WithdrawBond

func (k Keeper) WithdrawBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddress, coins sdk.Coins) (*types.Bond, error)

WithdrawBond withdraws funds from a bond.

Jump to

Keyboard shortcuts

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