Documentation ¶
Index ¶
- func NewMsgServerImpl(k Keeper) feegrant.MsgServer
- type Keeper
- func (q Keeper) Allowance(ctx context.Context, req *feegrant.QueryAllowanceRequest) (*feegrant.QueryAllowanceResponse, error)
- func (q Keeper) Allowances(c context.Context, req *feegrant.QueryAllowancesRequest) (*feegrant.QueryAllowancesResponse, error)
- func (q Keeper) AllowancesByGranter(c context.Context, req *feegrant.QueryAllowancesByGranterRequest) (*feegrant.QueryAllowancesByGranterResponse, error)
- func (k Keeper) ExportGenesis(ctx context.Context) (*feegrant.GenesisState, error)
- func (k Keeper) GetAllowance(ctx context.Context, granter, grantee sdk.AccAddress) (feegrant.FeeAllowanceI, error)
- func (k Keeper) GrantAllowance(ctx context.Context, granter, grantee sdk.AccAddress, ...) error
- func (k Keeper) InitGenesis(ctx context.Context, data *feegrant.GenesisState) error
- func (k Keeper) IterateAllFeeAllowances(ctx context.Context, cb func(grant feegrant.Grant) bool) error
- func (k Keeper) RemoveExpiredAllowances(ctx context.Context, limit int) error
- func (k Keeper) UpdateAllowance(ctx context.Context, granter, grantee sdk.AccAddress, ...) error
- func (k Keeper) UseGrantedFees(ctx context.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, ...) error
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the feegrant MsgServer interface for the provided Keeper.
Types ¶
type Keeper ¶
type Keeper struct { appmodule.Environment Schema collections.Schema // FeeAllowance key: grantee+granter | value: Grant FeeAllowance collections.Map[collections.Pair[sdk.AccAddress, sdk.AccAddress], feegrant.Grant] // FeeAllowanceQueue key: expiration time+grantee+granter | value: bool FeeAllowanceQueue collections.Map[collections.Triple[time.Time, sdk.AccAddress, sdk.AccAddress], bool] // contains filtered or unexported fields }
Keeper manages state of all fee grants, as well as calculating approval. It must have a codec with all available allowances registered.
func NewKeeper ¶
func NewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, addrCdc address.Codec) Keeper
NewKeeper creates a feegrant Keeper
func (Keeper) Allowance ¶
func (q Keeper) Allowance(ctx context.Context, req *feegrant.QueryAllowanceRequest) (*feegrant.QueryAllowanceResponse, error)
Allowance returns granted allowance to the grantee by the granter.
func (Keeper) Allowances ¶
func (q Keeper) Allowances(c context.Context, req *feegrant.QueryAllowancesRequest) (*feegrant.QueryAllowancesResponse, error)
Allowances queries all the allowances granted to the given grantee.
func (Keeper) AllowancesByGranter ¶
func (q Keeper) AllowancesByGranter(c context.Context, req *feegrant.QueryAllowancesByGranterRequest) (*feegrant.QueryAllowancesByGranterResponse, error)
AllowancesByGranter queries all the allowances granted by the given granter
func (Keeper) ExportGenesis ¶
ExportGenesis will dump the contents of the keeper into a serializable GenesisState.
func (Keeper) GetAllowance ¶
func (k Keeper) GetAllowance(ctx context.Context, granter, grantee sdk.AccAddress) (feegrant.FeeAllowanceI, error)
GetAllowance returns the allowance between the granter and grantee. If there is none, it returns nil, collections.ErrNotFound. Returns an error on parsing issues
func (Keeper) GrantAllowance ¶
func (k Keeper) GrantAllowance(ctx context.Context, granter, grantee sdk.AccAddress, feeAllowance feegrant.FeeAllowanceI) error
GrantAllowance creates a new grant
func (Keeper) InitGenesis ¶
InitGenesis will initialize the keeper from a *previously validated* GenesisState
func (Keeper) IterateAllFeeAllowances ¶
func (k Keeper) IterateAllFeeAllowances(ctx context.Context, cb func(grant feegrant.Grant) bool) error
IterateAllFeeAllowances iterates over all the grants in the store. Callback to get all data, returns true to stop, false to keep reading Calling this without pagination is very expensive and only designed for export genesis
func (Keeper) RemoveExpiredAllowances ¶
RemoveExpiredAllowances iterates grantsByExpiryQueue and deletes the expired grants.
func (Keeper) UpdateAllowance ¶
func (k Keeper) UpdateAllowance(ctx context.Context, granter, grantee sdk.AccAddress, feeAllowance feegrant.FeeAllowanceI) error
UpdateAllowance updates the existing grant.