proxy.gno
2.98 Kb · 97 lines
1package staker
2
3// Delegation operations
4
5// Delegate stakes GNS tokens to a delegatee address.
6//
7// Parameters:
8// - to: address to delegate to
9// - amount: amount of GNS to delegate
10// - referrer: referrer address for reward tracking
11//
12// Returns:
13// - int64: delegation ID
14func Delegate(cur realm, to address, amount int64, referrer string) int64 {
15 return getImplementation().Delegate(0, cur, to, amount, referrer)
16}
17
18// Undelegate initiates the undelegation process for staked GNS.
19//
20// Parameters:
21// - from: delegatee address to undelegate from
22// - amount: amount of GNS to undelegate
23//
24// Returns:
25// - int64: undelegation result code
26func Undelegate(cur realm, from address, amount int64) int64 {
27 return getImplementation().Undelegate(0, cur, from, amount)
28}
29
30// Redelegate moves delegation from one delegatee to another.
31//
32// Parameters:
33// - delegatee: current delegatee address
34// - newDelegatee: new delegatee address
35// - amount: amount to redelegate
36//
37// Returns:
38// - int64: redelegation result code
39func Redelegate(cur realm, delegatee, newDelegatee address, amount int64) int64 {
40 return getImplementation().Redelegate(0, cur, delegatee, newDelegatee, amount)
41}
42
43// CollectUndelegatedGns collects GNS tokens after the undelegation lockup period.
44//
45// Returns:
46// - int64: amount of GNS collected
47func CollectUndelegatedGns(cur realm) int64 {
48 return getImplementation().CollectUndelegatedGns(0, cur)
49}
50
51// Reward operations
52
53// CollectReward claims accumulated staking rewards.
54func CollectReward(cur realm) {
55 getImplementation().CollectReward(0, cur)
56}
57
58// CollectRewardFromLaunchPad claims rewards from launchpad projects.
59//
60// Parameters:
61// - to: address to collect rewards for
62func CollectRewardFromLaunchPad(cur realm, to address) {
63 getImplementation().CollectRewardFromLaunchPad(0, cur, to)
64}
65
66// SetAmountByProjectWallet sets reward amount for a project wallet.
67// Only callable by launchpad contract.
68//
69// Parameters:
70// - addr: project wallet address
71// - amount: reward amount
72// - add: true to add, false to subtract
73func SetAmountByProjectWallet(cur realm, addr address, amount int64, add bool) {
74 getImplementation().SetAmountByProjectWallet(0, cur, addr, amount, add)
75}
76
77// Admin functions
78
79// CleanStakerDelegationSnapshotByAdmin removes old delegation snapshots for the
80// total history and the user history of a single target address.
81// Only callable by admin.
82//
83// Parameters:
84// - threshold: timestamp threshold for cleanup
85// - target: user address whose delegation history to clean
86func CleanStakerDelegationSnapshotByAdmin(cur realm, threshold int64, target address) {
87 getImplementation().CleanStakerDelegationSnapshotByAdmin(0, cur, threshold, target)
88}
89
90// SetUnDelegationLockupPeriodByAdmin sets the undelegation lockup period.
91// Only callable by admin.
92//
93// Parameters:
94// - period: lockup period in seconds
95func SetUnDelegationLockupPeriodByAdmin(cur realm, period int64) {
96 getImplementation().SetUnDelegationLockupPeriodByAdmin(0, cur, period)
97}