keeper

package
v0.0.0-...-c736a29 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListBonds       = "list"
	GetBond         = "get"
	QueryByOwner    = "query-by-owner"
	QueryParameters = "parameters"
	Balance         = "balance"
)

query endpoints supported by the bond Querier

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 NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all bond module invariants.

Types

type BondClientKeeper

type BondClientKeeper interface {
	HasBond(ctx sdk.Context, id types.ID) bool
	GetBond(ctx sdk.Context, id types.ID) types.Bond
	MatchBonds(ctx sdk.Context, matchFn func(*types.Bond) bool) []*types.Bond
	TransferCoinsToModuleAccount(ctx sdk.Context, id types.ID, moduleAccount string, coins sdk.Coins) error
	TranserCoinsToAccount(ctx sdk.Context, id types.ID, account sdk.AccAddress, coins sdk.Coins) error
}

BondClientKeeper is the subset of functionality exposed to other modules.

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(accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, supplyKeeper supply.Keeper,
	usageKeepers []types.BondUsageKeeper, storeKey sdk.StoreKey, cdc *codec.Codec, paramstore params.Subspace) Keeper

NewKeeper creates new instances of the bond Keeper

func (Keeper) CancelBond

func (k Keeper) CancelBond(ctx sdk.Context, id types.ID, 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 types.ID) types.Bond

GetBond - gets a record from the store.

func (Keeper) GetBondModuleBalances

func (k Keeper) GetBondModuleBalances(ctx sdk.Context) map[string]sdk.Coins

GetBondModuleBalances gets the bond module account(s) balances.

func (Keeper) GetParams

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

GetParams - Get all parameteras as types.Params.

func (Keeper) HasBond

func (k Keeper) HasBond(ctx sdk.Context, id types.ID) 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 types.ID, 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) TranserCoinsToAccount

func (k Keeper) TranserCoinsToAccount(ctx sdk.Context, id types.ID, account sdk.AccAddress, coins sdk.Coins) error

TranserCoinsToAccount moves coins from the bond to an account.

func (Keeper) TransferCoinsToModuleAccount

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

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

func (Keeper) WithdrawBond

func (k Keeper) WithdrawBond(ctx sdk.Context, id types.ID, 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