feegrant

package
v0.47.4 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

README


sidebar_position: 1

x/feegrant

Abstract

This document specifies the fee grant module. For the full ADR, please see Fee Grant ADR-029.

This module allows accounts to grant fee allowances and to use fees from their accounts. Grantees can execute any transaction without the need to maintain sufficient fees.

Contents

Concepts

Grant

Grant is stored in the KVStore to record a grant with full context. Every grant will contain granter, grantee and what kind of allowance is granted. granter is an account address who is giving permission to grantee (the beneficiary account address) to pay for some or all of grantee's transaction fees. allowance defines what kind of fee allowance (BasicAllowance or PeriodicAllowance, see below) is granted to grantee. allowance accepts an interface which implements FeeAllowanceI, encoded as Any type. There can be only one existing fee grant allowed for a grantee and granter, self grants are not allowed.

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L83-L93

FeeAllowanceI looks like:

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/feegrant/fees.go#L9-L32

Fee Allowance types

There are two types of fee allowances present at the moment:

  • BasicAllowance
  • PeriodicAllowance
  • AllowedMsgAllowance

BasicAllowance

BasicAllowance is permission for grantee to use fee from a granter's account. If any of the spend_limit or expiration reaches its limit, the grant will be removed from the state.

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L15-L28
  • spend_limit is the limit of coins that are allowed to be used from the granter account. If it is empty, it assumes there's no spend limit, grantee can use any number of available coins from granter account address before the expiration.

  • expiration specifies an optional time when this allowance expires. If the value is left empty, there is no expiry for the grant.

  • When a grant is created with empty values for spend_limit and expiration, it is still a valid grant. It won't restrict the grantee to use any number of coins from granter and it won't have any expiration. The only way to restrict the grantee is by revoking the grant.

PeriodicAllowance

PeriodicAllowance is a repeating fee allowance for the mentioned period, we can mention when the grant can expire as well as when a period can reset. We can also define the maximum number of coins that can be used in a mentioned period of time.

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L34-L68
  • basic is the instance of BasicAllowance which is optional for periodic fee allowance. If empty, the grant will have no expiration and no spend_limit.

  • period is the specific period of time, after each period passes, period_can_spend will be reset.

  • period_spend_limit specifies the maximum number of coins that can be spent in the period.

  • period_can_spend is the number of coins left to be spent before the period_reset time.

  • period_reset keeps track of when a next period reset should happen.

AllowedMsgAllowance

AllowedMsgAllowance is a fee allowance, it can be any of BasicFeeAllowance, PeriodicAllowance but restricted only to the allowed messages mentioned by the granter.

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L70-L81
  • allowance is either BasicAllowance or PeriodicAllowance.

  • allowed_messages is array of messages allowed to execute the given allowance.

FeeGranter flag

feegrant module introduces a FeeGranter flag for CLI for the sake of executing transactions with fee granter. When this flag is set, clientCtx will append the granter account address for transactions generated through CLI.

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/client/cmd.go#L249-L260
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/client/tx/tx.go#L109-L109
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/auth/tx/builder.go#L275-L284
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/tx/v1beta1/tx.proto#L203-L224

Example cmd:

./simd tx gov submit-proposal --title="Test Proposal" --description="My awesome proposal" --type="Text" --from validator-key --fee-granter=cosmos1xh44hxt7spr67hqaa7nyx5gnutrz5fraw6grxn --chain-id=testnet --fees="10stake"

Granted Fee Deductions

Fees are deducted from grants in the x/auth ante handler. To learn more about how ante handlers work, read the Auth Module AnteHandlers Guide.

Gas

In order to prevent DoS attacks, using a filtered x/feegrant incurs gas. The SDK must assure that the grantee's transactions all conform to the filter set by the granter. The SDK does this by iterating over the allowed messages in the filter and charging 10 gas per filtered message. The SDK will then iterate over the messages being sent by the grantee to ensure the messages adhere to the filter, also charging 10 gas per message. The SDK will stop iterating and fail the transaction if it finds a message that does not conform to the filter.

WARNING: The gas is charged against the granted allowance. Ensure your messages conform to the filter, if any, before sending transactions using your allowance.

Pruning

A queue in the state maintained with the prefix of expiration of the grants and checks them on EndBlock with the current block time for every block to prune.

State

FeeAllowance

Fee Allowances are identified by combining Grantee (the account address of fee allowance grantee) with the Granter (the account address of fee allowance granter).

Fee allowance grants are stored in the state as follows:

  • Grant: 0x00 | grantee_addr_len (1 byte) | grantee_addr_bytes | granter_addr_len (1 byte) | granter_addr_bytes -> ProtocolBuffer(Grant)
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/feegrant/feegrant.pb.go#L222-L230

FeeAllowanceQueue

Fee Allowances queue items are identified by combining the FeeAllowancePrefixQueue (i.e., 0x01), expiration, grantee (the account address of fee allowance grantee), granter (the account address of fee allowance granter). Endblocker checks FeeAllowanceQueue state for the expired grants and prunes them from FeeAllowance if there are any found.

Fee allowance queue keys are stored in the state as follows:

  • Grant: 0x01 | expiration_bytes | grantee_addr_len (1 byte) | grantee_addr_bytes | granter_addr_len (1 byte) | granter_addr_bytes -> EmptyBytes

Messages

Msg/GrantAllowance

A fee allowance grant will be created with the MsgGrantAllowance message.

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/tx.proto#L25-L39

Msg/RevokeAllowance

An allowed grant fee allowance can be removed with the MsgRevokeAllowance message.

https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/tx.proto#L41-L54

Events

The feegrant module emits the following events:

Msg Server

MsgGrantAllowance

Type Attribute Key Attribute Value
message action set_feegrant
message granter {granterAddress}
message grantee {granteeAddress}

MsgRevokeAllowance

Type Attribute Key Attribute Value
message action revoke_feegrant
message granter {granterAddress}
message grantee {granteeAddress}

Exec fee allowance

Type Attribute Key Attribute Value
message action use_feegrant
message granter {granterAddress}
message grantee {granteeAddress}

Client

CLI

A user can query and interact with the feegrant module using the CLI.

Query

The query commands allow users to query feegrant state.

simd query feegrant --help
grant

The grant command allows users to query a grant for a given granter-grantee pair.

simd query feegrant grant [granter] [grantee] [flags]

Example:

simd query feegrant grant cosmos1.. cosmos1..

Example Output:

allowance:
  '@type': /cosmos.feegrant.v1beta1.BasicAllowance
  expiration: null
  spend_limit:
  - amount: "100"
    denom: stake
grantee: cosmos1..
granter: cosmos1..
grants

The grants command allows users to query all grants for a given grantee.

simd query feegrant grants [grantee] [flags]

Example:

simd query feegrant grants cosmos1..

Example Output:

allowances:
- allowance:
    '@type': /cosmos.feegrant.v1beta1.BasicAllowance
    expiration: null
    spend_limit:
    - amount: "100"
      denom: stake
  grantee: cosmos1..
  granter: cosmos1..
