getter.gno
13.74 Kb ยท 342 lines
1package staker
2
3import u256 "gno.land/p/gnoswap/uint256"
4
5// IStakerGetter functions
6
7// GetPool returns a copy of the pool for the given path.
8func GetPool(poolPath string) *Pool {
9 pool := getImplementation().GetPool(poolPath)
10 if pool == nil {
11 return nil
12 }
13 return pool.Clone()
14}
15
16// GetIncentive returns a copy of the incentive for the given pool and ID.
17func GetIncentive(poolPath string, incentiveId string) *ExternalIncentive {
18 incentive := getImplementation().GetIncentive(poolPath, incentiveId)
19 if incentive == nil {
20 return nil
21 }
22 return incentive.Clone()
23}
24
25// GetDeposit returns a copy of the deposit for the given position ID.
26func GetDeposit(lpTokenId uint64) *Deposit {
27 deposit := getImplementation().GetDeposit(lpTokenId)
28 if deposit == nil {
29 return nil
30 }
31 return deposit.Clone()
32}
33
34// CollectableEmissionReward returns the claimable internal reward amount.
35func CollectableEmissionReward(positionId uint64) int64 {
36 return getImplementation().CollectableEmissionReward(positionId)
37}
38
39// CollectableExternalIncentiveReward returns the claimable external reward amount.
40func CollectableExternalIncentiveReward(positionId uint64, incentiveId string) int64 {
41 return getImplementation().CollectableExternalIncentiveReward(positionId, incentiveId)
42}
43
44// GetCreatedHeightOfIncentive returns the block height when an incentive was created.
45func GetCreatedHeightOfIncentive(poolPath string, incentiveId string) int64 {
46 return getImplementation().GetCreatedHeightOfIncentive(poolPath, incentiveId)
47}
48
49// GetIncentiveCreatedTimestamp returns the creation timestamp of an incentive.
50func GetIncentiveCreatedTimestamp(poolPath string, incentiveId string) int64 {
51 return getImplementation().GetIncentiveCreatedTimestamp(poolPath, incentiveId)
52}
53
54// GetIncentiveTotalRewardAmount returns the total reward amount of an incentive.
55func GetIncentiveTotalRewardAmount(poolPath string, incentiveId string) int64 {
56 return getImplementation().GetIncentiveTotalRewardAmount(poolPath, incentiveId)
57}
58
59// GetIncentiveDistributedRewardAmount returns the distributed reward amount of an incentive.
60func GetIncentiveDistributedRewardAmount(poolPath string, incentiveId string) int64 {
61 return getImplementation().GetIncentiveDistributedRewardAmount(poolPath, incentiveId)
62}
63
64// GetIncentiveRemainingRewardAmount returns the remaining reward amount of an incentive.
65func GetIncentiveRemainingRewardAmount(poolPath string, incentiveId string) int64 {
66 return getImplementation().GetIncentiveRemainingRewardAmount(poolPath, incentiveId)
67}
68
69// GetIncentiveDepositGnsAmount returns the deposited GNS amount of an incentive.
70func GetIncentiveDepositGnsAmount(poolPath string, incentiveId string) int64 {
71 return getImplementation().GetIncentiveDepositGnsAmount(poolPath, incentiveId)
72}
73
74// GetIncentiveRefunded returns whether an incentive has been refunded.
75func GetIncentiveRefunded(poolPath string, incentiveId string) bool {
76 return getImplementation().GetIncentiveRefunded(poolPath, incentiveId)
77}
78
79// IsIncentiveActive returns whether an incentive is active.
80func IsIncentiveActive(poolPath string, incentiveId string) bool {
81 return getImplementation().IsIncentiveActive(poolPath, incentiveId)
82}
83
84// GetDepositExternalRewardLastCollectTimestamp returns the last external reward collection time for a position.
85func GetDepositExternalRewardLastCollectTimestamp(lpTokenId uint64, incentiveId string) int64 {
86 return getImplementation().GetDepositExternalRewardLastCollectTimestamp(lpTokenId, incentiveId)
87}
88
89// GetDepositGnsAmount returns the required GNS deposit amount for staking.
90func GetDepositGnsAmount() int64 {
91 return getImplementation().GetDepositGnsAmount()
92}
93
94// GetDepositInternalRewardLastCollectTimestamp returns the last internal reward collection time for a position.
95func GetDepositInternalRewardLastCollectTimestamp(lpTokenId uint64) int64 {
96 return getImplementation().GetDepositInternalRewardLastCollectTimestamp(lpTokenId)
97}
98
99// GetDepositCollectedInternalReward returns the collected internal reward amount of a position.
100func GetDepositCollectedInternalReward(lpTokenId uint64) int64 {
101 return getImplementation().GetDepositCollectedInternalReward(lpTokenId)
102}
103
104// GetDepositCollectedExternalReward returns the collected external reward amount of a position.
105func GetDepositCollectedExternalReward(lpTokenId uint64, incentiveId string) int64 {
106 return getImplementation().GetDepositCollectedExternalReward(lpTokenId, incentiveId)
107}
108
109// GetDepositLiquidity returns the liquidity amount of a staked position.
110func GetDepositLiquidity(lpTokenId uint64) *u256.Uint {
111 return getImplementation().GetDepositLiquidity(lpTokenId)
112}
113
114// GetDepositLiquidityAsString returns the liquidity amount of a staked position as string.
115func GetDepositLiquidityAsString(lpTokenId uint64) string {
116 return getImplementation().GetDepositLiquidityAsString(lpTokenId)
117}
118
119// GetDepositOwner returns the owner of a staked position.
120func GetDepositOwner(lpTokenId uint64) address {
121 return getImplementation().GetDepositOwner(lpTokenId)
122}
123
124// GetDepositStakeTime returns the staking duration of a position.
125func GetDepositStakeTime(lpTokenId uint64) int64 {
126 return getImplementation().GetDepositStakeTime(lpTokenId)
127}
128
129// GetDepositTargetPoolPath returns the pool path of a staked position.
130func GetDepositTargetPoolPath(lpTokenId uint64) string {
131 return getImplementation().GetDepositTargetPoolPath(lpTokenId)
132}
133
134// GetDepositTickLower returns the lower tick of a staked position.
135func GetDepositTickLower(lpTokenId uint64) int32 {
136 return getImplementation().GetDepositTickLower(lpTokenId)
137}
138
139// GetDepositTickUpper returns the upper tick of a staked position.
140func GetDepositTickUpper(lpTokenId uint64) int32 {
141 return getImplementation().GetDepositTickUpper(lpTokenId)
142}
143
144// GetDepositWarmUp returns the warmup records of a staked position.
145func GetDepositWarmUp(lpTokenId uint64) []Warmup {
146 return getImplementation().GetDepositWarmUp(lpTokenId)
147}
148
149// GetDepositExternalIncentiveIdList returns external incentive IDs for a deposit.
150func GetDepositExternalIncentiveIdList(lpTokenId uint64) []string {
151 return getImplementation().GetDepositExternalIncentiveIdList(lpTokenId)
152}
153
154// GetExternalIncentiveByPoolPath returns all external incentives for a pool.
155func GetExternalIncentiveByPoolPath(poolPath string) []ExternalIncentive {
156 return getImplementation().GetExternalIncentiveByPoolPath(poolPath)
157}
158
159// GetIncentiveEndTimestamp returns the end timestamp of an incentive.
160func GetIncentiveEndTimestamp(poolPath string, incentiveId string) int64 {
161 return getImplementation().GetIncentiveEndTimestamp(poolPath, incentiveId)
162}
163
164// GetIncentiveRefundee returns the refundee address of an incentive.
165func GetIncentiveRefundee(poolPath string, incentiveId string) address {
166 return getImplementation().GetIncentiveRefundee(poolPath, incentiveId)
167}
168
169// GetIncentiveRewardAmount returns the total reward amount of an incentive.
170func GetIncentiveRewardAmount(poolPath string, incentiveId string) *u256.Uint {
171 return getImplementation().GetIncentiveRewardAmount(poolPath, incentiveId)
172}
173
174// GetIncentiveRewardAmountAsString returns the total reward amount of an incentive as string.
175func GetIncentiveRewardAmountAsString(poolPath string, incentiveId string) string {
176 return getImplementation().GetIncentiveRewardAmountAsString(poolPath, incentiveId)
177}
178
179// GetIncentiveRewardPerSecond returns the reward rate per second of an incentive.
180func GetIncentiveRewardPerSecond(poolPath string, incentiveId string) int64 {
181 return getImplementation().GetIncentiveRewardPerSecond(poolPath, incentiveId)
182}
183
184// GetIncentiveRewardToken returns the reward token of an incentive.
185func GetIncentiveRewardToken(poolPath string, incentiveId string) string {
186 return getImplementation().GetIncentiveRewardToken(poolPath, incentiveId)
187}
188
189// GetIncentiveStartTimestamp returns the start timestamp of an incentive.
190func GetIncentiveStartTimestamp(poolPath string, incentiveId string) int64 {
191 return getImplementation().GetIncentiveStartTimestamp(poolPath, incentiveId)
192}
193
194// GetMinimumRewardAmount returns the minimum reward amount to distribute.
195func GetMinimumRewardAmount() int64 {
196 return getImplementation().GetMinimumRewardAmount()
197}
198
199// GetMinimumRewardAmountForToken returns the minimum reward amount for a specific token.
200func GetMinimumRewardAmountForToken(tokenPath string) int64 {
201 return getImplementation().GetMinimumRewardAmountForToken(tokenPath)
202}
203
204// GetPoolIncentiveIdList returns all incentive IDs for a pool.
205func GetPoolIncentiveIdList(poolPath string) []string {
206 return getImplementation().GetPoolIncentiveIdList(poolPath)
207}
208
209// GetPoolStakedLiquidity returns the current total staked liquidity of a pool.
210func GetPoolStakedLiquidity(poolPath string) string {
211 return getImplementation().GetPoolStakedLiquidity(poolPath)
212}
213
214// GetPoolsByTier returns the pool list for a tier.
215func GetPoolsByTier(tier uint64) []string {
216 return getImplementation().GetPoolsByTier(tier)
217}
218
219// GetPoolReward returns the reward amount for a tier.
220func GetPoolReward(tier uint64) int64 {
221 return getImplementation().GetPoolReward(tier)
222}
223
224// GetPoolTier returns the tier of a pool.
225func GetPoolTier(poolPath string) uint64 {
226 return getImplementation().GetPoolTier(poolPath)
227}
228
229// GetPoolTierCount returns the number of pools in a tier.
230func GetPoolTierCount(tier uint64) uint64 {
231 return getImplementation().GetPoolTierCount(tier)
232}
233
234// GetPoolTierRatio returns the reward ratio of a pool.
235func GetPoolTierRatio(poolPath string) uint64 {
236 return getImplementation().GetPoolTierRatio(poolPath)
237}
238
239// GetSpecificTokenMinimumRewardAmount returns the minimum reward amount for a specific token.
240func GetSpecificTokenMinimumRewardAmount(tokenPath string) (int64, bool) {
241 return getImplementation().GetSpecificTokenMinimumRewardAmount(tokenPath)
242}
243
244// GetTargetPoolPathByIncentiveId returns the pool path for an incentive ID.
245func GetTargetPoolPathByIncentiveId(poolPath string, incentiveId string) string {
246 return getImplementation().GetTargetPoolPathByIncentiveId(poolPath, incentiveId)
247}
248
249// GetUnstakingFee returns the unstaking fee percentage.
250func GetUnstakingFee() int64 {
251 return getImplementation().GetUnstakingFee()
252}
253
254// IsStaked returns whether a position is staked.
255func IsStaked(positionId uint64) bool {
256 return getImplementation().IsStaked(positionId)
257}
258
259// GetTotalEmissionSent returns the total GNS emission sent.
260func GetTotalEmissionSent() int64 {
261 return getImplementation().GetTotalEmissionSent()
262}
263
264// GetAllowedTokens returns the allowed external incentive tokens.
265func GetAllowedTokens() []string {
266 return getImplementation().GetAllowedTokens()
267}
268
269// GetWarmupTemplate returns the current warmup template.
270func GetWarmupTemplate() []Warmup {
271 return getImplementation().GetWarmupTemplate()
272}
273
274// GetTotalStakedUserCount returns the total number of staked users.
275func GetTotalStakedUserCount() uint64 {
276 return getImplementation().GetTotalStakedUserCount()
277}
278
279// GetTotalStakedUserPositionCount returns the staked position count for a user.
280func GetTotalStakedUserPositionCount(user address) uint64 {
281 return getImplementation().GetTotalStakedUserPositionCount(user)
282}
283
284// GetStakedPositionsByUser returns staked position IDs for a user with pagination.
285func GetStakedPositionsByUser(owner address, offset, count int) []uint64 {
286 return getImplementation().GetStakedPositionsByUser(owner, offset, count)
287}
288
289// GetPoolRewardCacheCount returns the number of reward cache entries for a pool.
290func GetPoolRewardCacheCount(poolPath string) uint64 {
291 return getImplementation().GetPoolRewardCacheCount(poolPath)
292}
293
294// GetPoolRewardCacheIDs returns a paginated list of reward cache timestamps for a pool.
295func GetPoolRewardCacheIDs(poolPath string, offset, count int) []int64 {
296 return getImplementation().GetPoolRewardCacheIDs(poolPath, offset, count)
297}
298
299// GetPoolRewardCache returns the reward cache value at a specific timestamp for a pool.
300func GetPoolRewardCache(poolPath string, timestamp uint64) int64 {
301 return getImplementation().GetPoolRewardCache(poolPath, timestamp)
302}
303
304// GetPoolIncentiveCount returns the number of incentives for a pool.
305func GetPoolIncentiveCount(poolPath string) uint64 {
306 return getImplementation().GetPoolIncentiveCount(poolPath)
307}
308
309// GetPoolIncentiveIDs returns a paginated list of incentive IDs for a pool.
310func GetPoolIncentiveIDs(poolPath string, offset, count int) []string {
311 return getImplementation().GetPoolIncentiveIDs(poolPath, offset, count)
312}
313
314// GetPoolGlobalRewardRatioAccumulationCount returns the number of global reward ratio accumulation entries for a pool.
315func GetPoolGlobalRewardRatioAccumulationCount(poolPath string) uint64 {
316 return getImplementation().GetPoolGlobalRewardRatioAccumulationCount(poolPath)
317}
318
319// GetPoolGlobalRewardRatioAccumulationIDs returns a paginated list of timestamps for global reward ratio accumulation entries.
320func GetPoolGlobalRewardRatioAccumulationIDs(poolPath string, offset, count int) []uint64 {
321 return getImplementation().GetPoolGlobalRewardRatioAccumulationIDs(poolPath, offset, count)
322}
323
324// GetPoolGlobalRewardRatioAccumulation returns the global reward ratio accumulation at a specific timestamp for a pool.
325func GetPoolGlobalRewardRatioAccumulation(poolPath string, timestamp uint64) *u256.Uint {
326 return getImplementation().GetPoolGlobalRewardRatioAccumulation(poolPath, timestamp)
327}
328
329// GetPoolHistoricalTickCount returns the number of historical tick entries for a pool.
330func GetPoolHistoricalTickCount(poolPath string) uint64 {
331 return getImplementation().GetPoolHistoricalTickCount(poolPath)
332}
333
334// GetPoolHistoricalTickIDs returns a paginated list of historical tick values for a pool.
335func GetPoolHistoricalTickIDs(poolPath string, offset, count int) []int32 {
336 return getImplementation().GetPoolHistoricalTickIDs(poolPath, offset, count)
337}
338
339// GetPoolHistoricalTick returns the historical tick at a specific timestamp for a pool.
340func GetPoolHistoricalTick(poolPath string, tick uint64) int32 {
341 return getImplementation().GetPoolHistoricalTick(poolPath, tick)
342}