Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

proxy.gno

4.01 Kb · 124 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// CollectEmissionReward claims accumulated GNS emission rewards.
 59func CollectEmissionReward(cur realm) {
 60	getImplementation().CollectEmissionReward(0, cur)
 61}
 62
 63// CollectProtocolFeeReward claims accumulated protocol fee rewards for the provided token path.
 64func CollectProtocolFeeReward(cur realm, tokenPath string) {
 65	getImplementation().CollectProtocolFeeReward(0, cur, tokenPath)
 66}
 67
 68// CollectRewardFromLaunchPad claims rewards from launchpad projects.
 69//
 70// Parameters:
 71//   - to: address to collect rewards for
 72func CollectRewardFromLaunchPad(cur realm, to address) {
 73	getImplementation().CollectRewardFromLaunchPad(0, cur, to)
 74}
 75
 76// CollectEmissionRewardFromLaunchPad claims accumulated launchpad emission rewards.
 77//
 78// Parameters:
 79//   - to: address to collect rewards for
 80func CollectEmissionRewardFromLaunchPad(cur realm, to address) {
 81	getImplementation().CollectEmissionRewardFromLaunchPad(0, cur, to)
 82}
 83
 84// CollectProtocolFeeRewardFromLaunchPad claims accumulated launchpad protocol fee rewards for the provided token path.
 85//
 86// Parameters:
 87//   - to: address to collect rewards for
 88//   - tokenPath: token path to collect
 89func CollectProtocolFeeRewardFromLaunchPad(cur realm, to address, tokenPath string) {
 90	getImplementation().CollectProtocolFeeRewardFromLaunchPad(0, cur, to, tokenPath)
 91}
 92
 93// SetAmountByProjectWallet sets reward amount for a project wallet.
 94// Only callable by launchpad contract.
 95//
 96// Parameters:
 97//   - addr: project wallet address
 98//   - amount: reward amount
 99//   - add: true to add, false to subtract
100func SetAmountByProjectWallet(cur realm, addr address, amount int64, add bool) {
101	getImplementation().SetAmountByProjectWallet(0, cur, addr, amount, add)
102}
103
104// Admin functions
105
106// CleanStakerDelegationSnapshotByAdmin removes old delegation snapshots for the
107// total history and the user history of a single target address.
108// Only callable by admin.
109//
110// Parameters:
111//   - threshold: timestamp threshold for cleanup
112//   - target: user address whose delegation history to clean
113func CleanStakerDelegationSnapshotByAdmin(cur realm, threshold int64, target address) {
114	getImplementation().CleanStakerDelegationSnapshotByAdmin(0, cur, threshold, target)
115}
116
117// SetUnDelegationLockupPeriodByAdmin sets the undelegation lockup period.
118// Only callable by admin.
119//
120// Parameters:
121//   - period: lockup period in seconds
122func SetUnDelegationLockupPeriodByAdmin(cur realm, period int64) {
123	getImplementation().SetUnDelegationLockupPeriodByAdmin(0, cur, period)
124}