pagination:
  next_key: null
  total: "0"
Transactions

The tx commands allow users to interact with the feegrant module.

simd tx feegrant --help
grant

The grant command allows users to grant fee allowances to another account. The fee allowance can have an expiration date, a total spend limit, and/or a periodic spend limit.

simd tx feegrant grant [granter] [grantee] [flags]

Example (one-time spend limit):

simd tx feegrant grant cosmos1.. cosmos1.. --spend-limit 100stake

Example (periodic spend limit):

simd tx feegrant grant cosmos1.. cosmos1.. --period 3600 --period-limit 10stake
revoke

The revoke command allows users to revoke a granted fee allowance.

simd tx feegrant revoke [granter] [grantee] [flags]

Example:

simd tx feegrant revoke cosmos1.. cosmos1..

gRPC

A user can query the feegrant module using gRPC endpoints.

Allowance

The Allowance endpoint allows users to query a granted fee allowance.

cosmos.feegrant.v1beta1.Query/Allowance

Example:

grpcurl -plaintext \
    -d '{"grantee":"cosmos1..","granter":"cosmos1.."}' \
    localhost:9090 \
    cosmos.feegrant.v1beta1.Query/Allowance

Example Output:

{
  "allowance": {
    "granter": "cosmos1..",
    "grantee": "cosmos1..",
    "allowance": {"@type":"/cosmos.feegrant.v1beta1.BasicAllowance","spendLimit":[{"denom":"stake","amount":"100"}]}
  }
}
Allowances

The Allowances endpoint allows users to query all granted fee allowances for a given grantee.

cosmos.feegrant.v1beta1.Query/Allowances

Example:

grpcurl -plaintext \
    -d '{"address":"cosmos1.."}' \
    localhost:9090 \
    cosmos.feegrant.v1beta1.Query/Allowances

Example Output:

{
  "allowances": [
    {
      "granter": "cosmos1..",
      "grantee": "cosmos1..",
      "allowance": {"@type":"/cosmos.feegrant.v1beta1.BasicAllowance","spendLimit":[{"denom":"stake","amount":"100"}]}
    }
  ],
  "pagination": {
    "total": "1"
  }
}

Documentation

Overview

Package feegrant provides functionality for authorizing the payment of transaction fees from one account (key) to another account (key).

Effectively, this allows for a user to pay fees using the balance of an account different from their own. Example use cases would be allowing a key on a device to pay for fees using a master wallet, or a third party service allowing users to pay for transactions without ever really holding their own coins. This package provides ways for specifying fee allowances such that authorizing fee payment to another account can be done with clear and safe restrictions.

A user would authorize granting fee payment to another user using MsgGrantAllowance and revoke that delegation using MsgRevokeAllowance. In both cases, Granter is the one who is authorizing fee payment and Grantee is the one who is receiving the fee payment authorization. So grantee would correspond to the one who is signing a transaction and the granter would be the address that pays the fees.

The fee allowance that a grantee receives is specified by an implementation of the FeeAllowance interface. Two FeeAllowance implementations are provided in this package: BasicAllowance and PeriodicAllowance.

Package feegrant is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EventTypeUseFeeGrant    = "use_feegrant"
	EventTypeRevokeFeeGrant = "revoke_feegrant"
	EventTypeSetFeeGrant    = "set_feegrant"
	EventTypeUpdateFeeGrant = "update_feegrant"

	AttributeKeyGranter = "granter"
	AttributeKeyGrantee = "grantee"
)

evidence module events

View Source
const (
	// ModuleName is the module name constant used in many places
	ModuleName = "feegrant"

	// StoreKey is the store key string for supply
	StoreKey = ModuleName

	// RouterKey is the message route for supply
	RouterKey = ModuleName

	// QuerierRoute is the querier route for supply
	QuerierRoute = ModuleName
)
View Source
const (
	DefaultCodespace = ModuleName
)

Codes for governance errors

Variables

View Source
var (
	// ErrFeeLimitExceeded error if there are not enough allowance to cover the fees
	ErrFeeLimitExceeded = sdkerrors.Register(DefaultCodespace, 2, "fee limit exceeded")
	// ErrFeeLimitExpired error if the allowance has expired
	ErrFeeLimitExpired = sdkerrors.Register(DefaultCodespace, 3, "fee allowance expired")
	// ErrInvalidDuration error if the Duration is invalid or doesn't match the expiration
	ErrInvalidDuration = sdkerrors.Register(DefaultCodespace, 4, "invalid duration")
	// ErrNoAllowance error if there is no allowance for that pair
	ErrNoAllowance = sdkerrors.Register(DefaultCodespace, 5, "no allowance")
	// ErrNoMessages error if there is no message
	ErrNoMessages = sdkerrors.Register(DefaultCodespace, 6, "allowed messages are empty")
	// ErrMessageNotAllowed error if message is not allowed
	ErrMessageNotAllowed = sdkerrors.Register(DefaultCodespace, 7, "message not allowed")
)
View Source
var (
	ErrInvalidLengthFeegrant        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowFeegrant          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupFeegrant = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// FeeAllowanceKeyPrefix is the set of the kvstore for fee allowance data
	// - 0x00<allowance_key_bytes>: allowance
	FeeAllowanceKeyPrefix = []byte{0x00}

	// FeeAllowanceQueueKeyPrefix is the set of the kvstore for fee allowance keys data
	// - 0x01<allowance_prefix_queue_key_bytes>: <empty value>
	FeeAllowanceQueueKeyPrefix = []byte{0x01}
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (

	// ModuleCdc references the global x/feegrant module codec. Note, the codec should
	// ONLY be used in certain instances of tests and for JSON encoding as Amino is
	// still used for that purpose.
	//
	// The actual codec used for serialization should be provided to x/feegrant and
	// defined at the application level.
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func AllowanceByExpTimeKey added in v0.46.0

func AllowanceByExpTimeKey(exp *time.Time) []byte

AllowanceByExpTimeKey returns a key with `FeeAllowanceQueueKeyPrefix`, expiry

Key format: - <0x01><exp_bytes>

func FeeAllowanceKey

func FeeAllowanceKey(granter sdk.AccAddress, grantee sdk.AccAddress) []byte

FeeAllowanceKey is the canonical key to store a grant from granter to grantee We store by grantee first to allow searching by everyone who granted to you

Key format: - <0x00><len(grantee_address_bytes)><grantee_address_bytes><len(granter_address_bytes)><granter_address_bytes>

func FeeAllowancePrefixByGrantee

func FeeAllowancePrefixByGrantee(grantee sdk.AccAddress) []byte

FeeAllowancePrefixByGrantee returns a prefix to scan for all grants to this given address.

Key format: - <0x00><len(grantee_address_bytes)><grantee_address_bytes>

func FeeAllowancePrefixQueue added in v0.46.0

func FeeAllowancePrefixQueue(exp *time.Time, key []byte) []byte

FeeAllowancePrefixQueue is the canonical key to store grant key.

Key format: - <0x01><exp_bytes><len(grantee_address_bytes)><grantee_address_bytes><len(granter_address_bytes)><granter_address_bytes>

func ParseAddressesFromFeeAllowanceKey added in v0.45.5

func ParseAddressesFromFeeAllowanceKey(key []byte) (granter, grantee sdk.AccAddress)

ParseAddressesFromFeeAllowanceKey extracts and returns the granter, grantee from the given key.

func ParseAddressesFromFeeAllowanceQueueKey added in v0.46.0

func ParseAddressesFromFeeAllowanceQueueKey(key []byte) (granter, grantee sdk.AccAddress)

ParseAddressesFromFeeAllowanceQueueKey extracts and returns the granter, grantee from the given key.

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

RegisterInterfaces registers the interfaces types with the interface registry

func RegisterLegacyAminoCodec added in v0.46.0

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the necessary x/feegrant interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis ensures all grants in the genesis state are valid

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAddress(moduleName string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, moduleName string) auth.ModuleAccountI

	NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) auth.AccountI
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) auth.AccountI
	SetAccount(ctx sdk.Context, acc auth.AccountI)
}

