# 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)

Copy // Grant is stored in the KVStore to record a grant with full context 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"` }

# 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