Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
osmosis
Commits
0c763956
Commit
0c763956
authored
3 years ago
by
ValarDragon
Browse files
Options
Download
Email Patches
Plain Diff
Fix InitGenesis bug for gauges
parent
f47c64f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
x/incentives/keeper/gauge.go
+6
-0
x/incentives/keeper/gauge.go
x/incentives/keeper/store.go
+1
-1
x/incentives/keeper/store.go
with
7 additions
and
1 deletion
+7
-1
x/incentives/keeper/gauge.go
+
6
-
0
View file @
0c763956
...
...
@@ -93,10 +93,16 @@ func (k Keeper) SetGaugeWithRefKey(ctx sdk.Context, gauge *types.Gauge) error {
if
err
:=
k
.
addGaugeRefByKey
(
ctx
,
combineKeys
(
types
.
KeyPrefixUpcomingGauges
,
timeKey
),
gauge
.
Id
);
err
!=
nil
{
return
err
}
if
err
:=
k
.
addGaugeIDForDenom
(
ctx
,
gauge
.
Id
,
gauge
.
DistributeTo
.
Denom
);
err
!=
nil
{
return
err
}
}
else
if
gauge
.
IsActiveGauge
(
curTime
)
{
if
err
:=
k
.
addGaugeRefByKey
(
ctx
,
combineKeys
(
types
.
KeyPrefixActiveGauges
,
timeKey
),
gauge
.
Id
);
err
!=
nil
{
return
err
}
if
err
:=
k
.
addGaugeIDForDenom
(
ctx
,
gauge
.
Id
,
gauge
.
DistributeTo
.
Denom
);
err
!=
nil
{
return
err
}
}
else
{
if
err
:=
k
.
addGaugeRefByKey
(
ctx
,
combineKeys
(
types
.
KeyPrefixFinishedGauges
,
timeKey
),
gauge
.
Id
);
err
!=
nil
{
return
err
...
...
This diff is collapsed.
Click to expand it.
x/incentives/keeper/store.go
+
1
-
1
View file @
0c763956
...
...
@@ -71,7 +71,7 @@ func (k Keeper) deleteGaugeRefByKey(ctx sdk.Context, key []byte, gaugeID uint64)
gaugeIDs
:=
k
.
getGaugeRefs
(
ctx
,
key
)
gaugeIDs
,
index
:=
removeValue
(
gaugeIDs
,
gaugeID
)
if
index
<
0
{
return
fmt
.
Errorf
(
"specific gauge with ID %d not found"
,
gaugeID
)
return
fmt
.
Errorf
(
"specific gauge with ID %d not found
by reference %s
"
,
gaugeID
,
key
)
}
if
len
(
gaugeIDs
)
==
0
{
store
.
Delete
(
key
)
...
...
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
Menu
Explore
Projects
Groups
Snippets