Unverified Commit c1015b6c authored by Matt, Park's avatar Matt, Park Committed by GitHub
Browse files

Change genesis for x/incentives (#837)

parent cc02e031
main 1386-twap-architecture 1657-remove-version-paths 479-module-airdrops 7.0.2-query-undelegations EstimateSwap Thunnini/superfluid-remove-multiplier-url Thunnini/temp adam/cl adam/csv-test adam/e2e-v11-patch adam/export-time-patch adam/gauge-debug adam/incentives-audit adam/main-e2e-fixes adam/sf-sim-update adam/sf-tests adam/sf-tests-4 adam/sim-db adam/sim-invariant-probability adam/temp adam/temp-v11-pool-incentive-patch adam/twap-three-asset-pool adam/txfees-simp-2 adam/v10.0.0-testnet adam/v11-gauge-incentive adam/v11-ica-export-patch adam/v12-module-export adam/v12.x-recut adam/v13-handler adam/v8.x-new-init add-noswap-return alpo/stableswap-scaling-meta anmol/epoch-mod anmol/gamm-hooks-refactor anmol/incentives-hooks-refactor anmol/lockup-hooks-refactor anmol/mint-hooks-refactor applyfuncifnoerr babswap bez/1225-pool-api-refactor bez/2100-lower-e2e-precommit-timeout bez/3059-tick-bitmap-impl bez/end-block-ordering-debug bounded-term-solver burn-bindings cfmm-binary ci-fix-forceprune concentrated-liquidity concentrated-liquidity-main destroy-synthetic-locks dev/add_single_asset_leave_test dev/change_balancer_msg_servicename dev/debug dev/debug_chain_halt dev/delete_rest_handlers dev/distribution_tests dev/expand_inverse_bug dev/fix_out_of_gas_panic_recov dev/gamm_interface_experiments dev/merge_steps dev/move_gov dev/propertycheck_wip dev/querygen dev/scrapped_changes dev/setup_mainnet_pool dev/superfluid_spec dev/tmp dev/tmp_things dev/try_to_make_issue_add_on_fork_pass dev/v12_with_fix dev/v7-epoch-speedup e2e-concentrated enable-gamm-inverse-test enable-pool-test epoch_gomod epochs-module eugen/superfluid_test_scaffolding_updates faddat/46-for-fun faddat/app-version faddat/badger-v-3 faddat/badgerdb faddat/endblock-test faddat/fast-tmdb faddat/ghcr-osmo-docker-proto faddat/golangci faddat/ibc331 faddat/ledger-cosmos-go faddat/linters faddat/liveness-only-main faddat/mainline-iavl faddat/osmotime faddat/pebble faddat/remove-claim faddat/remove-usages faddat/rocksv7 faddat/v12-linting faddat/worked-for-no-reason faddat/zeroconf feat/add-permissionless-wasm-to-testnetify fix/testnetify-interchain-accounts full fullpowered-tokenfactory genesis_upgrade_and_add_invariant grpcquery-gamm hackatom-seoul hackatom/seoul hyehan/tallycache ibc-rate-limit init-genesis-testnet-hack joeabbey/v7.0.0-starving-waiters-pprofd joeabbey/v7.0.3-starving-waiters lostak/arbTx lostak/swapFeeForTx/v1 lostak/swapFeeForTx/v2 lostak/swapFeeForTx/v2.0.2 lostak/sybilFee/joinExit lostak/sybilFee/onlySwaps lostak/sybilFee/swap mattverse-cl-4-fix-zero-for-one mattverse/audit-lockup mattverse/change-wasmd-version mattverse/ci-test mattverse/cl-4-slippage mattverse/cl-store mattverse/cleanup-pools mattverse/dag mattverse/debug-chain-halt mattverse/estimate-swap mattverse/fix-codec mattverse/fix-gamm-codec mattverse/fix-lp-logic mattverse/fuzz-inverse mattverse/join-calculation mattverse/proto-gen mattverse/refactor-lock mattverse/revert-errors mattverse/sp mattverse/superfluid mattverse/superfluid-delegation-fix mattverse/superfluid-remove-multiplier-url mattverse/tokenfactory-audit-2 mattverse/twap-go-bindings mattverse/unify-prices mattverse/unpool mattverse/v7.0.1-add-query mattverse/whitelist-stargate-queries mconcat/disc4864-action4-unpool-ust mconcat/routing-module mergify/bp/v11.x/pr-2322 mergify/bp/v12.x/pr-2619 mergify/bp/v12.x/pr-3179 msg-filter-cleanup msg_server_test multihop-events mutesting-changes nicolas/concentrated-liquidity-fees nicolas/crosschain-swaps nicolas/ibc-rate-limit-integration-and-tests nicolas/ibc-receiver-field-cap nicolas/ica-message-updates-e2e-test nicolas/metadata-decoding-test nicolas/rate-limiting-experiments nicolas/rate-limiting-upgrade-handler osmolbp query_testing refactor-estimate-swap remove-isactive revert-1991-mattverse/superfluid revert-2802-binary-search-cfmm revert_fixed_gas_cost roman/1196 roman/calcjoinpoolshares-single-tokenin roman/cl-spec roman/cosmwasm-v0.26.0 roman/e2e-chaininit-refactor roman/e2e-debug roman/e2e-state-sync roman/e2e-test-tm roman/fix-proto roman/gamm-events roman/generalize-docker roman/handler roman/joinpoolnoswap roman/markdown-linter roman/mint-backport-1 roman/mint-keeper-audit roman/mint-refactor roman/mint-rounding roman/mint-rounding-part1 roman/mint-rounding-pt3-indexes roman/mint-rounding-year2-isolation roman/mint-truncations-adr roman/msg-tx-fees roman/no-swap-ss-abstractions roman/pool-id-refactor roman/pool-id-refactor-pt1 roman/project-automation roman/remaining-check-spike roman/revert-mint roman/run-make-proto-all-bez roman/scaling-factors2 roman/share roman/state-sync-refactor2 roman/state-sync-refactor2-v8 roman/test roman/test-pr-add roman/test-randomized-ratios roman/update-package-paths-main roman/update-paths roman/upgrade-handler-test roman/v10-imports roman/v11.x-unfork-iavl roman/v7.x sis/nft-factory sis/val-set-pref sis/valSet-setValMsg specific_err_in_test stackman27-patch-1 stargate_white_list sunny-halfswapfees sunny-improve-superfluid-tests sunny/mint-coins sunny/more-stargate-whitelist-queries sunny/pool-type-wasm sunny/set-supply-offset sunny/tokenfactory-addbackforce sunny/tokenfactory-beforesend sunny/tokenfactory-blacklist sunny/tokenfactory-supplyoffset superfluid-update-test-err test-docs testting_epochs tokenfactory-audit try_using_app_hash twap-hook-test twap_spot_price_err unit-test-joins update-paths-0hdkvr6 update-paths-ariwqcu update-paths-jcjqt64 update-paths-wvaefcn update_record_sanity_check update_twap_response usdc-testing use-beginblocker-for-apptesting v1 v10.x v11.x v12.2.x v12.x v13.x v7-integrators v7.0.2-is-the-new-v7.0.1 v7.0.3-changelog v7.x v7.x-lockup-invariant-gamm-invariant-disable v7.x-lockup-invariant2-gamm-invariant-disable v7.x-lockup-invariant3-gamm-invariant-disable v7.x-superfluid-invariant-enable-gamm-invariant-disable v8.x v9.x v9.x-old val-set-pref valSet-ReDel-v2 wasm-custom-tests weird-case-getmoduletodistributecoin xiangan/binarytest xiangan/chainschema xiangan/refactor xiangan/tests 12.1.0 v12.2.0 v12.1.0 v12.0.0 v12.0.0-rc5 v12.0.0-rc4 v12.0.0-rc3 v12.0.0-rc2 v12.0.0-rc1 v12.0.0-rc0 v11.0.1 v11.0.0 v10.2.0 v10.1.1 v10.1.0 v10.0.1 v10.0.0 v10.0.0-testnet v10.0.0-rc0 v9.0.0 v9.0.0-rc0 v8.0.1 v8.0.0 v8.0.0-rc2 v8.0.0-rc1 v8.0.0-rc0 v7.3.0 v7.2.1 v7.2.0 v7.1.0 v7.0.4 v7.0.3 v7.0.2 v7.0.1 v7.0.0 v7.0.0-rc0 v7.0.0-alpha-2 v7.0.0-alpha-1 v7.0.0-alpha-0 v7-pprof-1 v7-int twap-rc0
No related merge requests found
Showing with 65 additions and 27 deletions
+65 -27
......@@ -18,4 +18,5 @@ message GenesisState {
(gogoproto.stdduration) = true,
(gogoproto.moretags) = "yaml:\"lockable_durations\""
];
uint64 last_gauge_id = 4;
}
......@@ -115,7 +115,7 @@ func (k Keeper) CreateGauge(ctx sdk.Context, isPerpetual bool, owner sdk.AccAddr
}
gauge := types.Gauge{
Id: k.getLastGaugeID(ctx) + 1,
Id: k.GetLastGaugeID(ctx) + 1,
IsPerpetual: isPerpetual,
DistributeTo: distrTo,
Coins: coins,
......@@ -131,7 +131,7 @@ func (k Keeper) CreateGauge(ctx sdk.Context, isPerpetual bool, owner sdk.AccAddr
if err != nil {
return 0, err
}
k.setLastGaugeID(ctx, gauge.Id)
k.SetLastGaugeID(ctx, gauge.Id)
// TODO: Do we need to be concerned with case where this should be ActiveGauges?
combinedKeys := combineKeys(types.KeyPrefixUpcomingGauges, getTimeKey(gauge.StartTime))
......
......@@ -8,8 +8,8 @@ import (
"github.com/osmosis-labs/osmosis/x/incentives/types"
)
// getLastGaugeID returns ID used last time
func (k Keeper) getLastGaugeID(ctx sdk.Context) uint64 {
// GetLastGaugeID returns ID used last time
func (k Keeper) GetLastGaugeID(ctx sdk.Context) uint64 {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.KeyLastGaugeID)
......@@ -20,8 +20,8 @@ func (k Keeper) getLastGaugeID(ctx sdk.Context) uint64 {
return sdk.BigEndianToUint64(bz)
}
// setLastGaugeID save ID used by last gauge
func (k Keeper) setLastGaugeID(ctx sdk.Context, ID uint64) {
// SetLastGaugeID save ID used by last gauge
func (k Keeper) SetLastGaugeID(ctx sdk.Context, ID uint64) {
store := ctx.KVStore(k.storeKey)
store.Set(types.KeyLastGaugeID, sdk.Uint64ToBigEndian(ID))
}
......
......@@ -33,6 +33,7 @@ type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
Gauges []Gauge `protobuf:"bytes,2,rep,name=gauges,proto3" json:"gauges"`
LockableDurations []time.Duration `protobuf:"bytes,3,rep,name=lockable_durations,json=lockableDurations,proto3,stdduration" json:"lockable_durations" yaml:"lockable_durations"`
LastGaugeId uint64 `protobuf:"varint,4,opt,name=last_gauge_id,json=lastGaugeId,proto3" json:"last_gauge_id,omitempty"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
......@@ -89,6 +90,13 @@ func (m *GenesisState) GetLockableDurations() []time.Duration {
return nil
}
func (m *GenesisState) GetLastGaugeId() uint64 {
if m != nil {
return m.LastGaugeId
}
return 0
}
func init() {
proto.RegisterType((*GenesisState)(nil), "osmosis.incentives.GenesisState")
}
......@@ -96,27 +104,29 @@ func init() {
func init() { proto.RegisterFile("osmosis/incentives/genesis.proto", fileDescriptor_a288ccc95d977d2d) }
var fileDescriptor_a288ccc95d977d2d = []byte{
// 312 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4e, 0xeb, 0x30,
0x14, 0x86, 0xe3, 0xdb, 0xab, 0x0e, 0x29, 0x0b, 0x16, 0x43, 0xdb, 0xc1, 0xa9, 0x2a, 0x21, 0x75,
0xc1, 0x96, 0xca, 0x00, 0x62, 0xac, 0x90,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0x7b, 0x62, 0x74, 0xba, 0x97, 0xec, 0xd6, 0x49, 0x67, 0x21, 0xf3, 0xec, 0xaa, 0x7f, 0xa8, 0xe8,
0x7f, 0x7c, 0x25, 0x64, 0x72, 0x1c, 0x82, 0xb0, 0x88, 0xa3, 0x9b, 0xe5, 0x86, 0x91, 0xd5, 0x86,
0x91, 0xef, 0x0d, 0x23, 0xef, 0x5b, 0x16, 0xad, 0xb6, 0x2c, 0xfa, 0xdc, 0xb2, 0xe8, 0x7e, 0xa8,
0x8d, 0x7d, 0x2e, 0x53, 0x3e, 0x85, 0x5c, 0xf8, 0xf6, 0x67, 0x99, 0x4c, 0x31, 0x0c, 0xe2, 0xed,
0xef, 0x21, 0xed, 0x62, 0xa6, 0x30, 0x6d, 0x56, 0xd5, 0xce, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff,
0x8b, 0x2e, 0x6a, 0x36, 0xf8, 0x01, 0x00, 0x00,
// 338 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4e, 0xfb, 0x30,
0x10, 0xc6, 0xe3, 0xb6, 0xea, 0x90, 0xfe, 0xff, 0x03, 0x16, 0x43, 0xda, 0xc1, 0x89, 0x22, 0x21,
0x75, 0xc1, 0x96, 0xca, 0x00, 0x62, 0xac, 0x90, 0x2a, 0x24, 0x06, 0x54, 0x36, 0x96, 0xca, 0x69,
0x8d, 0xb1, 0x48, 0xe2, 0xaa, 0xe7, 0x20, 0xfa, 0x16, 0x4c, 0x88, 0x47, 0xea, 0xd8, 0x91, 0xa9,
0xa0, 0xf6, 0x0d, 0x78, 0x02, 0x14, 0x27, 0x16, 0x48, 0xed, 0xe6, 0xf3, 0xf7, 0xbb, 0xef, 0xbe,
0x3b, 0x3f, 0xd2, 0x90, 0x69, 0x50, 0xc0, 0x54, 0x3e, 0x15, 0xb9, 0x51, 0xcf, 0x02, 0x98, 0x14,
0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x7a, 0x4b, 0xd0, 0xd7, 0x96, 0xa0, 0xd7, 0x1d,
0xf1, 0xd6, 0x3b, 0xe2, 0x7d, 0xec, 0x88, 0x77, 0x3f, 0x90, 0xca, 0x3c, 0x16, 0x09, 0x9d, 0xea,
0x8c, 0xd5, 0x1b, 0x9e, 0xa6, 0x3c, 0x01, 0x57, 0xb0, 0x97, 0xbf, 0xc7, 0x36, 0xcb, 0xb9, 0x80,
0xa4, 0x6d, 0xe3, 0x9f, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0x72, 0xa5, 0x7b, 0x3a, 0x1c, 0x02,
0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
......@@ -139,6 +149,11 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.LastGaugeId != 0 {
i = encodeVarintGenesis(dAtA, i, uint64(m.LastGaugeId))
i--
dAtA[i] = 0x20
}
if len(m.LockableDurations) > 0 {
for iNdEx := len(m.LockableDurations) - 1; iNdEx >= 0; iNdEx-- {
n, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LockableDurations[iNdEx], dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LockableDurations[iNdEx]):])
......@@ -209,6 +224,9 @@ func (m *GenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
}
}
if m.LastGaugeId != 0 {
n += 1 + sovGenesis(uint64(m.LastGaugeId))
}
return n
}
......@@ -348,6 +366,25 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastGaugeId", wireType)
}
m.LastGaugeId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LastGaugeId |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment