Search Apps Documentation Source Content File Folder Download Copy Actions Download

types.gno

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