getter.gno
2.41 Kb ยท 80 lines
1package v1
2
3// GetDevOpsPct returns the percentage allocated to devOps.
4func (pf *protocolFeeV1) GetDevOpsPct() int64 {
5 return pf.getProtocolFeeState().DevOpsPct()
6}
7
8// GetGovStakerPct returns the percentage allocated to gov/staker.
9func (pf *protocolFeeV1) GetGovStakerPct() int64 {
10 return pf.getProtocolFeeState().GovStakerPct()
11}
12
13// GetTokenListWithAmount returns the token path and amount.
14func (pf *protocolFeeV1) GetTokenListWithAmount() map[string]int64 {
15 return pf.getProtocolFeeState().TokenListWithAmounts()
16}
17
18// GetTokenList returns the list of token paths without amounts.
19func (pf *protocolFeeV1) GetTokenList() []string {
20 tokenListWithAmount := pf.getProtocolFeeState().TokenListWithAmounts()
21 tokens := make([]string, 0, len(tokenListWithAmount))
22 for token := range tokenListWithAmount {
23 tokens = append(tokens, token)
24 }
25
26 return tokens
27}
28
29// GetAmountOfToken returns the amount of token.
30func (pf *protocolFeeV1) GetAmountOfToken(tokenPath string) int64 {
31 amount, exists := pf.getProtocolFeeState().TokenListWithAmounts()[tokenPath]
32 if !exists {
33 return 0
34 }
35 return amount
36}
37
38// GetAccuTransfersToGovStaker returns all accumulated transfers to gov/staker.
39func (pf *protocolFeeV1) GetAccuTransfersToGovStaker() map[string]int64 {
40 accuTransfers := make(map[string]int64)
41
42 pf.getProtocolFeeState().AccuToGovStaker().Iterate("", "", func(key string, value any) bool {
43 amount, ok := value.(int64)
44 if !ok {
45 return false
46 }
47
48 accuTransfers[key] = amount
49 return false
50 })
51
52 return accuTransfers
53}
54
55// GetAccuTransfersToDevOps returns all accumulated transfers to devOps.
56func (pf *protocolFeeV1) GetAccuTransfersToDevOps() map[string]int64 {
57 accuTransfers := make(map[string]int64)
58
59 pf.getProtocolFeeState().AccuToDevOps().Iterate("", "", func(key string, value any) bool {
60 amount, ok := value.(int64)
61 if !ok {
62 return false
63 }
64
65 accuTransfers[key] = amount
66 return false
67 })
68
69 return accuTransfers
70}
71
72// GetAccuTransferToGovStakerByTokenPath returns the accumulated transfer to gov/staker by token path.
73func (pf *protocolFeeV1) GetAccuTransferToGovStakerByTokenPath(path string) int64 {
74 return pf.getProtocolFeeState().GetAccuTransferToGovStakerByTokenPath(path)
75}
76
77// GetAccuTransferToDevOpsByTokenPath returns the accumulated transfer to devOps by token path.
78func (pf *protocolFeeV1) GetAccuTransferToDevOpsByTokenPath(path string) int64 {
79 return pf.getProtocolFeeState().GetAccuTransferToDevOpsByTokenPath(path)
80}