AccountKeeper defines the expected auth Account Keeper (noalias)

type AllowedMsgAllowance

type AllowedMsgAllowance struct {
	// allowance can be any of basic and periodic fee allowance.
	Allowance *types1.Any `protobuf:"bytes,1,opt,name=allowance,proto3" json:"allowance,omitempty"`
	// allowed_messages are the messages for which the grantee has the access.
	AllowedMessages []string `protobuf:"bytes,2,rep,name=allowed_messages,json=allowedMessages,proto3" json:"allowed_messages,omitempty"`
}

AllowedMsgAllowance creates allowance only for specified message types.

func NewAllowedMsgAllowance

func NewAllowedMsgAllowance(allowance FeeAllowanceI, allowedMsgs []string) (*AllowedMsgAllowance, error)

NewAllowedMsgFeeAllowance creates new filtered fee allowance.

func (*AllowedMsgAllowance) Accept

func (a *AllowedMsgAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (bool, error)

Accept method checks for the filtered messages has valid expiry

func (*AllowedMsgAllowance) Descriptor

func (*AllowedMsgAllowance) Descriptor() ([]byte, []int)

func (*AllowedMsgAllowance) ExpiresAt added in v0.46.0

func (a *AllowedMsgAllowance) ExpiresAt() (*time.Time, error)

func (*AllowedMsgAllowance) GetAllowance

func (a *AllowedMsgAllowance) GetAllowance() (FeeAllowanceI, error)

GetAllowance returns allowed fee allowance.

func (*AllowedMsgAllowance) Marshal

func (m *AllowedMsgAllowance) Marshal() (dAtA []byte, err error)

func (*AllowedMsgAllowance) MarshalTo

func (m *AllowedMsgAllowance) MarshalTo(dAtA []byte) (int, error)

func (*AllowedMsgAllowance) MarshalToSizedBuffer

func (m *AllowedMsgAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AllowedMsgAllowance) ProtoMessage

func (*AllowedMsgAllowance) ProtoMessage()

func (*AllowedMsgAllowance) Reset

func (m *AllowedMsgAllowance) Reset()

func (*AllowedMsgAllowance) SetAllowance added in v0.46.0

func (a *AllowedMsgAllowance) SetAllowance(allowance FeeAllowanceI) error

SetAllowance sets allowed fee allowance.

func (*AllowedMsgAllowance) Size

func (m *AllowedMsgAllowance) Size() (n int)

func (*AllowedMsgAllowance) String

func (m *AllowedMsgAllowance) String() string

func (*AllowedMsgAllowance) Unmarshal

func (m *AllowedMsgAllowance) Unmarshal(dAtA []byte) error

func (*AllowedMsgAllowance) UnpackInterfaces

func (a *AllowedMsgAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (*AllowedMsgAllowance) ValidateBasic

func (a *AllowedMsgAllowance) ValidateBasic() error

ValidateBasic implements FeeAllowance and enforces basic sanity checks

func (*AllowedMsgAllowance) XXX_DiscardUnknown

func (m *AllowedMsgAllowance) XXX_DiscardUnknown()

func (*AllowedMsgAllowance) XXX_Marshal

func (m *AllowedMsgAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AllowedMsgAllowance) XXX_Merge

func (m *AllowedMsgAllowance) XXX_Merge(src proto.Message)

func (*AllowedMsgAllowance) XXX_Size

func (m *AllowedMsgAllowance) XXX_Size() int

func (*AllowedMsgAllowance) XXX_Unmarshal

func (m *AllowedMsgAllowance) XXX_Unmarshal(b []byte) error

type BankKeeper

type BankKeeper interface {
	SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}

BankKeeper defines the expected supply Keeper (noalias)

type BasicAllowance

type BasicAllowance struct {
	// spend_limit specifies the maximum amount of coins that can be spent
	// by this allowance and will be updated as coins are spent. If it is
	// empty, there is no spend limit and any amount of coins can be spent.
	SpendLimit github_com_cosmos_cosmos_sdk_types.Coins `` /* 135-byte string literal not displayed */
	// expiration specifies an optional time when this allowance expires
	Expiration *time.Time `protobuf:"bytes,2,opt,name=expiration,proto3,stdtime" json:"expiration,omitempty"`
}

BasicAllowance implements Allowance with a one-time grant of coins that optionally expires. The grantee can use up to SpendLimit to cover fees.

func (*BasicAllowance) Accept

func (a *BasicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error)

Accept can use fee payment requested as well as timestamp of the current block to determine whether or not to process this. This is checked in Keeper.UseGrantedFees and the return values should match how it is handled there.

If it returns an error, the fee payment is rejected, otherwise it is accepted. The FeeAllowance implementation is expected to update it's internal state and will be saved again after an acceptance.

If remove is true (regardless of the error), the FeeAllowance will be deleted from storage (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees)

func (*BasicAllowance) Descriptor

func (*BasicAllowance) Descriptor() ([]byte, []int)

func (BasicAllowance) ExpiresAt added in v0.46.0

func (a BasicAllowance) ExpiresAt() (*time.Time, error)

func (*BasicAllowance) GetExpiration

func (m *BasicAllowance) GetExpiration() *time.Time

func (*BasicAllowance) GetSpendLimit

func (*BasicAllowance) Marshal

func (m *BasicAllowance) Marshal() (dAtA []byte, err error)

func (*BasicAllowance) MarshalTo

func (m *BasicAllowance) MarshalTo(dAtA []byte) (int, error)

func (*BasicAllowance) MarshalToSizedBuffer

func (m *BasicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BasicAllowance) ProtoMessage

func (*BasicAllowance) ProtoMessage()

func (*BasicAllowance) Reset

func (m *BasicAllowance) Reset()

func (*BasicAllowance) Size

func (m *BasicAllowance) Size() (n int)

func (*BasicAllowance) String

func (m *BasicAllowance) String() string

func (*BasicAllowance) Unmarshal

func (m *BasicAllowance) Unmarshal(dAtA []byte) error

func (BasicAllowance) ValidateBasic

func (a BasicAllowance) ValidateBasic() error

ValidateBasic implements FeeAllowance and enforces basic sanity checks

func (*BasicAllowance) XXX_DiscardUnknown

func (m *BasicAllowance) XXX_DiscardUnknown()

func (*BasicAllowance) XXX_Marshal

func (m *BasicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BasicAllowance) XXX_Merge

func (m *BasicAllowance) XXX_Merge(src proto.Message)

func (*BasicAllowance) XXX_Size

func (m *BasicAllowance) XXX_Size() int

func (*BasicAllowance) XXX_Unmarshal

func (m *BasicAllowance) XXX_Unmarshal(b []byte) error

type FeeAllowanceI

type FeeAllowanceI interface {
	// Accept can use fee payment requested as well as timestamp of the current block
	// to determine whether or not to process this. This is checked in
	// Keeper.UseGrantedFees and the return values should match how it is handled there.
	//
	// If it returns an error, the fee payment is rejected, otherwise it is accepted.
	// The FeeAllowance implementation is expected to update it's internal state
	// and will be saved again after an acceptance.
	//
	// If remove is true (regardless of the error), the FeeAllowance will be deleted from storage
	// (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees)
	Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (remove bool, err error)

	// ValidateBasic should evaluate this FeeAllowance for internal consistency.
	// Don't allow negative amounts, or negative periods for example.
	ValidateBasic() error

	// ExpiresAt returns the expiry time of the allowance.
	ExpiresAt() (*time.Time, error)
}

FeeAllowance implementations are tied to a given fee delegator and delegatee, and are used to enforce fee grant limits.

type GenesisState

type GenesisState struct {
	Allowances []Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances"`
}

GenesisState contains a set of fee allowances, persisted from the store

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState returns default state for feegrant module.

func NewGenesisState

func NewGenesisState(entries []Grant) *GenesisState

NewGenesisState creates new GenesisState object

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetAllowances

func (m *GenesisState) GetAllowances() []Grant

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) UnpackInterfaces

func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type Grant

type Grant struct {
	// granter is the address of the user granting an allowance of their funds.
	Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
	// grantee is the address of the user being granted an allowance of another user's funds.
	Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
	// allowance can be any of basic, periodic, allowed fee allowance.
	Allowance *types1.Any `protobuf:"bytes,3,opt,name=allowance,proto3" json:"allowance,omitempty"`
}

Grant is stored in the KVStore to record a grant with full context

func NewGrant

func NewGrant(granter, grantee sdk.AccAddress, feeAllowance FeeAllowanceI) (Grant, error)

NewGrant creates a new FeeAllowanceGrant.

func (*Grant) Descriptor

func (*Grant) Descriptor() ([]byte, []int)

func (*Grant) GetAllowance

func (m *Grant) GetAllowance() *types1.Any

func (Grant) GetGrant

func (a Grant) GetGrant() (FeeAllowanceI, error)

GetGrant unpacks allowance

func (*Grant) GetGrantee

func (m *Grant) GetGrantee() string

func (*Grant) GetGranter

func (m *Grant) GetGranter() string

func (*Grant) Marshal

func (m *Grant) Marshal() (dAtA []byte, err error)

func (*Grant) MarshalTo

func (m *Grant) MarshalTo(dAtA []byte) (int, error)

func (*Grant) MarshalToSizedBuffer

func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Grant) ProtoMessage

func (*Grant) ProtoMessage()

func (*Grant) Reset

func (m *Grant) Reset()

func (*Grant) Size

func (m *Grant) Size() (n int)

func (*Grant) String

func (m *Grant) String() string

func (*Grant) Unmarshal

func (m *Grant) Unmarshal(dAtA []byte) error

func (Grant) UnpackInterfaces

func (a Grant) UnpackInterfaces(unpacker types.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (Grant) ValidateBasic

func (a Grant) ValidateBasic() error

ValidateBasic performs basic validation on FeeAllowanceGrant

func (*Grant) XXX_DiscardUnknown

func (m *Grant) XXX_DiscardUnknown()

func (*Grant) XXX_Marshal

func (m *Grant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Grant) XXX_Merge

func (m *Grant) XXX_Merge(src proto.Message)

func (*Grant) XXX_Size

func (m *Grant) XXX_Size() int

func (*Grant) XXX_Unmarshal

func (m *Grant) XXX_Unmarshal(b []byte) error

type MsgClient

type MsgClient interface {
	// GrantAllowance grants fee allowance to the grantee on the granter's
	// account with the provided expiration time.
	GrantAllowance(ctx context.Context, in *MsgGrantAllowance, opts ...grpc.CallOption) (*MsgGrantAllowanceResponse, error)
	// RevokeAllowance revokes any fee allowance of granter's account that
	// has been granted to the grantee.
	RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgGrantAllowance

type MsgGrantAllowance struct {
	// granter is the address of the user granting an allowance of their funds.
	Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
	// grantee is the address of the user being granted an allowance of another user's funds.
	Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
	// allowance can be any of basic, periodic, allowed fee allowance.
	Allowance *types.Any `protobuf:"bytes,3,opt,name=allowance,proto3" json:"allowance,omitempty"`
}

MsgGrantAllowance adds permission for Grantee to spend up to Allowance of fees from the account of Granter.

func NewMsgGrantAllowance

func NewMsgGrantAllowance(feeAllowance FeeAllowanceI, granter, grantee sdk.AccAddress) (*MsgGrantAllowance, error)

NewMsgGrantAllowance creates a new MsgGrantAllowance.

func (*MsgGrantAllowance) Descriptor

func (*MsgGrantAllowance) Descriptor() ([]byte, []int)

func (*MsgGrantAllowance) GetAllowance

func (m *MsgGrantAllowance) GetAllowance() *types.Any

func (MsgGrantAllowance) GetFeeAllowanceI

func (msg MsgGrantAllowance) GetFeeAllowanceI() (FeeAllowanceI, error)

GetFeeAllowanceI returns unpacked FeeAllowance

func (*MsgGrantAllowance) GetGrantee

func (m *MsgGrantAllowance) GetGrantee() string

func (*MsgGrantAllowance) GetGranter

func (m *MsgGrantAllowance) GetGranter() string

func (MsgGrantAllowance) GetSignBytes

func (msg MsgGrantAllowance) GetSignBytes() []byte

GetSignBytes implements the LegacyMsg.GetSignBytes method.

func (MsgGrantAllowance) GetSigners

func (msg MsgGrantAllowance) GetSigners() []sdk.AccAddress

GetSigners gets the granter account associated with an allowance

func (*MsgGrantAllowance) Marshal

func (m *MsgGrantAllowance) Marshal() (dAtA []byte, err error)

func (*MsgGrantAllowance) MarshalTo

func (m *MsgGrantAllowance) MarshalTo(dAtA []byte) (int, error)

func (*MsgGrantAllowance) MarshalToSizedBuffer

func (m *MsgGrantAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGrantAllowance) ProtoMessage

func (*MsgGrantAllowance) ProtoMessage()

func (*MsgGrantAllowance) Reset

func (m *MsgGrantAllowance) Reset()

func (MsgGrantAllowance) Route

func (msg MsgGrantAllowance) Route() string

Route implements the LegacyMsg.Route method.

func (*MsgGrantAllowance) Size

func (m *MsgGrantAllowance) Size() (n int)

func (*MsgGrantAllowance) String

func (m *MsgGrantAllowance) String() string

func (MsgGrantAllowance) Type

func (msg MsgGrantAllowance) Type() string

Type implements the LegacyMsg.Type method.

func (*MsgGrantAllowance) Unmarshal

func (m *MsgGrantAllowance) Unmarshal(dAtA []byte) error

func (MsgGrantAllowance) UnpackInterfaces

func (msg MsgGrantAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (MsgGrantAllowance) ValidateBasic

func (msg MsgGrantAllowance) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

func (*MsgGrantAllowance) XXX_DiscardUnknown

func (m *MsgGrantAllowance) XXX_DiscardUnknown()

func (*MsgGrantAllowance) XXX_Marshal

func (m *MsgGrantAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGrantAllowance) XXX_Merge

func (m *MsgGrantAllowance) XXX_Merge(src proto.Message)

func (*MsgGrantAllowance) XXX_Size

func (m *MsgGrantAllowance) XXX_Size() int

func (*MsgGrantAllowance) XXX_Unmarshal

func (m *MsgGrantAllowance) XXX_Unmarshal(b []byte) error

type MsgGrantAllowanceResponse

type MsgGrantAllowanceResponse struct {
}

MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type.

func (*MsgGrantAllowanceResponse) Descriptor

func (*MsgGrantAllowanceResponse) Descriptor() ([]byte, []int)

func (*MsgGrantAllowanceResponse) Marshal

func (m *MsgGrantAllowanceResponse) Marshal() (dAtA []byte, err error)

func (*MsgGrantAllowanceResponse) MarshalTo

func (m *MsgGrantAllowanceResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgGrantAllowanceResponse) MarshalToSizedBuffer

func (m *MsgGrantAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGrantAllowanceResponse) ProtoMessage

func (*MsgGrantAllowanceResponse) ProtoMessage()

func (*MsgGrantAllowanceResponse) Reset

func (m *MsgGrantAllowanceResponse) Reset()

func (*MsgGrantAllowanceResponse) Size

func (m *MsgGrantAllowanceResponse) Size() (n int)

func (*MsgGrantAllowanceResponse) String

func (m *MsgGrantAllowanceResponse) String() string

func (*MsgGrantAllowanceResponse) Unmarshal

func (m *MsgGrantAllowanceResponse) Unmarshal(dAtA []byte) error

func (*MsgGrantAllowanceResponse) XXX_DiscardUnknown

func (m *MsgGrantAllowanceResponse) XXX_DiscardUnknown()

func (*MsgGrantAllowanceResponse) XXX_Marshal

func (m *MsgGrantAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGrantAllowanceResponse) XXX_Merge

func (m *MsgGrantAllowanceResponse) XXX_Merge(src proto.Message)

func (*MsgGrantAllowanceResponse) XXX_Size

func (m *MsgGrantAllowanceResponse) XXX_Size() int

func (*MsgGrantAllowanceResponse) XXX_Unmarshal

func (m *MsgGrantAllowanceResponse) XXX_Unmarshal(b []byte) error

type MsgRevokeAllowance

type MsgRevokeAllowance struct {
	// granter is the address of the user granting an allowance of their funds.
	Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
	// grantee is the address of the user being granted an allowance of another user's funds.
	Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
}

MsgRevokeAllowance removes any existing Allowance from Granter to Grantee.

func NewMsgRevokeAllowance

func NewMsgRevokeAllowance(granter sdk.AccAddress, grantee sdk.AccAddress) MsgRevokeAllowance

NewMsgRevokeAllowance returns a message to revoke a fee allowance for a given granter and grantee

func (*MsgRevokeAllowance) Descriptor

func (*MsgRevokeAllowance) Descriptor() ([]byte, []int)

func (*MsgRevokeAllowance) GetGrantee

func (m *MsgRevokeAllowance) GetGrantee() string

func (*MsgRevokeAllowance) GetGranter

func (m *MsgRevokeAllowance) GetGranter() string

func (MsgRevokeAllowance) GetSignBytes

func (msg MsgRevokeAllowance) GetSignBytes() []byte

GetSignBytes implements the LegacyMsg.GetSignBytes method.

func (MsgRevokeAllowance) GetSigners

func (msg MsgRevokeAllowance) GetSigners() []sdk.AccAddress

GetSigners gets the granter address associated with an Allowance to revoke.

func (*MsgRevokeAllowance) Marshal

func (m *MsgRevokeAllowance) Marshal() (dAtA []byte, err error)

func (*MsgRevokeAllowance) MarshalTo

func (m *MsgRevokeAllowance) MarshalTo(dAtA []byte) (int, error)

func (*MsgRevokeAllowance) MarshalToSizedBuffer

func (m *MsgRevokeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgRevokeAllowance) ProtoMessage

func (*MsgRevokeAllowance) ProtoMessage()

func (*MsgRevokeAllowance) Reset

func (m *MsgRevokeAllowance) Reset()

func (MsgRevokeAllowance) Route

func (msg MsgRevokeAllowance) Route() string

Route implements the LegacyMsg.Route method.

func (*MsgRevokeAllowance) Size

func (m *MsgRevokeAllowance) Size() (n int)

func (*MsgRevokeAllowance) String

func (m *MsgRevokeAllowance) String() string

func (MsgRevokeAllowance) Type

func (msg MsgRevokeAllowance) Type() string

Type implements the LegacyMsg.Type method.

func (*MsgRevokeAllowance) Unmarshal

func (m *MsgRevokeAllowance) Unmarshal(dAtA []byte) error

func (MsgRevokeAllowance) ValidateBasic

func (msg MsgRevokeAllowance) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface.

func (*MsgRevokeAllowance) XXX_DiscardUnknown

func (m *MsgRevokeAllowance) XXX_DiscardUnknown()

func (*MsgRevokeAllowance) XXX_Marshal

func (m *MsgRevokeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgRevokeAllowance) XXX_Merge

func (m *MsgRevokeAllowance) XXX_Merge(src proto.Message)

func (*MsgRevokeAllowance) XXX_Size

func (m *MsgRevokeAllowance) XXX_Size() int

func (*MsgRevokeAllowance) XXX_Unmarshal

func (m *MsgRevokeAllowance) XXX_Unmarshal(b []byte) error

type MsgRevokeAllowanceResponse

type MsgRevokeAllowanceResponse struct {
}

MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type.

func (*MsgRevokeAllowanceResponse) Descriptor

func (*MsgRevokeAllowanceResponse) Descriptor() ([]byte, []int)

func (*MsgRevokeAllowanceResponse) Marshal

func (m *MsgRevokeAllowanceResponse) Marshal() (dAtA []byte, err error)

func (*MsgRevokeAllowanceResponse) MarshalTo

func (m *MsgRevokeAllowanceResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgRevokeAllowanceResponse) MarshalToSizedBuffer

func (m *MsgRevokeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgRevokeAllowanceResponse) ProtoMessage

func (*MsgRevokeAllowanceResponse) ProtoMessage()

func (*MsgRevokeAllowanceResponse) Reset

func (m *MsgRevokeAllowanceResponse) Reset()

func (*MsgRevokeAllowanceResponse) Size

func (m *MsgRevokeAllowanceResponse) Size() (n int)

func (*MsgRevokeAllowanceResponse) String

func (m *MsgRevokeAllowanceResponse) String() string

func (*MsgRevokeAllowanceResponse) Unmarshal

func (m *MsgRevokeAllowanceResponse) Unmarshal(dAtA []byte) error

func (*MsgRevokeAllowanceResponse) XXX_DiscardUnknown

func (m *MsgRevokeAllowanceResponse) XXX_DiscardUnknown()

func (*MsgRevokeAllowanceResponse) XXX_Marshal

func (m *MsgRevokeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgRevokeAllowanceResponse) XXX_Merge

func (m *MsgRevokeAllowanceResponse) XXX_Merge(src proto.Message)

func (*MsgRevokeAllowanceResponse) XXX_Size

func (m *MsgRevokeAllowanceResponse) XXX_Size() int

func (*MsgRevokeAllowanceResponse) XXX_Unmarshal

func (m *MsgRevokeAllowanceResponse) XXX_Unmarshal(b []byte) error

type MsgServer

type MsgServer interface {
	// GrantAllowance grants fee allowance to the grantee on the granter's
	// account with the provided expiration time.
	GrantAllowance(context.Context, *MsgGrantAllowance) (*MsgGrantAllowanceResponse, error)
	// RevokeAllowance revokes any fee allowance of granter's account that
	// has been granted to the grantee.
	RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error)
}

MsgServer is the server API for Msg service.

type PeriodicAllowance

type PeriodicAllowance struct {
	// basic specifies a struct of `BasicAllowance`
	Basic BasicAllowance `protobuf:"bytes,1,opt,name=basic,proto3" json:"basic"`
	// period specifies the time duration in which period_spend_limit coins can
	// be spent before that allowance is reset
	Period time.Duration `protobuf:"bytes,2,opt,name=period,proto3,stdduration" json:"period"`
	// period_spend_limit specifies the maximum number of coins that can be spent
	// in the period
	PeriodSpendLimit github_com_cosmos_cosmos_sdk_types.Coins `` /* 155-byte string literal not displayed */
	// period_can_spend is the number of coins left to be spent before the period_reset time
	PeriodCanSpend github_com_cosmos_cosmos_sdk_types.Coins `` /* 149-byte string literal not displayed */
	// period_reset is the time at which this period resets and a new one begins,
	// it is calculated from the start time of the first transaction after the
	// last period ended
	PeriodReset time.Time `protobuf:"bytes,5,opt,name=period_reset,json=periodReset,proto3,stdtime" json:"period_reset"`
}

PeriodicAllowance extends Allowance to allow for both a maximum cap, as well as a limit per time period.

func (*PeriodicAllowance) Accept

func (a *PeriodicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error)

Accept can use fee payment requested as well as timestamp of the current block to determine whether or not to process this. This is checked in Keeper.UseGrantedFees and the return values should match how it is handled there.

If it returns an error, the fee payment is rejected, otherwise it is accepted. The FeeAllowance implementation is expected to update it's internal state and will be saved again after an acceptance.

If remove is true (regardless of the error), the FeeAllowance will be deleted from storage (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees)

func (*PeriodicAllowance) Descriptor

func (*PeriodicAllowance) Descriptor() ([]byte, []int)

func (PeriodicAllowance) ExpiresAt added in v0.46.0

func (a PeriodicAllowance) ExpiresAt() (*time.Time, error)

func (*PeriodicAllowance) GetBasic

func (m *PeriodicAllowance) GetBasic() BasicAllowance

func (*PeriodicAllowance) GetPeriod

func (m *PeriodicAllowance) GetPeriod() time.Duration

func (*PeriodicAllowance) GetPeriodCanSpend

func (*PeriodicAllowance) GetPeriodReset

func (m *PeriodicAllowance) GetPeriodReset() time.Time

func (*PeriodicAllowance) GetPeriodSpendLimit

func (*PeriodicAllowance) Marshal

func (m *PeriodicAllowance) Marshal() (dAtA []byte, err error)

func (*PeriodicAllowance) MarshalTo

func (m *PeriodicAllowance) MarshalTo(dAtA []byte) (int, error)

func (*PeriodicAllowance) MarshalToSizedBuffer

func (m *PeriodicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PeriodicAllowance) ProtoMessage

func (*PeriodicAllowance) ProtoMessage()

func (*PeriodicAllowance) Reset

func (m *PeriodicAllowance) Reset()

func (*PeriodicAllowance) Size

func (m *PeriodicAllowance) Size() (n int)

func (*PeriodicAllowance) String

func (m *PeriodicAllowance) String() string

func (*PeriodicAllowance) Unmarshal

func (m *PeriodicAllowance) Unmarshal(dAtA []byte) error

func (PeriodicAllowance) ValidateBasic

func (a PeriodicAllowance) ValidateBasic() error

ValidateBasic implements FeeAllowance and enforces basic sanity checks

func (*PeriodicAllowance) XXX_DiscardUnknown

func (m *PeriodicAllowance) XXX_DiscardUnknown()

func (*PeriodicAllowance) XXX_Marshal

func (m *PeriodicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeriodicAllowance) XXX_Merge

func (m *PeriodicAllowance) XXX_Merge(src proto.Message)

func (*PeriodicAllowance) XXX_Size

func (m *PeriodicAllowance) XXX_Size() int

func (*PeriodicAllowance) XXX_Unmarshal

func (m *PeriodicAllowance) XXX_Unmarshal(b []byte) error

type QueryAllowanceRequest

type QueryAllowanceRequest struct {
	// granter is the address of the user granting an allowance of their funds.
	Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
	// grantee is the address of the user being granted an allowance of another user's funds.
	Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
}

QueryAllowanceRequest is the request type for the Query/Allowance RPC method.

func (*QueryAllowanceRequest) Descriptor

func (*QueryAllowanceRequest) Descriptor() ([]byte, []int)

func (*QueryAllowanceRequest) GetGrantee

func (m *QueryAllowanceRequest) GetGrantee() string

func (*QueryAllowanceRequest) GetGranter

func (m *QueryAllowanceRequest) GetGranter() string

func (*QueryAllowanceRequest) Marshal

func (m *QueryAllowanceRequest) Marshal() (dAtA []byte, err error)

func (*QueryAllowanceRequest) MarshalTo

func (m *QueryAllowanceRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryAllowanceRequest) MarshalToSizedBuffer

func (m *QueryAllowanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryAllowanceRequest) ProtoMessage

func (*QueryAllowanceRequest) ProtoMessage()

func (*QueryAllowanceRequest) Reset

func (m *QueryAllowanceRequest) Reset()

func (*QueryAllowanceRequest) Size

func (m *QueryAllowanceRequest) Size() (n int)

func (*QueryAllowanceRequest) String

func (m *QueryAllowanceRequest) String() string

func (*QueryAllowanceRequest) Unmarshal

func (m *QueryAllowanceRequest) Unmarshal(dAtA []byte) error

func (*QueryAllowanceRequest) XXX_DiscardUnknown

func (m *QueryAllowanceRequest) XXX_DiscardUnknown()

func (*QueryAllowanceRequest) XXX_Marshal

func (m *QueryAllowanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryAllowanceRequest) XXX_Merge

func (m *QueryAllowanceRequest) XXX_Merge(src proto.Message)

func (*QueryAllowanceRequest) XXX_Size

func (m *QueryAllowanceRequest) XXX_Size() int

func (*QueryAllowanceRequest) XXX_Unmarshal

func (m *QueryAllowanceRequest) XXX_Unmarshal(b []byte) error

type QueryAllowanceResponse

type QueryAllowanceResponse struct {
	// allowance is a allowance granted for grantee by granter.
	Allowance *Grant `protobuf:"bytes,1,opt,name=allowance,proto3" json:"allowance,omitempty"`
}

QueryAllowanceResponse is the response type for the Query/Allowance RPC method.

func (*QueryAllowanceResponse) Descriptor

func (*QueryAllowanceResponse) Descriptor() ([]byte, []int)

func (*QueryAllowanceResponse) GetAllowance

func (m *QueryAllowanceResponse) GetAllowance() *Grant

func (*QueryAllowanceResponse) Marshal

func (m *QueryAllowanceResponse) Marshal() (dAtA []byte, err error)

func (*QueryAllowanceResponse) MarshalTo

func (m *QueryAllowanceResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryAllowanceResponse) MarshalToSizedBuffer

func (m *QueryAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryAllowanceResponse) ProtoMessage

func (*QueryAllowanceResponse) ProtoMessage()

func (*QueryAllowanceResponse) Reset

func (m *QueryAllowanceResponse) Reset()

func (*QueryAllowanceResponse) Size

func (m *QueryAllowanceResponse) Size() (n int)

func (*QueryAllowanceResponse) String

func (m *QueryAllowanceResponse) String() string

func (*QueryAllowanceResponse) Unmarshal

func (m *QueryAllowanceResponse) Unmarshal(dAtA []byte) error

func (*QueryAllowanceResponse) XXX_DiscardUnknown

func (m *QueryAllowanceResponse) XXX_DiscardUnknown()

func (*QueryAllowanceResponse) XXX_Marshal

func (m *QueryAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryAllowanceResponse) XXX_Merge

func (m *QueryAllowanceResponse) XXX_Merge(src proto.Message)

func (*QueryAllowanceResponse) XXX_Size

func (m *QueryAllowanceResponse) XXX_Size() int

func (*QueryAllowanceResponse) XXX_Unmarshal

func (m *QueryAllowanceResponse) XXX_Unmarshal(b []byte) error

type QueryAllowancesByGranterRequest added in v0.45.5

type QueryAllowancesByGranterRequest struct {
	Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
	// pagination defines an pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.

Since: cosmos-sdk 0.46

func (*QueryAllowancesByGranterRequest) Descriptor added in v0.45.5

func (*QueryAllowancesByGranterRequest) Descriptor() ([]byte, []int)

func (*QueryAllowancesByGranterRequest) GetGranter added in v0.45.5

func (m *QueryAllowancesByGranterRequest) GetGranter() string

func (*QueryAllowancesByGranterRequest) GetPagination added in v0.45.5

func (*QueryAllowancesByGranterRequest) Marshal added in v0.45.5

func (m *QueryAllowancesByGranterRequest) Marshal() (dAtA []byte, err error)

func (*QueryAllowancesByGranterRequest) MarshalTo added in v0.45.5

func (m *QueryAllowancesByGranterRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryAllowancesByGranterRequest) MarshalToSizedBuffer added in v0.45.5

func (m *QueryAllowancesByGranterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryAllowancesByGranterRequest) ProtoMessage added in v0.45.5

func (*QueryAllowancesByGranterRequest) ProtoMessage()

func (*QueryAllowancesByGranterRequest) Reset added in v0.45.5

func (*QueryAllowancesByGranterRequest) Size added in v0.45.5

func (m *QueryAllowancesByGranterRequest) Size() (n int)

func (*QueryAllowancesByGranterRequest) String added in v0.45.5

func (*QueryAllowancesByGranterRequest) Unmarshal added in v0.45.5

func (m *QueryAllowancesByGranterRequest) Unmarshal(dAtA []byte) error

func (*QueryAllowancesByGranterRequest) XXX_DiscardUnknown added in v0.45.5

func (m *QueryAllowancesByGranterRequest) XXX_DiscardUnknown()

func (*QueryAllowancesByGranterRequest) XXX_Marshal added in v0.45.5

func (m *QueryAllowancesByGranterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryAllowancesByGranterRequest) XXX_Merge added in v0.45.5

func (m *QueryAllowancesByGranterRequest) XXX_Merge(src proto.Message)

func (*QueryAllowancesByGranterRequest) XXX_Size added in v0.45.5

func (m *QueryAllowancesByGranterRequest) XXX_Size() int

func (*QueryAllowancesByGranterRequest) XXX_Unmarshal added in v0.45.5

func (m *QueryAllowancesByGranterRequest) XXX_Unmarshal(b []byte) error

type QueryAllowancesByGranterResponse added in v0.45.5

type QueryAllowancesByGranterResponse struct {
	// allowances that have been issued by the granter.
	Allowances []*Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances,omitempty"`
	// pagination defines an pagination for the response.
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.

Since: cosmos-sdk 0.46

func (*QueryAllowancesByGranterResponse) Descriptor added in v0.45.5

func (*QueryAllowancesByGranterResponse) Descriptor() ([]byte, []int)

func (*QueryAllowancesByGranterResponse) GetAllowances added in v0.45.5

func (m *QueryAllowancesByGranterResponse) GetAllowances() []*Grant

func (*QueryAllowancesByGranterResponse) GetPagination added in v0.45.5

func (*QueryAllowancesByGranterResponse) Marshal added in v0.45.5

func (m *QueryAllowancesByGranterResponse) Marshal() (dAtA []byte, err error)

func (*QueryAllowancesByGranterResponse) MarshalTo added in v0.45.5

func (m *QueryAllowancesByGranterResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryAllowancesByGranterResponse) MarshalToSizedBuffer added in v0.45.5

func (m *QueryAllowancesByGranterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryAllowancesByGranterResponse) ProtoMessage added in v0.45.5

func (*QueryAllowancesByGranterResponse) ProtoMessage()

func (*QueryAllowancesByGranterResponse) Reset added in v0.45.5

func (*QueryAllowancesByGranterResponse) Size added in v0.45.5

func (m *QueryAllowancesByGranterResponse) Size() (n int)

func (*QueryAllowancesByGranterResponse) String added in v0.45.5

func (*QueryAllowancesByGranterResponse) Unmarshal added in v0.45.5

func (m *QueryAllowancesByGranterResponse) Unmarshal(dAtA []byte) error

func (*QueryAllowancesByGranterResponse) XXX_DiscardUnknown added in v0.45.5

func (m *QueryAllowancesByGranterResponse) XXX_DiscardUnknown()

func (*QueryAllowancesByGranterResponse) XXX_Marshal added in v0.45.5

func (m *QueryAllowancesByGranterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryAllowancesByGranterResponse) XXX_Merge added in v0.45.5

func (*QueryAllowancesByGranterResponse) XXX_Size added in v0.45.5

func (m *QueryAllowancesByGranterResponse) XXX_Size() int

func (*QueryAllowancesByGranterResponse) XXX_Unmarshal added in v0.45.5

func (m *QueryAllowancesByGranterResponse) XXX_Unmarshal(b []byte) error

type QueryAllowancesRequest

type QueryAllowancesRequest struct {
	Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"`
	// pagination defines an pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryAllowancesRequest is the request type for the Query/Allowances RPC method.

func (*QueryAllowancesRequest) Descriptor

func (*QueryAllowancesRequest) Descriptor() ([]byte, []int)

func (*QueryAllowancesRequest) GetGrantee

func (m *QueryAllowancesRequest) GetGrantee() string

func (*QueryAllowancesRequest) GetPagination

func (m *QueryAllowancesRequest) GetPagination() *query.PageRequest

func (*QueryAllowancesRequest) Marshal

func (m *QueryAllowancesRequest) Marshal() (dAtA []byte, err error)

func (*QueryAllowancesRequest) MarshalTo

func (m *QueryAllowancesRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryAllowancesRequest) MarshalToSizedBuffer

func (m *QueryAllowancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryAllowancesRequest) ProtoMessage

func (*QueryAllowancesRequest) ProtoMessage()

func (*QueryAllowancesRequest) Reset

func (m *QueryAllowancesRequest) Reset()

func (*QueryAllowancesRequest) Size

func (m *QueryAllowancesRequest) Size() (n int)

func (*QueryAllowancesRequest) String

func (m *QueryAllowancesRequest) String() string

func (*QueryAllowancesRequest) Unmarshal

func (m *QueryAllowancesRequest) Unmarshal(dAtA []byte) error

func (*QueryAllowancesRequest) XXX_DiscardUnknown

func (m *QueryAllowancesRequest) XXX_DiscardUnknown()

func (*QueryAllowancesRequest) XXX_Marshal

func (m *QueryAllowancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryAllowancesRequest) XXX_Merge

func (m *QueryAllowancesRequest) XXX_Merge(src proto.Message)

func (*QueryAllowancesRequest) XXX_Size

func (m *QueryAllowancesRequest) XXX_Size() int

func (*QueryAllowancesRequest) XXX_Unmarshal

func (m *QueryAllowancesRequest) XXX_Unmarshal(b []byte) error

type QueryAllowancesResponse

type QueryAllowancesResponse struct {
	// allowances are allowance's granted for grantee by granter.
	Allowances []*Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances,omitempty"`
	// pagination defines an pagination for the response.
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

QueryAllowancesResponse is the response type for the Query/Allowances RPC method.

func (*QueryAllowancesResponse) Descriptor

func (*QueryAllowancesResponse) Descriptor() ([]byte, []int)

func (*QueryAllowancesResponse) GetAllowances

func (m *QueryAllowancesResponse) GetAllowances() []*Grant

func (*QueryAllowancesResponse) GetPagination

func (m *QueryAllowancesResponse) GetPagination() *query.PageResponse

func (*QueryAllowancesResponse) Marshal

func (m *QueryAllowancesResponse) Marshal() (dAtA []byte, err error)

func (*QueryAllowancesResponse) MarshalTo

func (m *QueryAllowancesResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryAllowancesResponse) MarshalToSizedBuffer

func (m *QueryAllowancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryAllowancesResponse) ProtoMessage

func (*QueryAllowancesResponse) ProtoMessage()

func (*QueryAllowancesResponse) Reset

func (m *QueryAllowancesResponse) Reset()

func (*QueryAllowancesResponse) Size

func (m *QueryAllowancesResponse) Size() (n int)

func (*QueryAllowancesResponse) String

func (m *QueryAllowancesResponse) String() string

func (*QueryAllowancesResponse) Unmarshal

func (m *QueryAllowancesResponse) Unmarshal(dAtA []byte) error

func (*QueryAllowancesResponse) XXX_DiscardUnknown

func (m *QueryAllowancesResponse) XXX_DiscardUnknown()

func (*QueryAllowancesResponse) XXX_Marshal

func (m *QueryAllowancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryAllowancesResponse) XXX_Merge

func (m *QueryAllowancesResponse) XXX_Merge(src proto.Message)

func (*QueryAllowancesResponse) XXX_Size

func (m *QueryAllowancesResponse) XXX_Size() int

func (*QueryAllowancesResponse) XXX_Unmarshal

func (m *QueryAllowancesResponse) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	// Allowance returns fee granted to the grantee by the granter.
	Allowance(ctx context.Context, in *QueryAllowanceRequest, opts ...grpc.CallOption) (*QueryAllowanceResponse, error)
	// Allowances returns all the grants for address.
	Allowances(ctx context.Context, in *QueryAllowancesRequest, opts ...grpc.CallOption) (*QueryAllowancesResponse, error)
	// AllowancesByGranter returns all the grants given by an address
	//
	// Since: cosmos-sdk 0.46
	AllowancesByGranter(ctx context.Context, in *QueryAllowancesByGranterRequest, opts ...grpc.CallOption) (*QueryAllowancesByGranterResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryServer

type QueryServer interface {
	// Allowance returns fee granted to the grantee by the granter.
	Allowance(context.Context, *QueryAllowanceRequest) (*QueryAllowanceResponse, error)
	// Allowances returns all the grants for address.
	Allowances(context.Context, *QueryAllowancesRequest) (*QueryAllowancesResponse, error)
	// AllowancesByGranter returns all the grants given by an address
	//
	// Since: cosmos-sdk 0.46
	AllowancesByGranter(context.Context, *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) GrantAllowance

func (*UnimplementedMsgServer) RevokeAllowance

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Allowance

func (*UnimplementedQueryServer) Allowances

func (*UnimplementedQueryServer) AllowancesByGranter added in v0.45.5

Directories

Path Synopsis
client
cli
migrations
v2
Package testutil is a generated GoMock package.
Package testutil is a generated GoMock package.

Jump to

Keyboard shortcuts

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