Search Apps Documentation Source Content File Folder Download Copy Actions Download

getter.gno

13.79 Kb · 335 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// GetIncentiveAccumulatedPenaltyAmount returns the accumulated warmup penalty amount of an incentive.
 70func GetIncentiveAccumulatedPenaltyAmount(poolPath string, incentiveId string) int64 {
 71	return getImplementation().GetIncentiveAccumulatedPenaltyAmount(poolPath, incentiveId)
 72}
 73
 74// GetIncentiveDepositGnsAmount returns the deposited GNS amount of an incentive.
 75func GetIncentiveDepositGnsAmount(poolPath string, incentiveId string) int64 {
 76	return getImplementation().GetIncentiveDepositGnsAmount(poolPath, incentiveId)
 77}
 78
 79// GetIncentiveRefunded returns whether an incentive has been refunded.
 80func GetIncentiveRefunded(poolPath string, incentiveId string) bool {
 81	return getImplementation().GetIncentiveRefunded(poolPath, incentiveId)
 82}
 83
 84// IsIncentiveActive returns whether an incentive is active.
 85func IsIncentiveActive(poolPath string, incentiveId string) bool {
 86	return getImplementation().IsIncentiveActive(poolPath, incentiveId)
 87}
 88
 89// GetDepositExternalRewardLastCollectTimestamp returns the last external reward collection time for a position.
 90func GetDepositExternalRewardLastCollectTimestamp(lpTokenId uint64, incentiveId string) int64 {
 91	return getImplementation().GetDepositExternalRewardLastCollectTimestamp(lpTokenId, incentiveId)
 92}
 93
 94// GetDepositGnsAmount returns the required GNS deposit amount for staking.
 95func GetDepositGnsAmount() int64 {
 96	return getImplementation().GetDepositGnsAmount()
 97}
 98
 99// GetDepositInternalRewardLastCollectTimestamp returns the last internal reward collection time for a position.
100func GetDepositInternalRewardLastCollectTimestamp(lpTokenId uint64) int64 {
101	return getImplementation().GetDepositInternalRewardLastCollectTimestamp(lpTokenId)
102}
103
104// GetDepositCollectedInternalReward returns the collected internal reward amount of a position.
105func GetDepositCollectedInternalReward(lpTokenId uint64) int64 {
106	return getImplementation().GetDepositCollectedInternalReward(lpTokenId)
107}
108
109// GetDepositCollectedExternalReward returns the collected external reward amount of a position.
110func GetDepositCollectedExternalReward(lpTokenId uint64, incentiveId string) int64 {
111	return getImplementation().GetDepositCollectedExternalReward(lpTokenId, incentiveId)
112}
113
114// GetDepositLiquidity returns the liquidity amount of a staked position.
115func GetDepositLiquidity(lpTokenId uint64) *u256.Uint {
116	return getImplementation().GetDepositLiquidity(lpTokenId).Clone()
117}
118
119// GetDepositLiquidityAsString returns the liquidity amount of a staked position as string.
120func GetDepositLiquidityAsString(lpTokenId uint64) string {
121	return getImplementation().GetDepositLiquidityAsString(lpTokenId)
122}
123
124// GetDepositOwner returns the owner of a staked position.
125func GetDepositOwner(lpTokenId uint64) address {
126	return getImplementation().GetDepositOwner(lpTokenId)
127}
128
129// GetDepositStakeTime returns the staking duration of a position.
130func GetDepositStakeTime(lpTokenId uint64) int64 {
131	return getImplementation().GetDepositStakeTime(lpTokenId)
132}
133
134// GetDepositTargetPoolPath returns the pool path of a staked position.
135func GetDepositTargetPoolPath(lpTokenId uint64) string {
136	return getImplementation().GetDepositTargetPoolPath(lpTokenId)
137}
138
139// GetDepositTickLower returns the lower tick of a staked position.
140func GetDepositTickLower(lpTokenId uint64) int32 {
141	return getImplementation().GetDepositTickLower(lpTokenId)
142}
143
144// GetDepositTickUpper returns the upper tick of a staked position.
145func GetDepositTickUpper(lpTokenId uint64) int32 {
146	return getImplementation().GetDepositTickUpper(lpTokenId)
147}
148
149// GetDepositWarmUp returns the warmup records of a staked position.
150func GetDepositWarmUp(lpTokenId uint64) []Warmup {
151	return cloneWarmups(getImplementation().GetDepositWarmUp(lpTokenId))
152}
153
154// GetDepositExternalIncentiveIdList returns external incentive IDs for a deposit.
155func GetDepositExternalIncentiveIdList(lpTokenId uint64) []string {
156	return cloneStringSlice(getImplementation().GetDepositExternalIncentiveIdList(lpTokenId))
157}
158
159// GetExternalIncentiveByPoolPath returns all external incentives for a pool.
160func GetExternalIncentiveByPoolPath(poolPath string) []ExternalIncentive {
161	return cloneExternalIncentives(getImplementation().GetExternalIncentiveByPoolPath(poolPath))
162}
163
164// GetIncentiveEndTimestamp returns the end timestamp of an incentive.
165func GetIncentiveEndTimestamp(poolPath string, incentiveId string) int64 {
166	return getImplementation().GetIncentiveEndTimestamp(poolPath, incentiveId)
167}
168
169// GetIncentiveCreator returns the creator address of an incentive.
170func GetIncentiveCreator(poolPath string, incentiveId string) address {
171	return getImplementation().GetIncentiveCreator(poolPath, incentiveId)
172}
173
174// GetIncentiveRewardAmount returns the total reward amount of an incentive.
175func GetIncentiveRewardAmount(poolPath string, incentiveId string) *u256.Uint {
176	return getImplementation().GetIncentiveRewardAmount(poolPath, incentiveId).Clone()
177}
178
179// GetIncentiveRewardAmountAsString returns the total reward amount of an incentive as string.
180func GetIncentiveRewardAmountAsString(poolPath string, incentiveId string) string {
181	return getImplementation().GetIncentiveRewardAmountAsString(poolPath, incentiveId)
182}
183
184// GetIncentiveRewardPerSecondX128 returns the reward rate per second of an
185// incentive, expressed as a Q128 fixed-point number (i.e. actual rate =
186// value / 2^128). Callers needing an integer rate can right-shift the result
187// by 128.
188func GetIncentiveRewardPerSecondX128(poolPath string, incentiveId string) *u256.Uint {
189	return getImplementation().GetIncentiveRewardPerSecondX128(poolPath, incentiveId).Clone()
190}
191
192// GetIncentiveRewardToken returns the reward token of an incentive.
193func GetIncentiveRewardToken(poolPath string, incentiveId string) string {
194	return getImplementation().GetIncentiveRewardToken(poolPath, incentiveId)
195}
196
197// GetIncentiveStartTimestamp returns the start timestamp of an incentive.
198func GetIncentiveStartTimestamp(poolPath string, incentiveId string) int64 {
199	return getImplementation().GetIncentiveStartTimestamp(poolPath, incentiveId)
200}
201
202// GetMinimumRewardAmount returns the minimum reward amount to distribute.
203func GetMinimumRewardAmount() int64 {
204	return getImplementation().GetMinimumRewardAmount()
205}
206
207// GetMinimumRewardAmountForToken returns the minimum reward amount for a specific token.
208func GetMinimumRewardAmountForToken(tokenPath string) int64 {
209	return getImplementation().GetMinimumRewardAmountForToken(tokenPath)
210}
211
212// GetPoolIncentiveIdList returns all incentive IDs for a pool.
213func GetPoolIncentiveIdList(poolPath string) []string {
214	return cloneStringSlice(getImplementation().GetPoolIncentiveIdList(poolPath))
215}
216
217// GetPoolStakedLiquidity returns the current total staked liquidity of a pool.
218func GetPoolStakedLiquidity(poolPath string) string {
219	return getImplementation().GetPoolStakedLiquidity(poolPath)
220}
221
222// GetPoolsByTier returns the pool list for a tier.
223func GetPoolsByTier(tier uint64) []string {
224	return cloneStringSlice(getImplementation().GetPoolsByTier(tier))
225}
226
227// GetPoolReward returns the reward amount for a tier.
228func GetPoolReward(tier uint64) int64 {
229	return getImplementation().GetPoolReward(tier)
230}
231
232// GetPoolTier returns the tier of a pool.
233func GetPoolTier(poolPath string) uint64 {
234	return getImplementation().GetPoolTier(poolPath)
235}
236
237// GetPoolTierCount returns the number of pools in a tier.
238func GetPoolTierCount(tier uint64) uint64 {
239	return getImplementation().GetPoolTierCount(tier)
240}
241
242// GetPoolTierRatio returns the reward ratio of a pool.
243func GetPoolTierRatio(poolPath string) uint64 {
244	return getImplementation().GetPoolTierRatio(poolPath)
245}
246
247// GetSpecificTokenMinimumRewardAmount returns the minimum reward amount for a specific token.
248func GetSpecificTokenMinimumRewardAmount(tokenPath string) (int64, bool) {
249	return getImplementation().GetSpecificTokenMinimumRewardAmount(tokenPath)
250}
251
252// GetTargetPoolPathByIncentiveId returns the pool path for an incentive ID.
253func GetTargetPoolPathByIncentiveId(poolPath string, incentiveId string) string {
254	return getImplementation().GetTargetPoolPathByIncentiveId(poolPath, incentiveId)
255}
256
257// GetUnstakingFee returns the unstaking fee percentage.
258func GetUnstakingFee() uint64 {
259	return getImplementation().GetUnstakingFee()
260}
261
262// IsStaked returns whether a position is staked.
263func IsStaked(positionId uint64) bool {
264	return getImplementation().IsStaked(positionId)
265}
266
267// GetTotalEmissionSent returns the total GNS emission sent.
268func GetTotalEmissionSent() int64 {
269	return getImplementation().GetTotalEmissionSent()
270}
271
272// GetAllowedTokens returns the allowed external incentive tokens.
273func GetAllowedTokens() []string {
274	return cloneStringSlice(getImplementation().GetAllowedTokens())
275}
276
277// GetWarmupTemplate returns the current warmup template.
278func GetWarmupTemplate() []Warmup {
279	return cloneWarmups(getImplementation().GetWarmupTemplate())
280}
281
282// GetPoolRewardCacheCount returns the number of reward cache entries for a pool.
283func GetPoolRewardCacheCount(poolPath string) uint64 {
284	return getImplementation().GetPoolRewardCacheCount(poolPath)
285}
286
287// GetPoolRewardCacheIDs returns a paginated list of reward cache timestamps for a pool.
288func GetPoolRewardCacheIDs(poolPath string, offset, count int) []int64 {
289	return cloneInt64Slice(getImplementation().GetPoolRewardCacheIDs(poolPath, offset, count))
290}
291
292// GetPoolRewardCache returns the reward cache value at a specific timestamp for a pool.
293func GetPoolRewardCache(poolPath string, timestamp uint64) int64 {
294	return getImplementation().GetPoolRewardCache(poolPath, timestamp)
295}
296
297// GetPoolIncentiveCount returns the number of incentives for a pool.
298func GetPoolIncentiveCount(poolPath string) uint64 {
299	return getImplementation().GetPoolIncentiveCount(poolPath)
300}
301
302// GetPoolIncentiveIDs returns a paginated list of incentive IDs for a pool.
303func GetPoolIncentiveIDs(poolPath string, offset, count int) []string {
304	return cloneStringSlice(getImplementation().GetPoolIncentiveIDs(poolPath, offset, count))
305}
306
307// GetPoolGlobalRewardRatioAccumulationCount returns the number of global reward ratio accumulation entries for a pool.
308func GetPoolGlobalRewardRatioAccumulationCount(poolPath string) uint64 {
309	return getImplementation().GetPoolGlobalRewardRatioAccumulationCount(poolPath)
310}
311
312// GetPoolGlobalRewardRatioAccumulationIDs returns a paginated list of timestamps for global reward ratio accumulation entries.
313func GetPoolGlobalRewardRatioAccumulationIDs(poolPath string, offset, count int) []uint64 {
314	return cloneUint64Slice(getImplementation().GetPoolGlobalRewardRatioAccumulationIDs(poolPath, offset, count))
315}
316
317// GetPoolGlobalRewardRatioAccumulation returns the global reward ratio accumulation at a specific timestamp for a pool.
318func GetPoolGlobalRewardRatioAccumulation(poolPath string, timestamp uint64) string {
319	return getImplementation().GetPoolGlobalRewardRatioAccumulation(poolPath, timestamp)
320}
321
322// GetPoolHistoricalTickCount returns the number of historical tick entries for a pool.
323func GetPoolHistoricalTickCount(poolPath string) uint64 {
324	return getImplementation().GetPoolHistoricalTickCount(poolPath)
325}
326
327// GetPoolHistoricalTickIDs returns a paginated list of historical tick values for a pool.
328func GetPoolHistoricalTickIDs(poolPath string, offset, count int) []int32 {
329	return cloneInt32Slice(getImplementation().GetPoolHistoricalTickIDs(poolPath, offset, count))
330}
331
332// GetPoolHistoricalTick returns the historical tick at a specific timestamp for a pool.
333func GetPoolHistoricalTick(poolPath string, tick uint64) int32 {
334	return getImplementation().GetPoolHistoricalTick(poolPath, tick)
335}