Search Apps Documentation Source Content File Folder Download Copy Actions Download

proxy.gno

2.76 Kb ยท 95 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(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(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(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()
49}
50
51// Reward operations
52
53// CollectReward claims accumulated staking rewards.
54func CollectReward(cur realm) {
55	getImplementation().CollectReward()
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(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(addr, amount, add)
75}
76
77// Admin functions
78
79// CleanStakerDelegationSnapshotByAdmin removes old delegation snapshots.
80// Only callable by admin.
81//
82// Parameters:
83//   - threshold: timestamp threshold for cleanup
84func CleanStakerDelegationSnapshotByAdmin(cur realm, threshold int64) {
85	getImplementation().CleanStakerDelegationSnapshotByAdmin(threshold)
86}
87
88// SetUnDelegationLockupPeriodByAdmin sets the undelegation lockup period.
89// Only callable by admin.
90//
91// Parameters:
92//   - period: lockup period in seconds
93func SetUnDelegationLockupPeriodByAdmin(cur realm, period int64) {
94	getImplementation().SetUnDelegationLockupPeriodByAdmin(period)
95}