proxy.gno
7.58 Kb · 185 lines
1package staker
2
3// Delegation operations
4
5// Delegate delegates GNS to a delegate.
6//
7// Parameters:
8// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
9// - to: delegatee address that receives voting power
10// - amount: positive GNS amount to delegate and convert to xGNS voting power
11// - referrer: optional referral identifier to register for reward tracking
12//
13// Returns:
14// - delegatedAmount: The amount of GNS delegated and mirrored as xGNS.
15//
16// Halt check: reverts while the GovStaker halt scope is active.
17func Delegate(cur realm, to address, amount int64, referrer string) int64 {
18 return getImplementation().Delegate(0, cur, to, amount, referrer)
19}
20
21// Undelegate undelegates xGNS from the existing delegate.
22//
23// Parameters:
24// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
25// - from: delegatee address from which the caller removes delegation
26// - amount: positive xGNS amount to move into undelegation lockup
27//
28// Returns:
29// - amount: The amount of GNS moved into undelegation lockup.
30//
31// Halt check: reverts while the Withdraw halt scope is active.
32func Undelegate(cur realm, from address, amount int64) int64 {
33 return getImplementation().Undelegate(0, cur, from, amount)
34}
35
36// Redelegate redelegates xGNS from the existing delegate to another.
37//
38// Parameters:
39// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
40// - delegatee: current delegatee address whose voting power is reduced
41// - newDelegatee: destination address that receives the redelegated voting power
42// - amount: positive xGNS amount to move without a user-facing lockup
43//
44// Returns:
45// - redelegatedAmount: The amount moved from the current delegatee to the new delegatee.
46//
47// Halt check: reverts while the GovStaker halt scope is active.
48func Redelegate(cur realm, delegatee, newDelegatee address, amount int64) int64 {
49 return getImplementation().Redelegate(0, cur, delegatee, newDelegatee, amount)
50}
51
52// CollectUndelegatedGns collects the amount of the undelegated GNS.
53//
54// Parameters:
55// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
56//
57// Returns:
58// - amount: GNS amount released to the caller after eligible undelegation withdrawals are collected
59//
60// Halt check: reverts while the Withdraw halt scope is active.
61func CollectUndelegatedGns(cur realm) int64 {
62 return getImplementation().CollectUndelegatedGns(0, cur)
63}
64
65// Reward operations
66
67// CollectReward claims the caller's GNS emission reward and all known
68// protocol-fee token rewards.
69//
70// The all-token path folds and settles every known token. It is not a
71// single-current-xGNS-balance formula.
72//
73// Parameters:
74// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
75//
76// Halt check: reverts while the Withdraw halt scope is active.
77func CollectReward(cur realm) {
78 getImplementation().CollectReward(0, cur)
79}
80
81// CollectEmissionReward claims the caller's accumulated GNS emission reward.
82//
83// The call is subject to the withdrawal halt and transfers GNS when a reward
84// is available.
85//
86// Parameters:
87// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
88//
89// Halt check: reverts while the Withdraw halt scope is active.
90func CollectEmissionReward(cur realm) {
91 getImplementation().CollectEmissionReward(0, cur)
92}
93
94// CollectProtocolFeeReward claims accumulated protocol-fee rewards for one
95// registered token path. Folding and settlement are bounded per call; any
96// remaining buckets or stake events are collected by a later call.
97//
98// Parameters:
99// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
100// - tokenPath: registered token path whose accumulated protocol-fee reward is claimed
101//
102// Halt check: reverts while the Withdraw halt scope is active.
103func CollectProtocolFeeReward(cur realm, tokenPath string) {
104 getImplementation().CollectProtocolFeeReward(0, cur, tokenPath)
105}
106
107// CollectRewardFromLaunchPad claims both GNS emission and protocol-fee rewards
108// for a registered launchpad project wallet. Only the launchpad contract may
109// call this entry point.
110//
111// Parameters:
112// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
113// - to: registered launchpad project wallet that receives both reward streams
114//
115// Halt check: reverts while the Withdraw halt scope is active.
116func CollectRewardFromLaunchPad(cur realm, to address) {
117 getImplementation().CollectRewardFromLaunchPad(0, cur, to)
118}
119
120// CollectEmissionRewardFromLaunchPad claims only accumulated GNS emission
121// rewards for a registered launchpad project wallet.
122//
123// Parameters:
124// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
125// - to: registered launchpad project wallet whose emission reward is claimed
126//
127// Halt check: reverts while the Withdraw halt scope is active.
128func CollectEmissionRewardFromLaunchPad(cur realm, to address) {
129 getImplementation().CollectEmissionRewardFromLaunchPad(0, cur, to)
130}
131
132// CollectProtocolFeeRewardFromLaunchPad claims one token path of accumulated
133// protocol-fee rewards for a registered launchpad project wallet.
134//
135// Parameters:
136// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
137// - to: registered launchpad project wallet whose protocol-fee reward is claimed
138// - tokenPath: registered token path whose accumulated protocol-fee reward is claimed
139//
140// Halt check: reverts while the Withdraw halt scope is active.
141func CollectProtocolFeeRewardFromLaunchPad(cur realm, to address, tokenPath string) {
142 getImplementation().CollectProtocolFeeRewardFromLaunchPad(0, cur, to, tokenPath)
143}
144
145// SetAmountByProjectWallet adjusts launchpad-backed stake and xGNS accounting for a project wallet.
146// Only callable by launchpad contract.
147//
148// Parameters:
149// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
150// - addr: registered project wallet whose launchpad-backed stake is adjusted
151// - amount: stake amount delta passed to the launchpad reward accounting
152// - add: true to add stake and mint xGNS; false to remove stake and burn xGNS
153//
154// Halt check: reverts while the GovStaker halt scope is active when add is true, or while the Withdraw halt scope is active when add is false.
155func SetAmountByProjectWallet(cur realm, addr address, amount int64, add bool) {
156 getImplementation().SetAmountByProjectWallet(0, cur, addr, amount, add)
157}
158
159// Admin functions
160
161// CleanStakerDelegationSnapshotByAdmin removes old delegation snapshots for the
162// total history and the user history of a single target address.
163// Only callable by admin.
164//
165// Parameters:
166// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
167// - threshold: Unix timestamp cutoff for removing eligible old delegation history
168// - target: user address whose delegation history to clean
169//
170// Halt check: reverts while the GovStaker halt scope is active.
171func CleanStakerDelegationSnapshotByAdmin(cur realm, threshold int64, target address) {
172 getImplementation().CleanStakerDelegationSnapshotByAdmin(0, cur, threshold, target)
173}
174
175// SetUnDelegationLockupPeriodByAdmin sets the undelegation lockup period.
176// Only callable by admin.
177//
178// Parameters:
179// - cur: Current realm context; callers use cross(cur) when crossing into this realm.
180// - period: non-negative undelegation lockup duration in seconds
181//
182// Halt check: reverts while the GovStaker halt scope is active.
183func SetUnDelegationLockupPeriodByAdmin(cur realm, period int64) {
184 getImplementation().SetUnDelegationLockupPeriodByAdmin(0, cur, period)
185}