keeper

package
v22.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StoreKeyContracts    = []byte("contracts")
	StoreKeyContractUses = []byte("contract-uses")
)

Functions

This section is empty.

Types

type Keeper

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

Keeper of this module maintains collections of feeshares for contracts registered to receive transaction fees.

func NewKeeper

func NewKeeper(
	storeKey storetypes.StoreKey,
	cdc codec.BinaryCodec,
	bk bankkeeper.Keeper,
	wk wasmkeeper.Keeper,
	ak feesharetypes.AccountKeeper,
	bondDenom string,
	authority string,
) Keeper

NewKeeper creates new instances of the fees Keeper

func (Keeper) CanContractCoverFee

func (k Keeper) CanContractCoverFee(fpc *types.FeePayContract, fee uint64) bool

Check if a fee pay contract has a balance greater than or equal to the fee

func (Keeper) FundContract

func (k Keeper) FundContract(ctx sdk.Context, fpc *types.FeePayContract, senderAddr sdk.AccAddress, coins sdk.Coins) error

Fund an existing fee pay contract

func (Keeper) FundFeePayContract

FundFeePayContract funds a contract with the given amount of tokens.

func (Keeper) GetAllContracts

func (k Keeper) GetAllContracts(ctx sdk.Context) []types.FeePayContract

GetAllContracts returns all the registered FeePay contracts.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/feeshare module's authority.

func (Keeper) GetContract

func (k Keeper) GetContract(ctx sdk.Context, contractAddress string) (*types.FeePayContract, error)

Get a contract from KV store

func (Keeper) GetContractUses

func (k Keeper) GetContractUses(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string) (uint64, error)

Get the number of times a wallet has interacted with a fee pay contract (err only if contract not registered)

func (Keeper) GetContracts

Get all registered fee pay contracts

func (Keeper) GetParams

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

Get the parameters for the fee pay module.

func (Keeper) HasWalletExceededUsageLimit

func (k Keeper) HasWalletExceededUsageLimit(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string) bool

Check if a wallet exceeded usage limit (defaults to true if contract not registered)

func (Keeper) IncrementContractUses

func (k Keeper) IncrementContractUses(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string, increment uint64) error

Set the number of times a wallet has interacted with a fee pay contract

func (Keeper) IsContractManager

func (k Keeper) IsContractManager(senderAddress string, contractInfo *wasmtypes.ContractInfo) (bool, error)

Check if the sender is the designated contract manager for the FeePay contract. If an admin is present, they are considered the manager. If there is no admin, the contract creator is considered the manager.

func (Keeper) IsContractRegistered

func (k Keeper) IsContractRegistered(ctx sdk.Context, contractAddr string) bool

Check if a contract is registered as a fee pay contract

func (Keeper) IsWalletEligible

func (k Keeper) IsWalletEligible(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string) (bool, error)

Check if a wallet is eligible to interact with a contract

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) RegisterContract

func (k Keeper) RegisterContract(ctx sdk.Context, rfp *types.MsgRegisterFeePayContract) error

Register the contract in the module store

func (Keeper) RegisterFeePayContract

Register a new fee pay contract.

func (Keeper) SetContractBalance

func (k Keeper) SetContractBalance(ctx sdk.Context, fpc *types.FeePayContract, newBalance uint64)

Set the contract balance in the KV store

func (Keeper) SetFeePayContract

func (k Keeper) SetFeePayContract(ctx sdk.Context, feepay types.FeePayContract)

Set a contract in the KV Store

func (Keeper) SetParams

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

Set the params for the fee pay module.

func (Keeper) UnregisterContract

func (k Keeper) UnregisterContract(ctx sdk.Context, rfp *types.MsgUnregisterFeePayContract) error

Unregister contract (loop through usage store & remove all usage entries for contract)

func (Keeper) UpdateContractWalletLimit

func (k Keeper) UpdateContractWalletLimit(ctx sdk.Context, fpc *types.FeePayContract, senderAddress string, walletLimit uint64) error

Update the wallet limit of an existing fee pay contract

func (Keeper) UpdateFeePayContractWalletLimit

Update the wallet limit of a fee pay contract.

func (Keeper) UpdateParams

UpdateParams updates the parameters of the module.

type Querier

type Querier struct {
	Keeper
}

Querier defines a wrapper around the x/feepay keeper providing gRPC method handlers.

func NewQuerier

func NewQuerier(k Keeper) Querier

func (Querier) FeePayContract

FeePayContract implements types.QueryServer.

func (Querier) FeePayContractUses

FeePayContractUses implements types.QueryServer.

func (Querier) FeePayContracts

FeePayContracts implements types.QueryServer.

func (Querier) FeePayWalletIsEligible

FeePayContractEligible implements types.QueryServer.

func (Querier) Params

Params returns the feepay module params

Jump to

Keyboard shortcuts

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