Search Apps Documentation Source Content File Folder Download Copy Actions Download

types.gno

8.11 Kb ยท 231 lines
  1package staker
  2
  3import (
  4	u256 "gno.land/p/gnoswap/uint256"
  5	"gno.land/p/nt/avl"
  6)
  7
  8type IStaker interface {
  9	IStakerManager
 10	IStakerGetter
 11}
 12
 13type IStakerManager interface {
 14	StakeToken(positionId uint64, referrer string) string
 15	UnStakeToken(positionId uint64, unwrapResult bool) string
 16	MintAndStake(
 17		token0 string,
 18		token1 string,
 19		fee uint32,
 20		tickLower int32,
 21		tickUpper int32,
 22		amount0Desired string,
 23		amount1Desired string,
 24		amount0Min string,
 25		amount1Min string,
 26		deadline int64,
 27		referrer string,
 28	) (uint64, string, string, string, string)
 29	CollectReward(positionId uint64, unwrapResult bool) (string, string, map[string]int64, map[string]int64)
 30
 31	SetPoolTier(poolPath string, tier uint64)
 32	ChangePoolTier(poolPath string, tier uint64)
 33	RemovePoolTier(poolPath string)
 34
 35	CreateExternalIncentive(
 36		targetPoolPath string,
 37		rewardToken string,
 38		rewardAmount int64,
 39		startTimestamp int64,
 40		endTimestamp int64,
 41	)
 42	EndExternalIncentive(targetPoolPath, incentiveId string)
 43	AddToken(tokenPath string)
 44	RemoveToken(tokenPath string)
 45
 46	SetWarmUp(pct, timeDuration int64)
 47	SetDepositGnsAmount(amount int64)
 48	SetMinimumRewardAmount(amount int64)
 49	SetTokenMinimumRewardAmount(paramsStr string)
 50	SetUnStakingFee(fee int64)
 51}
 52
 53type IStakerGetter interface {
 54	GetPool(poolPath string) *Pool
 55	GetPoolRewardCacheCount(poolPath string) uint64
 56	GetPoolRewardCacheIDs(poolPath string, offset, count int) []int64
 57	GetPoolRewardCache(poolPath string, timestamp uint64) int64
 58	GetPoolIncentiveCount(poolPath string) uint64
 59	GetPoolIncentiveIDs(poolPath string, offset, count int) []string
 60	GetPoolGlobalRewardRatioAccumulationCount(poolPath string) uint64
 61	GetPoolGlobalRewardRatioAccumulationIDs(poolPath string, offset, count int) []uint64
 62	GetPoolGlobalRewardRatioAccumulation(poolPath string, timestamp uint64) *u256.Uint
 63	GetPoolHistoricalTickCount(poolPath string) uint64
 64	GetPoolHistoricalTickIDs(poolPath string, offset, count int) []int32
 65	GetPoolHistoricalTick(poolPath string, tick uint64) int32
 66	GetIncentive(poolPath string, incentiveId string) *ExternalIncentive
 67	GetDeposit(lpTokenId uint64) *Deposit
 68	CollectableEmissionReward(positionId uint64) int64
 69	CollectableExternalIncentiveReward(positionId uint64, incentiveId string) int64
 70	GetCreatedHeightOfIncentive(poolPath string, incentiveId string) int64
 71	GetIncentiveCreatedTimestamp(poolPath string, incentiveId string) int64
 72	GetIncentiveTotalRewardAmount(poolPath string, incentiveId string) int64
 73	GetIncentiveDistributedRewardAmount(poolPath string, incentiveId string) int64
 74	GetIncentiveRemainingRewardAmount(poolPath string, incentiveId string) int64
 75	GetIncentiveDepositGnsAmount(poolPath string, incentiveId string) int64
 76	GetIncentiveRefunded(poolPath string, incentiveId string) bool
 77	IsIncentiveActive(poolPath string, incentiveId string) bool
 78	GetDepositExternalRewardLastCollectTimestamp(lpTokenId uint64, incentiveId string) int64
 79	GetDepositGnsAmount() int64
 80	GetDepositInternalRewardLastCollectTimestamp(lpTokenId uint64) int64
 81	GetDepositCollectedInternalReward(lpTokenId uint64) int64
 82	GetDepositCollectedExternalReward(lpTokenId uint64, incentiveId string) int64
 83	GetDepositLiquidity(lpTokenId uint64) *u256.Uint
 84	GetDepositLiquidityAsString(lpTokenId uint64) string
 85	GetDepositOwner(lpTokenId uint64) address
 86	GetDepositStakeTime(lpTokenId uint64) int64
 87	GetDepositTargetPoolPath(lpTokenId uint64) string
 88	GetDepositTickLower(lpTokenId uint64) int32
 89	GetDepositTickUpper(lpTokenId uint64) int32
 90	GetDepositWarmUp(lpTokenId uint64) []Warmup
 91	GetDepositExternalIncentiveIdList(lpTokenId uint64) []string
 92	GetExternalIncentiveByPoolPath(poolPath string) []ExternalIncentive
 93	GetIncentiveEndTimestamp(poolPath string, incentiveId string) int64
 94	GetIncentiveRefundee(poolPath string, incentiveId string) address
 95	GetIncentiveRewardAmount(poolPath string, incentiveId string) *u256.Uint
 96	GetIncentiveRewardAmountAsString(poolPath string, incentiveId string) string
 97	GetIncentiveRewardPerSecond(poolPath string, incentiveId string) int64
 98	GetIncentiveRewardToken(poolPath string, incentiveId string) string
 99	GetIncentiveStartTimestamp(poolPath string, incentiveId string) int64
100	GetMinimumRewardAmount() int64
101	GetMinimumRewardAmountForToken(tokenPath string) int64
102	GetPoolIncentiveIdList(poolPath string) []string
103	GetPoolStakedLiquidity(poolPath string) string
104	GetPoolsByTier(tier uint64) []string
105	GetPoolReward(tier uint64) int64
106	GetPoolTier(poolPath string) uint64
107	GetPoolTierCount(tier uint64) uint64
108	GetPoolTierRatio(poolPath string) uint64
109	GetSpecificTokenMinimumRewardAmount(tokenPath string) (int64, bool)
110	GetTargetPoolPathByIncentiveId(poolPath string, incentiveId string) string
111	GetUnstakingFee() int64
112	IsStaked(positionId uint64) bool
113	GetTotalEmissionSent() int64
114	GetAllowedTokens() []string
115	GetWarmupTemplate() []Warmup
116	GetTotalStakedUserCount() uint64
117	GetTotalStakedUserPositionCount(user address) uint64
118	GetStakedPositionsByUser(owner address, offset, count int) []uint64
119}
120
121type IStakerStore interface {
122	// DepositGnsAmount
123	HasDepositGnsAmountStoreKey() bool
124	GetDepositGnsAmount() int64
125	SetDepositGnsAmount(amount int64) error
126
127	// MinimumRewardAmount
128	HasMinimumRewardAmountStoreKey() bool
129	GetMinimumRewardAmount() int64
130	SetMinimumRewardAmount(amount int64) error
131
132	// Deposits
133	HasDepositsStoreKey() bool
134	GetDeposits() *avl.Tree
135	SetDeposits(deposits *avl.Tree) error
136
137	// ExternalIncentives
138	HasExternalIncentivesStoreKey() bool
139	GetExternalIncentives() *avl.Tree
140	SetExternalIncentives(incentives *avl.Tree) error
141
142	// Stakers
143	HasStakersStoreKey() bool
144	GetStakers() *avl.Tree
145	SetStakers(stakers *avl.Tree) error
146
147	// TotalEmissionSent
148	HasTotalEmissionSentStoreKey() bool
149	GetTotalEmissionSent() int64
150	SetTotalEmissionSent(amount int64) error
151
152	// AllowedTokens
153	HasAllowedTokensStoreKey() bool
154	GetAllowedTokens() []string
155	SetAllowedTokens(tokens []string) error
156
157	// IncentiveCounter
158	HasIncentiveCounterStoreKey() bool
159	GetIncentiveCounter() *Counter
160	SetIncentiveCounter(counter *Counter) error
161	NextIncentiveID(creator address, timestamp int64) string
162
163	// TokenSpecificMinimumRewards
164	HasTokenSpecificMinimumRewardsStoreKey() bool
165	GetTokenSpecificMinimumRewards() *avl.Tree
166	SetTokenSpecificMinimumRewards(rewards *avl.Tree) error
167
168	// UnstakingFee
169	HasUnstakingFeeStoreKey() bool
170	GetUnstakingFee() int64
171	SetUnstakingFee(fee int64) error
172
173	// Pools
174	HasPoolsStoreKey() bool
175	GetPools() *avl.Tree
176	SetPools(pools *avl.Tree) error
177
178	// PoolTierMemberships
179	HasPoolTierMembershipsStoreKey() bool
180	GetPoolTierMemberships() *avl.Tree
181	SetPoolTierMemberships(memberships *avl.Tree) error
182
183	// PoolTierRatio
184	HasPoolTierRatioStoreKey() bool
185	GetPoolTierRatio() TierRatio
186	SetPoolTierRatio(ratio TierRatio) error
187
188	// PoolTierCounts
189	HasPoolTierCountsStoreKey() bool
190	GetPoolTierCounts() [AllTierCount]uint64
191	SetPoolTierCounts(counts [AllTierCount]uint64) error
192
193	// PoolTierLastRewardCacheTimestamp
194	HasPoolTierLastRewardCacheTimestampStoreKey() bool
195	GetPoolTierLastRewardCacheTimestamp() int64
196	SetPoolTierLastRewardCacheTimestamp(timestamp int64) error
197
198	// PoolTierLastRewardCacheHeight
199	HasPoolTierLastRewardCacheHeightStoreKey() bool
200	GetPoolTierLastRewardCacheHeight() int64
201	SetPoolTierLastRewardCacheHeight(height int64) error
202
203	// PoolTierCurrentEmission
204	HasPoolTierCurrentEmissionStoreKey() bool
205	GetPoolTierCurrentEmission() int64
206	SetPoolTierCurrentEmission(emission int64) error
207
208	// PoolTierGetEmission
209	HasPoolTierGetEmissionStoreKey() bool
210	GetPoolTierGetEmission() func() int64
211	SetPoolTierGetEmission(fn func() int64) error
212
213	// PoolTierGetHalvingBlocksInRange
214	HasPoolTierGetHalvingBlocksInRangeStoreKey() bool
215	GetPoolTierGetHalvingBlocksInRange() func(start, end int64) ([]int64, []int64)
216	SetPoolTierGetHalvingBlocksInRange(fn func(start, end int64) ([]int64, []int64)) error
217
218	HasWarmupTemplateStoreKey() bool
219	GetWarmupTemplate() []Warmup
220	SetWarmupTemplate(warmups []Warmup) error
221
222	// CurrentSwapBatch
223	HasCurrentSwapBatchStoreKey() bool
224	GetCurrentSwapBatch() *SwapBatchProcessor
225	SetCurrentSwapBatch(batch *SwapBatchProcessor) error
226
227	// ExternalIncentivesByCreationTime
228	HasExternalIncentivesByCreationTimeStoreKey() bool
229	GetExternalIncentivesByCreationTime() *UintTree
230	SetExternalIncentivesByCreationTime(tree *UintTree) error
231}