Skip to content

Commit cc944ee

Browse files
authored
GSW-1844 refactor: query distributed amount for each targets (#449)
* 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
1 parent a055c68 commit cc944ee

File tree

10 files changed

+821
-391
lines changed

10 files changed

+821
-391
lines changed

emission/_test_helper.gno

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package emission
2+
3+
import (
4+
"std"
5+
"strconv"
6+
"testing"
7+
8+
"gno.land/p/demo/avl"
9+
10+
"gno.land/r/gnoswap/v1/consts"
11+
"gno.land/r/gnoswap/v1/gns"
12+
)
13+
14+
var (
15+
adminRealm = std.NewUserRealm(consts.ADMIN)
16+
stakerRealm = std.NewCodeRealm(consts.STAKER_PATH)
17+
govRealm = std.NewCodeRealm(consts.GOV_GOVERNANCE_PATH)
18+
govStakerRealm = std.NewCodeRealm(consts.GOV_STAKER_PATH)
19+
)
20+
21+
func resetObject(t *testing.T) {
22+
t.Helper()
23+
24+
distributionBpsPct = avl.NewTree()
25+
distributionBpsPct.Set(strconv.Itoa(LIQUIDITY_STAKER), 7500)
26+
distributionBpsPct.Set(strconv.Itoa(DEVOPS), 2000)
27+
distributionBpsPct.Set(strconv.Itoa(COMMUNITY_POOL), 500)
28+
distributionBpsPct.Set(strconv.Itoa(GOV_STAKER), 0)
29+
30+
distributedToStaker = 0
31+
distributedToDevOps = 0
32+
distributedToCommunityPool = 0
33+
distributedToGovStaker = 0
34+
accuDistributedToStaker = 0
35+
accuDistributedToDevOps = 0
36+
accuDistributedToCommunityPool = 0
37+
accuDistributedToGovStaker = 0
38+
}
39+
40+
func gnsBalance(t *testing.T, addr std.Address) uint64 {
41+
t.Helper()
42+
43+
return gns.BalanceOf(a2u(addr))
44+
}

0 commit comments

Comments
 (0)