-
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
36af853
commit f0fa6b1
Showing
6 changed files
with
85 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,6 @@ | ||
# FeeMarket Plugins | ||
|
||
This directory contains implementations of the `FeeMarket` interface to be plugged into the `x/feemarket` module. | ||
|
||
Current implementations include: | ||
- [Mock:](./mock/feemarket.go) fee market that can be used for basic testing. DO NOT use in production. |
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 @@ | ||
package mock |
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,75 @@ | ||
package mock | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/skip-mev/feemarket/feemarket" | ||
) | ||
|
||
var _ feemarket.FeeMarket = FeeMarket{} | ||
|
||
// FeeMarket is a simple mock fee market implmentation that should only be used for testing. | ||
type FeeMarket struct{} | ||
|
||
// Init which initializes the fee market (in InitGenesis) | ||
func (fm FeeMarket) Init(ctx sdk.Context) error { | ||
return nil | ||
} | ||
|
||
// EndBlockUpdateHandler allows the fee market to be updated | ||
// after every block. This will be added to the EndBlock chain. | ||
func (fm FeeMarket) EndBlockUpdateHandler(ctx sdk.Context) feemarket.UpdateHandler { | ||
return nil | ||
} | ||
|
||
// 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. | ||
func (fm FeeMarket) EpochUpdateHandler(ctx sdk.Context) map[string]feemarket.UpdateHandler { | ||
return nil | ||
} | ||
|
||
// GetMinGasPrice retrieves the minimum gas price(s) needed | ||
// to be included in the block for the given transaction | ||
func (fm FeeMarket) GetMinGasPrice(ctx sdk.Context, tx sdk.Tx) sdk.Coins { | ||
return sdk.NewCoins() | ||
} | ||
|
||
// 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.). | ||
func (fm FeeMarket) GetFeeMarketInfo(ctx sdk.Context) map[string]string { | ||
return nil | ||
} | ||
|
||
// GetID returns the identifier of the fee market | ||
func (fm FeeMarket) GetID() string { | ||
return "mock" | ||
} | ||
|
||
// FeeAnteHandler will be called in the module AnteHandler. | ||
// Performs no actions. | ||
func (fm FeeMarket) FeeAnteHandler( | ||
ctx sdk.Context, | ||
tx sdk.Tx, | ||
simulate bool, | ||
next sdk.AnteHandler, | ||
) sdk.AnteHandler { | ||
return func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { | ||
return ctx, nil | ||
} | ||
} | ||
|
||
// FeePostHandler will be called in the module PostHandler | ||
// if PostHandlers are implemented. Performs no actions. | ||
func (fm FeeMarket) FeePostHandler( | ||
ctx sdk.Context, | ||
tx sdk.Tx, | ||
simulate, | ||
success bool, | ||
next sdk.PostHandler, | ||
) sdk.PostHandler { | ||
return func(ctx sdk.Context, tx sdk.Tx, simulate, success bool) (newCtx sdk.Context, err error) { | ||
return ctx, nil | ||
} | ||
} |
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
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
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