Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
osmosis
Commits
c1015b6c
Unverified
Commit
c1015b6c
authored
3 years ago
by
Matt, Park
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Change genesis for x/incentives (#837)
parent
cc02e031
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
proto/osmosis/incentives/genesis.proto
+1
-0
proto/osmosis/incentives/genesis.proto
x/incentives/keeper/gauge.go
+2
-2
x/incentives/keeper/gauge.go
x/incentives/keeper/store.go
+4
-4
x/incentives/keeper/store.go
x/incentives/types/genesis.pb.go
+58
-21
x/incentives/types/genesis.pb.go
with
65 additions
and
27 deletions
+65
-27
proto/osmosis/incentives/genesis.proto
+
1
-
0
View file @
c1015b6c
...
...
@@ -18,4 +18,5 @@ message GenesisState {
(
gogoproto.stdduration
)
=
true
,
(
gogoproto.moretags
)
=
"yaml:\"
lockable_durations
\
""
];
uint64
last_gauge_id
=
4
;
}
This diff is collapsed.
Click to expand it.
x/incentives/keeper/gauge.go
+
2
-
2
View file @
c1015b6c
...
...
@@ -115,7 +115,7 @@ func (k Keeper) CreateGauge(ctx sdk.Context, isPerpetual bool, owner sdk.AccAddr
}
gauge
:=
types
.
Gauge
{
Id
:
k
.
g
etLastGaugeID
(
ctx
)
+
1
,
Id
:
k
.
G
etLastGaugeID
(
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
.
s
etLastGaugeID
(
ctx
,
gauge
.
Id
)
k
.
S
etLastGaugeID
(
ctx
,
gauge
.
Id
)
// TODO: Do we need to be concerned with case where this should be ActiveGauges?
combinedKeys
:=
combineKeys
(
types
.
KeyPrefixUpcomingGauges
,
getTimeKey
(
gauge
.
StartTime
))
...
...
This diff is collapsed.
Click to expand it.
x/incentives/keeper/store.go
+
4
-
4
View file @
c1015b6c
...
...
@@ -8,8 +8,8 @@ import (
"github.com/osmosis-labs/osmosis/x/incentives/types"
)
//
g
etLastGaugeID returns ID used last time
func
(
k
Keeper
)
g
etLastGaugeID
(
ctx
sdk
.
Context
)
uint64
{
//
G
etLastGaugeID returns ID used last time
func
(
k
Keeper
)
G
etLastGaugeID
(
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
)
}
//
s
etLastGaugeID save ID used by last gauge
func
(
k
Keeper
)
s
etLastGaugeID
(
ctx
sdk
.
Context
,
ID
uint64
)
{
//
S
etLastGaugeID save ID used by last gauge
func
(
k
Keeper
)
S
etLastGaugeID
(
ctx
sdk
.
Context
,
ID
uint64
)
{
store
:=
ctx
.
KVStore
(
k
.
storeKey
)
store
.
Set
(
types
.
KeyLastGaugeID
,
sdk
.
Uint64ToBigEndian
(
ID
))
}
...
...
This diff is collapsed.
Click to expand it.
x/incentives/types/genesis.pb.go
+
58
-
21
View file @
c1015b6c
...
...
@@ -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
,
0xba
,
0x30
,
0xa0
,
0xb2
,
0xb1
,
0x20
,
0xa7
,
0x18
,
0x63
,
0x91
,
0xe4
,
0x54
,
0x3d
,
0x0e
,
0xa2
,
0x6f
,
0xc1
,
0xc8
,
0x23
,
0x75
,
0xec
,
0xc8
,
0x54
,
0x50
,
0xfb
,
0x06
,
0x7d
,
0x02
,
0xd4
,
0xd8
,
0x16
,
0x48
,
0xcd
,
0x96
,
0xa3
,
0xff
,
0x3b
,
0x5f
,
0x7e
,
0x9f
,
0xb8
,
0x07
,
0x98
,
0x03
,
0x1a
,
0x14
,
0xa6
,
0x98
,
0xaa
,
0xc2
,
0x9a
,
0x57
,
0x85
,
0x42
,
0xab
,
0x42
,
0xa1
,
0x41
,
0x3e
,
0x9b
,
0x83
,
0x05
,
0x4a
,
0x3d
,
0xc1
,
0x7f
,
0x89
,
0xee
,
0x89
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
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
,
0xb9
,
0x00
,
0x05
,
0x74
,
0xbe
,
0xd0
,
0x46
,
0x63
,
0x5c
,
0x13
,
0xf4
,
0x97
,
0xe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
,
0x42
,
0xfd
,
0xd6
,
0xb8
,
0x53
,
0x7e
,
0xda
,
0x80
,
0xd7
,
0xb3
,
0xe1
,
0xcd
,
0x6a
,
0x4b
,
0xd0
,
0x7a
,
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
:
])
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment