Skip to content

Commit

Permalink
update post handler
Browse files Browse the repository at this point in the history
  • Loading branch information
expertdicer committed Jul 22, 2024
1 parent 693a641 commit fb0344f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion custom/auth/post/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type HandlerOptions struct {
FeegrantKeeper tax2gastypes.FeegrantKeeper
DyncommKeeper dyncommkeeper.Keeper
TreasuryKeeper tax2gastypes.TreasuryKeeper
DistrKeeper tax2gastypes.DistrKeeper
Tax2Gaskeeper tax2gaskeeper.Keeper
}

Expand All @@ -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
}
4 changes: 3 additions & 1 deletion x/tax2gas/post/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down
9 changes: 9 additions & 0 deletions x/tax2gas/types/expected_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"

Check failure on line 5 in x/tax2gas/types/expected_keeper.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
"github.com/cosmos/cosmos-sdk/x/feegrant"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"

Check failure on line 7 in x/tax2gas/types/expected_keeper.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
)

// TreasuryKeeper for tax charging & recording
Expand All @@ -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)
Expand All @@ -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)
}

0 comments on commit fb0344f

Please sign in to comment.