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

5.30 Kb · 141 lines
  1package launchpad
  2
  3// CreateProject creates a new launchpad project callable by the administrator or governance.
  4//
  5// Parameters:
  6//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
  7//   - name: human-readable project name.
  8//   - tokenPath: token path whose tokens are distributed as project rewards.
  9//   - recipient: address authorized to receive project rewards and project proceeds.
 10//   - depositAmount: total reward-token amount allocated to the project.
 11//   - conditionTokens: optional `*PAD*`-separated token paths required for deposits.
 12//   - conditionAmounts: optional `*PAD*`-separated required amounts matching conditionTokens.
 13//   - tier30Ratio: reward allocation ratio for the 30-day tier.
 14//   - tier90Ratio: reward allocation ratio for the 90-day tier.
 15//   - tier180Ratio: reward allocation ratio for the 180-day tier.
 16//   - startTime: Unix timestamp at which project reward distribution starts.
 17//
 18// Returns:
 19//   - projectId: identifier assigned to the newly created project.
 20//
 21// Halt check: reverts while the Launchpad halt scope is active.
 22func CreateProject(
 23	cur realm,
 24	name string,
 25	tokenPath string,
 26	recipient address,
 27	depositAmount int64,
 28	conditionTokens string,
 29	conditionAmounts string,
 30	tier30Ratio int64,
 31	tier90Ratio int64,
 32	tier180Ratio int64,
 33	startTime int64,
 34) string {
 35	return getImplementation().CreateProject(
 36		0,
 37		cur,
 38		name,
 39		tokenPath,
 40		recipient,
 41		depositAmount,
 42		conditionTokens,
 43		conditionAmounts,
 44		tier30Ratio,
 45		tier90Ratio,
 46		tier180Ratio,
 47		startTime,
 48	)
 49}
 50
 51// CollectProtocolFee collects protocol-fee rewards allocated to project recipients.
 52//
 53// Parameters:
 54//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
 55//
 56// Halt check: reverts while the Withdraw halt scope is active.
 57func CollectProtocolFee(cur realm) {
 58	getImplementation().CollectProtocolFee(0, cur)
 59}
 60
 61// CollectEmissionReward collects accumulated launchpad emission rewards.
 62//
 63// Parameters:
 64//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
 65//
 66// Halt check: reverts while the Withdraw halt scope is active.
 67func CollectEmissionReward(cur realm) {
 68	getImplementation().CollectEmissionReward(0, cur)
 69}
 70
 71// CollectProtocolFeeReward collects accumulated launchpad protocol-fee rewards for a token path.
 72//
 73// Parameters:
 74//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
 75//   - tokenPath: token path whose accumulated protocol-fee reward is collected.
 76//
 77// Halt check: reverts while the Withdraw halt scope is active.
 78func CollectProtocolFeeReward(cur realm, tokenPath string) {
 79	getImplementation().CollectProtocolFeeReward(0, cur, tokenPath)
 80}
 81
 82// TransferLeftFromProjectByAdmin transfers unreserved reward tokens from an ended project.
 83// Active depositor claims remain reserved and are excluded; only the administrator may call it.
 84//
 85// Parameters:
 86//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
 87//   - projectID: identifier of the ended project whose remaining balance is transferred.
 88//   - recipient: destination address for the transferable balance.
 89//
 90// Returns:
 91//   - amount: number of reward tokens transferred after active claims are reserved.
 92//
 93// Halt check: reverts while the Launchpad halt scope is active.
 94func TransferLeftFromProjectByAdmin(cur realm, projectID string, recipient address) int64 {
 95	return getImplementation().TransferLeftFromProjectByAdmin(0, cur, projectID, recipient)
 96}
 97
 98// DepositGns deposits GNS into a selected launchpad project tier.
 99//
100// Parameters:
101//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
102//   - targetProjectTierID: project-tier identifier in `{projectID}:{tierDuration}` form.
103//   - depositAmount: amount of GNS to stake in the selected tier.
104//   - referrer: optional referral address associated with the deposit.
105//
106// Returns:
107//   - depositId: identifier assigned to the newly created deposit.
108//
109// Halt check: reverts while the Launchpad halt scope is active.
110func DepositGns(cur realm, targetProjectTierID string, depositAmount int64, referrer string) string {
111	return getImplementation().DepositGns(0, cur, targetProjectTierID, depositAmount, referrer)
112}
113
114// CollectDepositGns withdraws the GNS amount recorded by a deposit.
115//
116// Parameters:
117//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
118//   - depositID: identifier of the deposit whose GNS is collected.
119//
120// Returns:
121//   - amount: GNS amount withdrawn from the deposit.
122//   - err: non-nil when the deposit cannot be collected.
123//
124// Halt check: reverts while the Withdraw halt scope is active.
125func CollectDepositGns(cur realm, depositID string) (int64, error) {
126	return getImplementation().CollectDepositGns(0, cur, depositID)
127}
128
129// CollectRewardByDepositId collects the project-token reward earned by a deposit.
130//
131// Parameters:
132//   - cur: current realm context; callers use cross(cur) when crossing into this realm.
133//   - depositID: identifier of the deposit whose reward is collected.
134//
135// Returns:
136//   - amount: project-token reward amount transferred to the depositor.
137//
138// Halt check: reverts while the Withdraw halt scope is active.
139func CollectRewardByDepositId(cur realm, depositID string) int64 {
140	return getImplementation().CollectRewardByDepositId(0, cur, depositID)
141}