diff --git a/CHANGELOG.md b/CHANGELOG.md index a08d9918b2c..e86d703d85b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,7 +96,8 @@ and control over token transfers. * [#5363](https://github.com/osmosis-labs/osmosis/pull/5363) fix: twap record upgrade handler * [#5265](https://github.com/osmosis-labs/osmosis/pull/5265) fix: expect single synthetic lock per native lock ID * [#4983](https://github.com/osmosis-labs/osmosis/pull/4983) implement gas consume on denom creation - * [#4830](https://github.com/osmosis-labs/osmosis/pull/4830) Scale gas costs by denoms in gauge + * [#4830](https://github.com/osmosis-labs/osmosis/pull/4830) Scale gas costs by denoms in gauge (AddToGaugeReward) + * [#5511](https://github.com/osmosis-labs/osmosis/pull/5511) Scale gas costs by denoms in gauge (CreateGauge) * [#4336](https://github.com/osmosis-labs/osmosis/pull/4336) feat: make epochs standalone * [#4801](https://github.com/osmosis-labs/osmosis/pull/4801) refactor: remove GetTotalShares, GetTotalLiquidity and GetExitFee from PoolI * [#4951](https://github.com/osmosis-labs/osmosis/pull/4951) feat: implement pool liquidity query in pool manager, deprecate the one in gamm diff --git a/x/incentives/client/cli/tx.go b/x/incentives/client/cli/tx.go index b251307f02f..f4f22001d85 100644 --- a/x/incentives/client/cli/tx.go +++ b/x/incentives/client/cli/tx.go @@ -31,7 +31,7 @@ func GetTxCmd() *cobra.Command { // NewCreateGaugeCmd broadcasts a CreateGauge message. func NewCreateGaugeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "create-gauge [lockup_denom] [reward] [flags]", + Use: "create-gauge [lockup_denom] [reward] [poolId] [flags]", Short: "create a gauge to distribute rewards to users", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -82,6 +82,11 @@ func NewCreateGaugeCmd() *cobra.Command { return err } + poolId, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return err + } + distributeTo := lockuptypes.QueryCondition{ LockQueryType: lockuptypes.ByDuration, Denom: denom, @@ -96,6 +101,7 @@ func NewCreateGaugeCmd() *cobra.Command { coins, startTime, epochs, + poolId, ) return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) diff --git a/x/incentives/keeper/gauge.go b/x/incentives/keeper/gauge.go index 4bf943e03ab..b7ce65a34eb 100644 --- a/x/incentives/keeper/gauge.go +++ b/x/incentives/keeper/gauge.go @@ -184,6 +184,9 @@ func (k Keeper) CreateGauge(ctx sdk.Context, isPerpetual bool, owner sdk.AccAddr NumEpochsPaidOver: numEpochsPaidOver, } + // Fixed gas consumption create gauge based on the number of coins to add + ctx.GasMeter().ConsumeGas(uint64(types.BaseGasFeeForCreateGauge*len(gauge.Coins)), "scaling gas cost for creating gauge rewards") + if err := k.bk.SendCoinsFromAccountToModule(ctx, owner, types.ModuleName, gauge.Coins); err != nil { return 0, err } diff --git a/x/incentives/types/constants.go b/x/incentives/types/constants.go index c9c031aef53..fdc1faca6de 100644 --- a/x/incentives/types/constants.go +++ b/x/incentives/types/constants.go @@ -3,6 +3,7 @@ package types import time "time" var ( + BaseGasFeeForCreateGauge = 10_000 BaseGasFeeForAddRewardToGauge = 10_000 // We set the default value to 1ns, as this is the only uptime we support as long as charging is disabled (or // until more supported uptimes are authorized by governance). diff --git a/x/incentives/types/msgs.go b/x/incentives/types/msgs.go index 2f3a105399f..dafeb82bd70 100644 --- a/x/incentives/types/msgs.go +++ b/x/incentives/types/msgs.go @@ -18,7 +18,7 @@ const ( var _ sdk.Msg = &MsgCreateGauge{} // NewMsgCreateGauge creates a message to create a gauge with the provided parameters. -func NewMsgCreateGauge(isPerpetual bool, owner sdk.AccAddress, distributeTo lockuptypes.QueryCondition, coins sdk.Coins, startTime time.Time, numEpochsPaidOver uint64) *MsgCreateGauge { +func NewMsgCreateGauge(isPerpetual bool, owner sdk.AccAddress, distributeTo lockuptypes.QueryCondition, coins sdk.Coins, startTime time.Time, numEpochsPaidOver uint64, poolId uint64) *MsgCreateGauge { return &MsgCreateGauge{ IsPerpetual: isPerpetual, Owner: owner.String(), @@ -26,6 +26,7 @@ func NewMsgCreateGauge(isPerpetual bool, owner sdk.AccAddress, distributeTo lock Coins: coins, StartTime: startTime, NumEpochsPaidOver: numEpochsPaidOver, + PoolId: poolId, } } diff --git a/x/incentives/types/msgs_test.go b/x/incentives/types/msgs_test.go index ef9617a60d6..9b94907f645 100644 --- a/x/incentives/types/msgs_test.go +++ b/x/incentives/types/msgs_test.go @@ -39,6 +39,7 @@ func TestMsgCreateGauge(t *testing.T) { sdk.Coins{}, time.Now(), 2, + 0, ) return after(properMsg)