Skip to content

Commit

Permalink
EnableCommunityPoolFeeFunding
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Apr 27, 2024
1 parent 03a4e6d commit 6e19868
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ var (
tokenfactorytypes.EnableForceTransfer,
tokenfactorytypes.EnableSetMetadata,
tokenfactorytypes.EnableSudoMint,
tokenfactorytypes.EnableCommunityPoolFeeFunding,
}
)

Expand Down
16 changes: 14 additions & 2 deletions x/tokenfactory/keeper/createdenom.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,20 @@ func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string, _ stri
return err
}

if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil {
return err
if types.IsCapabilityEnabled(k.enabledCapabilities, types.EnableCommunityPoolFeeFunding) {
if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil {
return err
}
} else {
err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, accAddr, types.ModuleName, params.DenomCreationFee)
if err != nil {
return err
}

err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, params.DenomCreationFee)
if err != nil {
return err
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions x/tokenfactory/types/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const (
// Allows addresses of your choosing to mint tokens based on specific conditions.
// via the IsSudoAdminFunc
EnableSudoMint = "enable_admin_sudo_mint"
// EnableCommunityPoolFeeFunding sends tokens to the community pool when a new fee is charged (if one is set in params).
// This is useful for ICS chains, or networks who wish to just have the fee tokens burned (not gas fees, just the extra on top).
EnableCommunityPoolFeeFunding = "enable_community_pool_fee_funding"
)

func IsCapabilityEnabled(enabledCapabilities []string, capability string) bool {
Expand Down

0 comments on commit 6e19868

Please sign in to comment.