Documentation ¶
Index ¶
- func CheckTxFee(ctx sdk.Context, gasPrice sdk.DecCoin, feeCoin sdk.Coin, feeGas int64, ...) (payCoin sdk.Coin, tip sdk.Coin, err error)
- func GetTxPriority(fee sdk.Coin, gasLimit int64, currentGasPrice sdk.DecCoin) int64
- type AccountKeeper
- type BankKeeper
- type FeeGrantKeeper
- type FeeMarketCheckDecorator
- type FeeMarketKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTxFee ¶
func CheckTxFee(ctx sdk.Context, gasPrice sdk.DecCoin, feeCoin sdk.Coin, feeGas int64, isAnte bool) (payCoin sdk.Coin, tip sdk.Coin, err error)
CheckTxFee implements the logic for the fee market to check if a Tx has provided sufficient fees given the current state of the fee market. Returns an error if insufficient fees.
func GetTxPriority ¶
GetTxPriority returns a naive tx priority based on the amount of gas price provided in a transaction.
The fee amount is divided by the gasLimit to calculate "Effective Gas Price". This value is then normalized and scaled into an integer, so it can be used as a priority.
effectiveGasPrice = feeAmount / gas limit (denominated in fee per gas) normalizedGasPrice = effectiveGasPrice / currentGasPrice (floor is 1. The minimum effective gas price can ever be is current gas price) scaledGasPrice = normalizedGasPrice * 10 ^ gasPricePrecision (amount of decimal places in the normalized gas price to consider when converting to int64).
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { GetParams(ctx context.Context) (params authtypes.Params) GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI SetAccount(ctx context.Context, acc sdk.AccountI) GetModuleAddress(moduleName string) sdk.AccAddress GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI AddressCodec() address.Codec }
AccountKeeper defines the contract needed for AccountKeeper related APIs. Interface provides support to use non-sdk AccountKeeper for AnteHandler's decorators.
type BankKeeper ¶
type BankKeeper interface { IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error SendCoins(ctx context.Context, from, to sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error }
BankKeeper defines the contract needed for supply related APIs.
type FeeGrantKeeper ¶
type FeeGrantKeeper interface {
UseGrantedFees(ctx context.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error
}
FeeGrantKeeper defines the expected feegrant keeper.
type FeeMarketCheckDecorator ¶
type FeeMarketCheckDecorator struct {
// contains filtered or unexported fields
}
FeeMarketCheckDecorator checks sufficient fees from the fee payer based off of the current state of the feemarket. If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. Call next AnteHandler if fees successfully checked.
If x/feemarket is disabled (params.Enabled == false), the handler will fall back to the default Cosmos SDK fee deduction antehandler.
CONTRACT: Tx must implement FeeTx interface
func NewFeeMarketCheckDecorator ¶
func NewFeeMarketCheckDecorator(fmk FeeMarketKeeper, fallbackDecorator sdk.AnteDecorator) FeeMarketCheckDecorator
func (FeeMarketCheckDecorator) AnteHandle ¶
func (d FeeMarketCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle calls the feemarket internal antehandler if the keeper is enabled. If disabled, the fallback fee antehandler is fallen back to.
type FeeMarketKeeper ¶
type FeeMarketKeeper interface { GetState(ctx sdk.Context) (feemarkettypes.State, error) GetMinGasPrice(ctx sdk.Context, denom string) (sdk.DecCoin, error) GetParams(ctx sdk.Context) (feemarkettypes.Params, error) SetState(ctx sdk.Context, state feemarkettypes.State) error SetParams(ctx sdk.Context, params feemarkettypes.Params) error ResolveToDenom(ctx sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) }
FeeMarketKeeper defines the expected feemarket keeper.