getters.gno
6.61 Kb ยท 171 lines
1package staker
2
3import (
4 u256 "gno.land/p/gnoswap/uint256"
5)
6
7// GetTotalxGnsSupply returns the total supply of xGNS tokens.
8func GetTotalxGnsSupply() int64 {
9 return getImplementation().GetTotalxGnsSupply()
10}
11
12// GetTotalDelegated returns the total amount of GNS delegated.
13func GetTotalDelegated() int64 {
14 return getImplementation().GetTotalDelegated()
15}
16
17// GetTotalLockedAmount returns the total amount of GNS locked in undelegation.
18func GetTotalLockedAmount() int64 {
19 return getImplementation().GetTotalLockedAmount()
20}
21
22// GetLockedAmount returns the total locked GNS amount.
23func GetLockedAmount() int64 {
24 return getImplementation().GetLockedAmount()
25}
26
27// GetUnDelegationLockupPeriod returns the undelegation lockup period in seconds.
28func GetUnDelegationLockupPeriod() int64 {
29 return getImplementation().GetUnDelegationLockupPeriod()
30}
31
32// GetEmissionRewardBalance returns the current emission reward balance.
33func GetEmissionRewardBalance() int64 {
34 return getImplementation().GetEmissionRewardBalance()
35}
36
37// GetDelegationCount returns the total number of delegations.
38func GetDelegationCount() int {
39 return getImplementation().GetDelegationCount()
40}
41
42// GetDelegationIDs returns a paginated list of delegation IDs.
43func GetDelegationIDs(offset, count int) []int64 {
44 return getImplementation().GetDelegationIDs(offset, count)
45}
46
47// ExistsDelegation checks if a delegation exists.
48func ExistsDelegation(delegationID int64) bool {
49 return getImplementation().ExistsDelegation(delegationID)
50}
51
52// GetDelegation returns the delegation for the given ID.
53func GetDelegation(delegationID int64) (*Delegation, error) {
54 delegation, err := getImplementation().GetDelegation(delegationID)
55 if err != nil {
56 return nil, err
57 }
58 return delegation.Clone(), nil
59}
60
61// GetDelegatorDelegateeCount returns the number of delegatees for a specific delegator.
62func GetDelegatorDelegateeCount(delegator address) int {
63 return getImplementation().GetDelegatorDelegateeCount(delegator)
64}
65
66// GetDelegatorDelegateeAddresses returns a paginated list of delegatee addresses for a specific delegator.
67func GetDelegatorDelegateeAddresses(delegator address, offset, count int) []address {
68 return getImplementation().GetDelegatorDelegateeAddresses(delegator, offset, count)
69}
70
71// GetUserDelegationCount returns the number of delegations for a specific delegator-delegatee pair.
72func GetUserDelegationCount(delegator address, delegatee address) int {
73 return getImplementation().GetUserDelegationCount(delegator, delegatee)
74}
75
76// GetUserDelegationIDs returns a list of delegation IDs for a specific delegator-delegatee pair.
77func GetUserDelegationIDs(delegator address, delegatee address) []int64 {
78 return getImplementation().GetUserDelegationIDs(delegator, delegatee)
79}
80
81// HasDelegationSnapshotsKey returns true if delegation history exists.
82func HasDelegationSnapshotsKey() bool {
83 return getImplementation().HasDelegationSnapshotsKey()
84}
85
86// GetTotalDelegationAmountAtSnapshot returns the total delegation amount at a specific snapshot time.
87func GetTotalDelegationAmountAtSnapshot(snapshotTime int64) (int64, bool) {
88 return getImplementation().GetTotalDelegationAmountAtSnapshot(snapshotTime)
89}
90
91// GetUserDelegationAmountAtSnapshot returns the user delegation amount at a specific snapshot time.
92func GetUserDelegationAmountAtSnapshot(userAddr address, snapshotTime int64) (int64, bool) {
93 return getImplementation().GetUserDelegationAmountAtSnapshot(userAddr, snapshotTime)
94}
95
96// GetClaimableRewardByAddress returns claimable rewards for an address.
97//
98// Returns:
99// - int64: emission reward amount
100// - map[string]int64: protocol fee rewards by token path
101func GetClaimableRewardByAddress(addr address) (int64, map[string]int64, error) {
102 return getImplementation().GetClaimableRewardByAddress(addr)
103}
104
105// GetClaimableRewardByLaunchpad returns claimable launchpad rewards for an address.
106//
107// Returns:
108// - int64: emission reward amount
109// - map[string]int64: protocol fee rewards by token path
110func GetClaimableRewardByLaunchpad(addr address) (int64, map[string]int64, error) {
111 return getImplementation().GetClaimableRewardByLaunchpad(addr)
112}
113
114// GetClaimableRewardByRewardID returns claimable reward details by reward ID.
115//
116// Returns:
117// - int64: emission reward amount
118// - map[string]int64: protocol fee rewards by token path
119func GetClaimableRewardByRewardID(rewardID string) (int64, map[string]int64, error) {
120 return getImplementation().GetClaimableRewardByRewardID(rewardID)
121}
122
123// GetLaunchpadProjectDeposit returns the deposit amount for a launchpad project.
124func GetLaunchpadProjectDeposit(projectAddr string) (int64, bool) {
125 return getImplementation().GetLaunchpadProjectDeposit(projectAddr)
126}
127
128// GetDelegationWithdrawCount returns the total number of delegation withdraws for a specific delegation.
129func GetDelegationWithdrawCount(delegationID int64) int {
130 return getImplementation().GetDelegationWithdrawCount(delegationID)
131}
132
133// GetDelegationWithdraws returns a paginated list of delegation withdraws for a specific delegation.
134func GetDelegationWithdraws(delegationID int64, offset, count int) ([]*DelegationWithdraw, error) {
135 return getImplementation().GetDelegationWithdraws(delegationID, offset, count)
136}
137
138// GetCollectableWithdrawAmount returns the collectable withdraw amount for a specific delegation.
139func GetCollectableWithdrawAmount(delegationID int64) int64 {
140 return getImplementation().GetCollectableWithdrawAmount(delegationID)
141}
142
143// GetProtocolFeeAccumulatedX128PerStake returns the accumulated protocol fee per stake (Q128) for a token path.
144func GetProtocolFeeAccumulatedX128PerStake(tokenPath string) *u256.Uint {
145 return getImplementation().GetProtocolFeeAccumulatedX128PerStake(tokenPath).Clone()
146}
147
148// GetProtocolFeeAmount returns the protocol fee amounts for a token path.
149func GetProtocolFeeAmount(tokenPath string) int64 {
150 return getImplementation().GetProtocolFeeAmount(tokenPath)
151}
152
153// GetProtocolFeeAccumulatedTimestamp returns the accumulated timestamp for protocol fee rewards.
154func GetProtocolFeeAccumulatedTimestamp() int64 {
155 return getImplementation().GetProtocolFeeAccumulatedTimestamp()
156}
157
158// GetEmissionAccumulatedX128PerStake returns the accumulated emission per stake (Q128).
159func GetEmissionAccumulatedX128PerStake() *u256.Uint {
160 return getImplementation().GetEmissionAccumulatedX128PerStake().Clone()
161}
162
163// GetEmissionDistributedAmount returns the total distributed emission amount.
164func GetEmissionDistributedAmount() int64 {
165 return getImplementation().GetEmissionDistributedAmount()
166}
167
168// GetEmissionAccumulatedTimestamp returns the accumulated timestamp for emission rewards.
169func GetEmissionAccumulatedTimestamp() int64 {
170 return getImplementation().GetEmissionAccumulatedTimestamp()
171}