-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init custom fee antehandler and posthandler (#27)
* go mod * add ante * set antehandler * cute * lint fix * setup and wire * wire fmk * clean * format * todo * lint fix * rename * wip * proto * add param * add get * test * format * re-wire * add ak * fee decorator * mock * always check and use fee * extend with tip * fix lint * refactor * utd * utd * setup test * attempt test * fmt * clean * add * fix * rename * set posthandler * set posthandler * setup post * finalize * add options * clean * comments * clean * rename * use names * Update x/feemarket/types/expected_keepers.go Co-authored-by: David Terpay <[email protected]> * Update x/feemarket/post/fee.go Co-authored-by: David Terpay <[email protected]> * Update x/feemarket/ante/fee.go Co-authored-by: David Terpay <[email protected]> * fix * use feeTx * fix * separate * refactor tip * fix * use update --------- Co-authored-by: David Terpay <[email protected]>
- Loading branch information
1 parent
672c304
commit e872422
Showing
30 changed files
with
1,855 additions
and
45 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package app | ||
|
||
import ( | ||
errorsmod "cosmossdk.io/errors" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
|
||
feemarketpost "github.com/skip-mev/feemarket/x/feemarket/post" | ||
) | ||
|
||
// PostHandlerOptions are the options required for constructing a FeeMarket PostHandler. | ||
type PostHandlerOptions struct { | ||
AccountKeeper feemarketpost.AccountKeeper | ||
BankKeeper feemarketpost.BankKeeper | ||
FeeMarketKeeper feemarketpost.FeeMarketKeeper | ||
FeeGrantKeeper feemarketpost.FeeGrantKeeper | ||
} | ||
|
||
// NewPostHandler returns a PostHandler chain with the fee deduct decorator. | ||
func NewPostHandler(options PostHandlerOptions) (sdk.PostHandler, error) { | ||
if options.AccountKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for post builder") | ||
} | ||
|
||
if options.BankKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for post builder") | ||
} | ||
|
||
if options.FeeMarketKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "feemarket keeper is required for post builder") | ||
} | ||
|
||
postDecorators := []sdk.PostDecorator{ | ||
feemarketpost.NewFeeMarketDeductDecorator( | ||
options.AccountKeeper, | ||
options.BankKeeper, | ||
options.FeeGrantKeeper, | ||
options.FeeMarketKeeper, | ||
), | ||
} | ||
|
||
return sdk.ChainPostDecorators(postDecorators...), 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
Oops, something went wrong.