-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aljo242
committed
Nov 9, 2023
1 parent
ae32636
commit 36af853
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package feemarket | ||
|
||
import sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
type ( | ||
// FeeMarket defines the expected interface each fee market plugin must | ||
// implement to be utilized by the fee market module. | ||
FeeMarket interface { | ||
// ------------------- Fee Market Parameters ------------------- // | ||
|
||
// Init which initializes the fee market (in InitGenesis) | ||
Init(ctx sdk.Context) error | ||
|
||
// EndBlockUpdateHandler allows the fee market to be updated | ||
// after every block. This will be added to the EndBlock chain. | ||
EndBlockUpdateHandler(ctx sdk.Context) UpdateHandler | ||
|
||
// EpochUpdateHandler allows the fee market to be updated | ||
// after every given epoch identifier. This maps the epoch | ||
// identifier to the UpdateHandler that should be executed. | ||
EpochUpdateHandler(ctx sdk.Context) map[string]UpdateHandler | ||
|
||
// ------------------- Fee Market Queries ------------------- // | ||
|
||
// GetMinGasPrice retrieves the minimum gas price(s) needed | ||
// to be included in the block for the given transaction | ||
GetMinGasPrice(ctx sdk.Context, tx sdk.Tx) sdk.Coins | ||
|
||
// GetFeeMarketInfo retrieves the fee market's information about | ||
// how to pay for a transaction (min gas price, min tip, | ||
// where the fees are being distributed, etc.). | ||
GetFeeMarketInfo(ctx sdk.Context) map[string]string | ||
|
||
// GetID returns the identifier of the fee market | ||
GetID() string | ||
|
||
// ------------------- Fee Market Extraction ------------------- // | ||
|
||
// FeeAnteHandler will be called in the module AnteHandler, | ||
// this is where the fee market would extract and distribute | ||
// fees from a given transaction | ||
FeeAnteHandler( | ||
ctx sdk.Context, | ||
tx sdk.Tx, | ||
simulate bool, | ||
next sdk.AnteHandler, | ||
) sdk.AnteHandler | ||
|
||
// FeePostHandler will be called in the module PostHandler | ||
// if PostHandlers are implemented. This is another place | ||
// the fee market might refund users | ||
FeePostHandler( | ||
ctx sdk.Context, | ||
tx sdk.Tx, | ||
simulate, | ||
success bool, | ||
next sdk.PostHandler, | ||
) sdk.PostHandler | ||
} | ||
|
||
// UpdateHandler is responsible for updating the parameters of the | ||
// fee market plugin. Fees can optionally also be extracted here. | ||
UpdateHandler func(ctx sdk.Context) error | ||
) |