Skip to content

Commit

Permalink
Align stake level numbers between Solidity and GraphQL
Browse files Browse the repository at this point in the history
Levels are now always 0, 1, 2 in code.
  • Loading branch information
elffjs committed Jan 15, 2025
1 parent 147209e commit 5668171
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions graph/model/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions graph/schema/stakes.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ type Stake {
The owner of the license. A single owner can own multiple licenses.
"""
owner: Address!
"""
Level is the level of the stake. Presently the levels are 0, 1, 2. These translate
to Levels 2, 3, 4 in the DIP. See https://docs.dimo.org/governance/improvement-proposals/dip2
"""
level: Int!
points: Int!
amount: BigDecimal!
Expand Down
2 changes: 1 addition & 1 deletion internal/repositories/stake/stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func ToAPI(v *models.Stake) *gmodel.Stake {
return &gmodel.Stake{
TokenID: v.ID,
Owner: common.BytesToAddress(v.Owner),
Level: v.Level + 2, // TODO(elffjs): Is this what we want to do? https://docs.dimo.org/governance/amendments/dip2a4
Level: v.Level, // 0 in code corresponds to Level 2 in the DIP, and so on. Unfortunate. https://docs.dimo.org/governance/improvement-proposals/dip2
Points: v.Points,
Amount: weiToToken(v.Amount),
StakedAt: v.StakedAt,
Expand Down

0 comments on commit 5668171

Please sign in to comment.