proxy.gno
4.82 Kb ยท 170 lines
1package staker
2
3// StakeToken stakes a position NFT to earn rewards.
4//
5// Parameters:
6// - positionId: ID of the position to stake
7// - referrer: referrer address for reward tracking
8//
9// Returns:
10// - string: deposit ID
11func StakeToken(cur realm, positionId uint64, referrer string) string {
12 return getImplementation().StakeToken(positionId, referrer)
13}
14
15// UnStakeToken unstakes a position NFT and collects rewards.
16//
17// Parameters:
18// - positionId: ID of the position to unstake
19// - unwrapResult: whether to unwrap WGNOT to GNOT
20//
21// Returns:
22// - string: collected reward details
23func UnStakeToken(cur realm, positionId uint64, unwrapResult bool) string {
24 return getImplementation().UnStakeToken(positionId, unwrapResult)
25}
26
27// MintAndStake creates a new position and immediately stakes it.
28//
29// Parameters:
30// - token0: path of the first token
31// - token1: path of the second token
32// - fee: pool fee tier
33// - tickLower: lower tick boundary
34// - tickUpper: upper tick boundary
35// - amount0Desired: desired amount of token0
36// - amount1Desired: desired amount of token1
37// - amount0Min: minimum amount of token0
38// - amount1Min: minimum amount of token1
39// - deadline: transaction deadline
40// - referrer: referrer address for reward tracking
41//
42// Returns:
43// - uint64: position ID
44// - string: liquidity amount
45// - string: amount of token0 added
46// - string: amount of token1 added
47// - string: staking details
48func MintAndStake(
49 cur realm,
50 token0 string,
51 token1 string,
52 fee uint32,
53 tickLower int32,
54 tickUpper int32,
55 amount0Desired string,
56 amount1Desired string,
57 amount0Min string,
58 amount1Min string,
59 deadline int64,
60 referrer string,
61) (uint64, string, string, string, string) {
62 return getImplementation().MintAndStake(
63 token0,
64 token1,
65 fee,
66 tickLower,
67 tickUpper,
68 amount0Desired,
69 amount1Desired,
70 amount0Min,
71 amount1Min,
72 deadline,
73 referrer,
74 )
75}
76
77// CollectReward collects accumulated rewards from a staked position.
78//
79// Parameters:
80// - positionId: ID of the staked position
81// - unwrapResult: whether to unwrap WGNOT to GNOT
82//
83// Returns:
84// - string: pool path
85// - string: staking details
86// - map[string]int64: internal rewards
87// - map[string]int64: external rewards
88func CollectReward(cur realm, positionId uint64, unwrapResult bool) (string, string, map[string]int64, map[string]int64) {
89 return getImplementation().CollectReward(positionId, unwrapResult)
90}
91
92// SetPoolTier sets the reward tier for a pool.
93func SetPoolTier(cur realm, poolPath string, tier uint64) {
94 getImplementation().SetPoolTier(poolPath, tier)
95}
96
97// ChangePoolTier changes the reward tier of a pool.
98func ChangePoolTier(cur realm, poolPath string, tier uint64) {
99 getImplementation().ChangePoolTier(poolPath, tier)
100}
101
102// RemovePoolTier removes a pool from the tier system.
103func RemovePoolTier(cur realm, poolPath string) {
104 getImplementation().RemovePoolTier(poolPath)
105}
106
107// CreateExternalIncentive creates an external reward incentive for a pool.
108//
109// Parameters:
110// - targetPoolPath: pool to incentivize
111// - rewardToken: token to use as reward
112// - rewardAmount: total reward amount
113// - startTimestamp: incentive start time
114// - endTimestamp: incentive end time
115func CreateExternalIncentive(
116 cur realm,
117 targetPoolPath string,
118 rewardToken string,
119 rewardAmount int64,
120 startTimestamp int64,
121 endTimestamp int64,
122) {
123 getImplementation().CreateExternalIncentive(
124 targetPoolPath,
125 rewardToken,
126 rewardAmount,
127 startTimestamp,
128 endTimestamp,
129 )
130}
131
132// EndExternalIncentive terminates an external incentive early.
133func EndExternalIncentive(cur realm, targetPoolPath, incentiveId string) {
134 getImplementation().EndExternalIncentive(targetPoolPath, incentiveId)
135}
136
137// AddToken adds a token to the reward token whitelist.
138func AddToken(cur realm, tokenPath string) {
139 getImplementation().AddToken(tokenPath)
140}
141
142// RemoveToken removes a token from the reward token whitelist.
143func RemoveToken(cur realm, tokenPath string) {
144 getImplementation().RemoveToken(tokenPath)
145}
146
147// SetWarmUp sets the warm-up period parameters for staking.
148func SetWarmUp(cur realm, pct, timeDuration int64) {
149 getImplementation().SetWarmUp(pct, timeDuration)
150}
151
152// SetDepositGnsAmount sets the required GNS deposit amount for staking.
153func SetDepositGnsAmount(cur realm, amount int64) {
154 getImplementation().SetDepositGnsAmount(amount)
155}
156
157// SetMinimumRewardAmount sets the minimum reward amount to distribute.
158func SetMinimumRewardAmount(cur realm, amount int64) {
159 getImplementation().SetMinimumRewardAmount(amount)
160}
161
162// SetTokenMinimumRewardAmount sets minimum reward amounts per token.
163func SetTokenMinimumRewardAmount(cur realm, paramsStr string) {
164 getImplementation().SetTokenMinimumRewardAmount(paramsStr)
165}
166
167// SetUnStakingFee sets the unstaking fee percentage.
168func SetUnStakingFee(cur realm, fee int64) {
169 getImplementation().SetUnStakingFee(fee)
170}