Skip to content

Commit

Permalink
GSW-1844 refactor: query distributed amount for each targets (#449)
Browse files Browse the repository at this point in the history
* fix: make setter to private
* feat: if amount did not distributed 100%, save for distributing it next time
* feat: map to avl.Tree
* feat: MintAndDistributeGns returns distributed amount
* feat: getter for each target's distributed and accu distributed amount
  • Loading branch information
r3v4s authored Dec 27, 2024
1 parent a055c68 commit cc944ee
Show file tree
Hide file tree
Showing 10 changed files with 821 additions and 391 deletions.
44 changes: 44 additions & 0 deletions emission/_test_helper.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package emission

import (
"std"
"strconv"
"testing"

"gno.land/p/demo/avl"

"gno.land/r/gnoswap/v1/consts"
"gno.land/r/gnoswap/v1/gns"
)

var (
adminRealm = std.NewUserRealm(consts.ADMIN)
stakerRealm = std.NewCodeRealm(consts.STAKER_PATH)
govRealm = std.NewCodeRealm(consts.GOV_GOVERNANCE_PATH)
govStakerRealm = std.NewCodeRealm(consts.GOV_STAKER_PATH)
)

func resetObject(t *testing.T) {
t.Helper()

distributionBpsPct = avl.NewTree()
distributionBpsPct.Set(strconv.Itoa(LIQUIDITY_STAKER), 7500)
distributionBpsPct.Set(strconv.Itoa(DEVOPS), 2000)
distributionBpsPct.Set(strconv.Itoa(COMMUNITY_POOL), 500)
distributionBpsPct.Set(strconv.Itoa(GOV_STAKER), 0)

distributedToStaker = 0
distributedToDevOps = 0
distributedToCommunityPool = 0
distributedToGovStaker = 0
accuDistributedToStaker = 0
accuDistributedToDevOps = 0
accuDistributedToCommunityPool = 0
accuDistributedToGovStaker = 0
}

func gnsBalance(t *testing.T, addr std.Address) uint64 {
t.Helper()

return gns.BalanceOf(a2u(addr))
}
Loading

0 comments on commit cc944ee

Please sign in to comment.