From fb0344f45da2d82294d34b5565b56fd9f8758c16 Mon Sep 17 00:00:00 2001 From: expertdicer Date: Mon, 22 Jul 2024 12:16:39 +0700 Subject: [PATCH] update post handler --- custom/auth/post/post.go | 3 ++- x/tax2gas/post/post.go | 4 +++- x/tax2gas/types/expected_keeper.go | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/custom/auth/post/post.go b/custom/auth/post/post.go index bb737fc0..5183346c 100644 --- a/custom/auth/post/post.go +++ b/custom/auth/post/post.go @@ -17,6 +17,7 @@ type HandlerOptions struct { FeegrantKeeper tax2gastypes.FeegrantKeeper DyncommKeeper dyncommkeeper.Keeper TreasuryKeeper tax2gastypes.TreasuryKeeper + DistrKeeper tax2gastypes.DistrKeeper Tax2Gaskeeper tax2gaskeeper.Keeper } @@ -25,6 +26,6 @@ type HandlerOptions struct { func NewPostHandler(options HandlerOptions) (sdk.PostHandler, error) { return sdk.ChainPostDecorators( dyncommpost.NewDyncommPostDecorator(options.DyncommKeeper), - tax2gaspost.NewTax2GasPostDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TreasuryKeeper, options.Tax2Gaskeeper), + tax2gaspost.NewTax2GasPostDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TreasuryKeeper, options.DistrKeeper, options.Tax2Gaskeeper), ), nil } diff --git a/x/tax2gas/post/post.go b/x/tax2gas/post/post.go index 9e9fcb7a..4f941b79 100644 --- a/x/tax2gas/post/post.go +++ b/x/tax2gas/post/post.go @@ -17,15 +17,17 @@ type Tax2gasPostDecorator struct { bankKeeper types.BankKeeper feegrantKeeper types.FeegrantKeeper treasuryKeeper types.TreasuryKeeper + distrKeeper types.DistrKeeper tax2gasKeeper tax2gasKeeper.Keeper } -func NewTax2GasPostDecorator(accountKeeper ante.AccountKeeper, bankKeeper types.BankKeeper, feegrantKeeper types.FeegrantKeeper, treasuryKeeper types.TreasuryKeeper, tax2gasKeeper tax2gasKeeper.Keeper) Tax2gasPostDecorator { +func NewTax2GasPostDecorator(accountKeeper ante.AccountKeeper, bankKeeper types.BankKeeper, feegrantKeeper types.FeegrantKeeper, treasuryKeeper types.TreasuryKeeper, distrKeeper types.DistrKeeper, tax2gasKeeper tax2gasKeeper.Keeper) Tax2gasPostDecorator { return Tax2gasPostDecorator{ accountKeeper: accountKeeper, bankKeeper: bankKeeper, feegrantKeeper: feegrantKeeper, treasuryKeeper: treasuryKeeper, + distrKeeper: distrKeeper, tax2gasKeeper: tax2gasKeeper, } } diff --git a/x/tax2gas/types/expected_keeper.go b/x/tax2gas/types/expected_keeper.go index b807a722..38f414f6 100644 --- a/x/tax2gas/types/expected_keeper.go +++ b/x/tax2gas/types/expected_keeper.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/feegrant" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // TreasuryKeeper for tax charging & recording @@ -15,6 +16,7 @@ type TreasuryKeeper interface { HasBurnTaxExemptionAddress(ctx sdk.Context, addresses ...string) bool HasBurnTaxExemptionContract(ctx sdk.Context, address string) bool GetMinInitialDepositRatio(ctx sdk.Context) sdk.Dec + GetOracleSplitRate(ctx sdk.Context) sdk.Dec } // BankKeeper defines the contract needed for supply related APIs (noalias) @@ -31,3 +33,10 @@ type FeegrantKeeper interface { GetAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress) (feegrant.FeeAllowanceI, error) UseGrantedFees(ctx sdk.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error } + +type DistrKeeper interface { + FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error + GetFeePool(ctx sdk.Context) distributiontypes.FeePool + GetCommunityTax(ctx sdk.Context) math.LegacyDec + SetFeePool(ctx sdk.Context, feePool distributiontypes.FeePool) +}