Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateBaseFee(ctx sdk.Context, feeTx sdk.FeeTx, msgfeekeeper msgfeestypes.MsgFeesKeeper) sdk.Coins
- func DeductBaseFees(bankKeeper bankkeeper.Keeper, ctx sdk.Context, acc types.AccountI, ...) error
- func DetermineTestBaseFeeAmount(ctx sdk.Context, feeTx sdk.FeeTx) sdk.Coins
- func EnsureAccountHasSufficientFeesWithAcctBalanceCheck(gas uint64, feeCoins sdk.Coins, additionalFees sdk.Coins, ...) error
- func EnsureSufficientFees(gas uint64, feeCoins sdk.Coins, additionalFees sdk.Coins, ...) error
- func EnsureSufficientMempoolFees(ctx sdk.Context, gas uint64, feeCoins sdk.Coins, additionalFees sdk.Coins) error
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func NewFeeGasMeterWrapper(logger log.Logger, baseMeter sdkgas.GasMeter, isSimulate bool) sdkgas.GasMeter
- type FeeGasMeter
- func (g *FeeGasMeter) BaseFeeConsumed() sdk.Coins
- func (g *FeeGasMeter) ConsumeBaseFee(amount sdk.Coins) sdk.Coins
- func (g *FeeGasMeter) ConsumeFee(amount sdk.Coin, msgType string, recipient string)
- func (g *FeeGasMeter) ConsumeGas(amount sdkgas.Gas, descriptor string)
- func (g *FeeGasMeter) EventFeeSummary() *msgfeestypes.EventMsgFees
- func (g *FeeGasMeter) FeeConsumed() sdk.Coins
- func (g *FeeGasMeter) FeeConsumedByMsg() map[string]sdk.Coins
- func (g *FeeGasMeter) FeeConsumedDistributions() map[string]sdk.Coins
- func (g *FeeGasMeter) FeeConsumedForType(msgType string, recipient string) sdk.Coins
- func (g *FeeGasMeter) GasConsumed() sdkgas.Gas
- func (g *FeeGasMeter) GasConsumedToLimit() sdkgas.Gas
- func (g *FeeGasMeter) IsOutOfGas() bool
- func (g *FeeGasMeter) IsPastLimit() bool
- func (g *FeeGasMeter) IsSimulate() bool
- func (g *FeeGasMeter) Limit() sdkgas.Gas
- func (g *FeeGasMeter) RefundGas(amount uint64, descriptor string)
- func (g *FeeGasMeter) String() string
- type FeeMeterContextDecorator
- type HandlerOptions
- type MsgFeesDecorator
- type MsgFeesDistribution
- type ProvenanceDeductFeeDecorator
- type TxGasLimitDecorator
Constants ¶
const ( DefaultInsufficientFeeMsg = "not enough fees; after deducting fees required,got" SimAppChainID = "simapp-unit-testing" )
Variables ¶
var ( AttributeKeyBaseFee = "basefee" AttributeKeyAdditionalFee = "additionalfee" AttributeKeyMinFeeCharged = "min_fee_charged" )
Functions ¶
func CalculateBaseFee ¶ added in v1.11.0
func CalculateBaseFee(ctx sdk.Context, feeTx sdk.FeeTx, msgfeekeeper msgfeestypes.MsgFeesKeeper) sdk.Coins
func DeductBaseFees ¶ added in v1.11.0
func DeductBaseFees(bankKeeper bankkeeper.Keeper, ctx sdk.Context, acc types.AccountI, fee sdk.Coins) error
DeductBaseFees deducts fees from the given account.
func DetermineTestBaseFeeAmount ¶ added in v1.11.0
DetermineTestBaseFeeAmount determines the type of test that is running. ChainID = "" is a simple unit We need this because of how tests are setup using atom and we have nhash specific code for msgfees
func EnsureAccountHasSufficientFeesWithAcctBalanceCheck ¶ added in v1.8.0
func EnsureSufficientFees ¶ added in v1.8.0
func EnsureSufficientFees(gas uint64, feeCoins sdk.Coins, additionalFees sdk.Coins, minGasPriceForAdditionalFeeCalc sdk.Coin) error
EnsureSufficientFees to be used by msg_service_router
func EnsureSufficientMempoolFees ¶ added in v1.8.0
func EnsureSufficientMempoolFees(ctx sdk.Context, gas uint64, feeCoins sdk.Coins, additionalFees sdk.Coins) error
EnsureSufficientMempoolFees verifies that the given transaction has supplied enough fees(gas + additional fees) to cover a proposer's minimum fees. A result object is returned indicating success or failure.
Contract: This should only be called during CheckTx as it cannot be part of consensus.
func NewAnteHandler ¶
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
Types ¶
type FeeGasMeter ¶ added in v1.8.0
type FeeGasMeter struct {
// contains filtered or unexported fields
}
func (*FeeGasMeter) BaseFeeConsumed ¶ added in v1.8.0
func (g *FeeGasMeter) BaseFeeConsumed() sdk.Coins
func (*FeeGasMeter) ConsumeBaseFee ¶ added in v1.8.0
func (g *FeeGasMeter) ConsumeBaseFee(amount sdk.Coins) sdk.Coins
func (*FeeGasMeter) ConsumeFee ¶ added in v1.8.0
func (g *FeeGasMeter) ConsumeFee(amount sdk.Coin, msgType string, recipient string)
ConsumeFee increments the amount of msg fee required by a msg type.
func (*FeeGasMeter) ConsumeGas ¶ added in v1.8.0
func (g *FeeGasMeter) ConsumeGas(amount sdkgas.Gas, descriptor string)
ConsumeGas increments the amount of gas used on the meter associated with a given purpose.
func (*FeeGasMeter) EventFeeSummary ¶ added in v1.9.0
func (g *FeeGasMeter) EventFeeSummary() *msgfeestypes.EventMsgFees
EventFeeSummary returns total fee consumed in the current fee gas meter, is returned Sorted.
func (*FeeGasMeter) FeeConsumed ¶ added in v1.8.0
func (g *FeeGasMeter) FeeConsumed() sdk.Coins
FeeConsumed returns total fee consumed in the current fee gas meter, is returned Sorted.
func (*FeeGasMeter) FeeConsumedByMsg ¶ added in v1.8.0
func (g *FeeGasMeter) FeeConsumedByMsg() map[string]sdk.Coins
FeeConsumedByMsg total fee consumed for a particular MsgType
func (*FeeGasMeter) FeeConsumedDistributions ¶ added in v1.11.0
func (g *FeeGasMeter) FeeConsumedDistributions() map[string]sdk.Coins
FeeConsumedDistributions returns fees by distribution either to fee module when key is empty or address
func (*FeeGasMeter) FeeConsumedForType ¶ added in v1.8.0
func (g *FeeGasMeter) FeeConsumedForType(msgType string, recipient string) sdk.Coins
func (*FeeGasMeter) GasConsumed ¶ added in v1.8.0
func (g *FeeGasMeter) GasConsumed() sdkgas.Gas
GasConsumed reports the amount of gas consumed at Log.Info level
func (*FeeGasMeter) GasConsumedToLimit ¶ added in v1.8.0
func (g *FeeGasMeter) GasConsumedToLimit() sdkgas.Gas
GasConsumedToLimit will report the actual consumption or the meter limit, whichever is less.
func (*FeeGasMeter) IsOutOfGas ¶ added in v1.8.0
func (g *FeeGasMeter) IsOutOfGas() bool
IsOutOfGas indicates the gas meter has tracked consumption at or above the limit
func (*FeeGasMeter) IsPastLimit ¶ added in v1.8.0
func (g *FeeGasMeter) IsPastLimit() bool
IsPastLimit indicates consumption has passed the limit (if any)
func (*FeeGasMeter) IsSimulate ¶ added in v1.8.0
func (g *FeeGasMeter) IsSimulate() bool
func (*FeeGasMeter) Limit ¶ added in v1.8.0
func (g *FeeGasMeter) Limit() sdkgas.Gas
Limit for amount of gas that can be consumed (if zero then unlimited)
func (*FeeGasMeter) RefundGas ¶ added in v1.8.0
func (g *FeeGasMeter) RefundGas(amount uint64, descriptor string)
RefundGas refunds an amount of gas
func (*FeeGasMeter) String ¶ added in v1.8.0
func (g *FeeGasMeter) String() string
String implements stringer interface
type FeeMeterContextDecorator ¶ added in v1.8.0
type FeeMeterContextDecorator struct{}
FeeMeterContextDecorator is an AnteDecorator that wraps the current context gas meter with a msg based fee meter. Also, it merges functionality from GasTracerContextDecorator in previous versions which provided an AnteDecorator that wraps the current context gas meter with one that outputs debug logging and telemetry whenever gas is consumed on the meter.
func NewFeeMeterContextDecorator ¶ added in v1.8.0
func NewFeeMeterContextDecorator() FeeMeterContextDecorator
NewFeeMeterContextDecorator creates a new FeeMeterContextDecorator
func (FeeMeterContextDecorator) AnteHandle ¶ added in v1.8.0
func (r FeeMeterContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle implements the AnteDecorator.AnteHandle method
type HandlerOptions ¶ added in v1.8.0
type HandlerOptions struct { AccountKeeper cosmosante.AccountKeeper BankKeeper banktypes.Keeper FeegrantKeeper msgfeestypes.FeegrantKeeper MsgFeesKeeper msgfeestypes.MsgFeesKeeper SignModeHandler authsigning.SignModeHandler SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error }
HandlerOptions are the options required for constructing a default SDK AnteHandler.
type MsgFeesDecorator ¶ added in v1.8.0
type MsgFeesDecorator struct {
// contains filtered or unexported fields
}
MsgFeesDecorator will check if the transaction's fee is at least as large as tax + additional minimum gasFee (defined in msgfeeskeeper) and record additional fee proceeds to msgfees module to track additional fee proceeds. If fee is too low, decorator returns error and tx is rejected from mempool. Note this only applies when ctx.CheckTx = true If fee is high enough or not CheckTx, then call next AnteHandler CONTRACT: Tx must implement FeeTx to use MsgFeesDecorator
func NewMsgFeesDecorator ¶ added in v1.8.0
func NewMsgFeesDecorator(bankKeeper banktypes.Keeper, accountKeeper cosmosante.AccountKeeper, feegrantKeeper msgfeestypes.FeegrantKeeper, keeper msgfeestypes.MsgFeesKeeper) MsgFeesDecorator
func (MsgFeesDecorator) AnteHandle ¶ added in v1.8.0
func (afd MsgFeesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle handles msg fee checking has two functions ensures, 1. has enough fees to add to Mempool (this involves CheckTx) 2. Makes sure enough fees are present for additional message fees Let z be the Total Fees to be paid Let x be the Base gas Fees to be paid Let y is the additional fees to be paid per MsgType then z = x + y This Fee Decorator makes sure that z is >= to x + y
type MsgFeesDistribution ¶ added in v1.11.0
type MsgFeesDistribution struct { AdditionalModuleFees sdk.Coins RecipientDistributions map[string]sdk.Coin TotalAdditionalFees sdk.Coins }
func CalculateAdditionalFeesToBePaid ¶ added in v1.8.0
func CalculateAdditionalFeesToBePaid(ctx sdk.Context, mbfk msgfeestypes.MsgFeesKeeper, msgs ...sdk.Msg) (*MsgFeesDistribution, error)
CalculateAdditionalFeesToBePaid computes the stability tax on MsgSend and MsgMultiSend.
type ProvenanceDeductFeeDecorator ¶ added in v1.8.0
type ProvenanceDeductFeeDecorator struct {
// contains filtered or unexported fields
}
ProvenanceDeductFeeDecorator deducts fees from the first signer of the tx If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error Call next AnteHandler if fees successfully deducted CONTRACT: Tx must implement FeeTx interface to use ProvenanceDeductFeeDecorator
func NewProvenanceDeductFeeDecorator ¶ added in v1.8.0
func NewProvenanceDeductFeeDecorator(ak authante.AccountKeeper, bk bankkeeper.Keeper, fk msgfeestypes.FeegrantKeeper, mbfk msgfeestypes.MsgFeesKeeper) ProvenanceDeductFeeDecorator
func (ProvenanceDeductFeeDecorator) AnteHandle ¶ added in v1.8.0
type TxGasLimitDecorator ¶ added in v1.8.0
type TxGasLimitDecorator struct{}
TxGasLimitDecorator will check if the transaction's gas amount is higher than 5% of the maximum gas allowed per block. If gas is too high, decorator returns error and tx is rejected from mempool. If gas is below the limit, then call next AnteHandler CONTRACT: Tx must implement FeeTx to use TxGasLimitDecorator
func NewTxGasLimitDecorator ¶ added in v1.8.0
func NewTxGasLimitDecorator() TxGasLimitDecorator