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

getter.gno

23.29 Kb · 614 lines
  1package launchpad
  2
  3import (
  4	u256 "gno.land/p/gnoswap/uint256/v1"
  5	rotree "gno.land/p/nt/bptree/rotree/v0"
  6)
  7
  8// GetProjects returns a read-only view of every project, keyed by project ID.
  9// Callers paginate it themselves through IterateByOffset. Reading an entry
 10// yields a clone, so the view cannot mutate realm state.
 11//
 12// Returns:
 13//   - projects: read-only tree keyed by project ID; reading an entry yields a clone.
 14func GetProjects() *rotree.ReadOnlyTree {
 15	return getImplementation().GetProjects()
 16}
 17
 18// GetProjectName returns the name of a project by its ID.
 19//
 20// Parameters:
 21//   - projectId: unique identifier of the launchpad project to inspect.
 22//
 23// Returns:
 24//   - name: stored project name.
 25//   - err: non-nil when projectId does not identify a stored project.
 26func GetProjectName(projectId string) (string, error) {
 27	return getImplementation().GetProjectName(projectId)
 28}
 29
 30// GetProjectTokenPath returns the token path of a project by its ID.
 31//
 32// Parameters:
 33//   - projectId: unique identifier of the launchpad project to inspect.
 34//
 35// Returns:
 36//   - tokenPath: reward-token contract path configured for the project.
 37//   - err: non-nil when projectId does not identify a stored project.
 38func GetProjectTokenPath(projectId string) (string, error) {
 39	return getImplementation().GetProjectTokenPath(projectId)
 40}
 41
 42// GetProjectDepositAmount returns the deposit amount of a project by its ID.
 43//
 44// Parameters:
 45//   - projectId: unique identifier of the launchpad project to inspect.
 46//
 47// Returns:
 48//   - amount: project-token amount initially allocated to the project, in token base units.
 49//   - err: non-nil when projectId does not identify a stored project.
 50func GetProjectDepositAmount(projectId string) (int64, error) {
 51	return getImplementation().GetProjectDepositAmount(projectId)
 52}
 53
 54// GetProjectRecipient returns the recipient address of a project by its ID.
 55//
 56// Parameters:
 57//   - projectId: unique identifier of the launchpad project to inspect.
 58//
 59// Returns:
 60//   - recipient: address configured to receive the project's launchpad proceeds.
 61//   - err: non-nil when projectId does not identify a stored project.
 62func GetProjectRecipient(projectId string) (address, error) {
 63	return getImplementation().GetProjectRecipient(projectId)
 64}
 65
 66// GetProjectCondition retrieves a specific condition of a project.
 67// Returns a cloned condition to prevent external modification.
 68//
 69// Parameters:
 70//   - projectId: unique identifier of the project containing the condition.
 71//   - tokenPath: token contract path used as the condition key.
 72//
 73// Returns:
 74//   - condition: cloned condition for the requested token; nil when the implementation returns no condition without an error.
 75//   - err: non-nil when the project or condition cannot be found.
 76func GetProjectCondition(projectId string, tokenPath string) (*ProjectCondition, error) {
 77	condition, err := getImplementation().GetProjectCondition(projectId, tokenPath)
 78	if err != nil {
 79		return nil, err
 80	}
 81	if condition == nil {
 82		return nil, nil
 83	}
 84	return condition.Clone(), nil
 85}
 86
 87// GetProjectTiersRatios returns the tiers ratios map of a project by its ID.
 88//
 89// Parameters:
 90//   - projectId: unique identifier of the launchpad project to inspect.
 91//
 92// Returns:
 93//   - tiersRatios: cloned map from tier duration to its allocation ratio.
 94//   - err: non-nil when projectId does not identify a stored project.
 95func GetProjectTiersRatios(projectId string) (map[int64]int64, error) {
 96	tiersRatios, err := getImplementation().GetProjectTiersRatios(projectId)
 97	if err != nil {
 98		return nil, err
 99	}
100	return cloneInt64Map(tiersRatios), nil
101}
102
103// GetProjectCreatedHeight returns the created height of a project by its ID.
104//
105// Parameters:
106//   - projectId: unique identifier of the launchpad project to inspect.
107//
108// Returns:
109//   - height: block height at which the project was created.
110//   - err: non-nil when projectId does not identify a stored project.
111func GetProjectCreatedHeight(projectId string) (int64, error) {
112	return getImplementation().GetProjectCreatedHeight(projectId)
113}
114
115// GetProjectCreatedAt returns the created time of a project by its ID.
116//
117// Parameters:
118//   - projectId: unique identifier of the launchpad project to inspect.
119//
120// Returns:
121//   - createdAt: Unix timestamp in seconds at which the project was created.
122//   - err: non-nil when projectId does not identify a stored project.
123func GetProjectCreatedAt(projectId string) (int64, error) {
124	return getImplementation().GetProjectCreatedAt(projectId)
125}
126
127// GetProjectTier retrieves a specific tier of a project.
128// Returns a cloned tier to prevent external modification.
129//
130// Parameters:
131//   - projectId: unique identifier of the project containing the tier.
132//   - tier: tier duration key, such as 30, 90, or 180.
133//
134// Returns:
135//   - projectTier: cloned project tier; nil when the implementation supplies no tier without an error.
136//   - err: non-nil when the project or tier cannot be found.
137func GetProjectTier(projectId string, tier int64) (*ProjectTier, error) {
138	projectTier, err := getImplementation().GetProjectTier(projectId, tier)
139	if err != nil {
140		return nil, err
141	}
142	if projectTier == nil {
143		return nil, nil
144	}
145	return projectTier.Clone(), nil
146}
147
148// GetProjectTierDistributeAmountPerSecondX128 returns the distribute amount per second (Q128) of a project tier.
149//
150// Parameters:
151//   - projectId: unique identifier of the project containing the tier.
152//   - tier: tier duration key, such as 30, 90, or 180.
153//
154// Returns:
155//   - amountPerSecondX128: project-token distribution rate per second in Q128 fixed-point units; nil when no value is available.
156//   - err: non-nil when the project or tier cannot be found.
157func GetProjectTierDistributeAmountPerSecondX128(projectId string, tier int64) (*u256.Uint, error) {
158	amount, err := getImplementation().GetProjectTierDistributeAmountPerSecondX128(projectId, tier)
159	if err != nil {
160		return nil, err
161	}
162	if amount == nil {
163		return nil, nil
164	}
165	return amount.Clone(), nil
166}
167
168// GetProjectTierTotalDistributeAmount returns the total distribute amount of a project tier.
169//
170// Parameters:
171//   - projectId: unique identifier of the project containing the tier.
172//   - tier: tier duration key, such as 30, 90, or 180.
173//
174// Returns:
175//   - amount: total project-token allocation for the tier, in token base units.
176//   - err: non-nil when the project or tier cannot be found.
177func GetProjectTierTotalDistributeAmount(projectId string, tier int64) (int64, error) {
178	return getImplementation().GetProjectTierTotalDistributeAmount(projectId, tier)
179}
180
181// GetProjectTierTotalDepositAmount returns the total deposit amount of a project tier.
182//
183// Parameters:
184//   - projectId: unique identifier of the project containing the tier.
185//   - tier: tier duration key, such as 30, 90, or 180.
186//
187// Returns:
188//   - amount: cumulative GNS principal deposited into the tier, in base units.
189//   - err: non-nil when the project or tier cannot be found.
190func GetProjectTierTotalDepositAmount(projectId string, tier int64) (int64, error) {
191	return getImplementation().GetProjectTierTotalDepositAmount(projectId, tier)
192}
193
194// GetProjectTierTotalWithdrawAmount returns the total withdraw amount of a project tier.
195//
196// Parameters:
197//   - projectId: unique identifier of the project containing the tier.
198//   - tier: tier duration key, such as 30, 90, or 180.
199//
200// Returns:
201//   - amount: cumulative GNS principal withdrawn from the tier, in base units.
202//   - err: non-nil when the project or tier cannot be found.
203func GetProjectTierTotalWithdrawAmount(projectId string, tier int64) (int64, error) {
204	return getImplementation().GetProjectTierTotalWithdrawAmount(projectId, tier)
205}
206
207// GetProjectTierTotalDepositCount returns the total deposit count of a project tier.
208//
209// Parameters:
210//   - projectId: unique identifier of the project containing the tier.
211//   - tier: tier duration key, such as 30, 90, or 180.
212//
213// Returns:
214//   - count: cumulative number of deposits created in the tier.
215//   - err: non-nil when the project or tier cannot be found.
216func GetProjectTierTotalDepositCount(projectId string, tier int64) (int64, error) {
217	return getImplementation().GetProjectTierTotalDepositCount(projectId, tier)
218}
219
220// GetProjectTierTotalWithdrawCount returns the total withdraw count of a project tier.
221//
222// Parameters:
223//   - projectId: unique identifier of the project containing the tier.
224//   - tier: tier duration key, such as 30, 90, or 180.
225//
226// Returns:
227//   - count: cumulative number of withdrawals completed in the tier.
228//   - err: non-nil when the project or tier cannot be found.
229func GetProjectTierTotalWithdrawCount(projectId string, tier int64) (int64, error) {
230	return getImplementation().GetProjectTierTotalWithdrawCount(projectId, tier)
231}
232
233// GetProjectTierTotalCollectedAmount returns the total collected amount of a project tier.
234//
235// Parameters:
236//   - projectId: unique identifier of the project containing the tier.
237//   - tier: tier duration key, such as 30, 90, or 180.
238//
239// Returns:
240//   - amount: cumulative project-token reward collected from the tier, in token base units.
241//   - err: non-nil when the project or tier cannot be found.
242func GetProjectTierTotalCollectedAmount(projectId string, tier int64) (int64, error) {
243	return getImplementation().GetProjectTierTotalCollectedAmount(projectId, tier)
244}
245
246// GetProjectTierStartTime returns the start time of a project tier.
247//
248// Parameters:
249//   - projectId: unique identifier of the project containing the tier.
250//   - tier: tier duration key, such as 30, 90, or 180.
251//
252// Returns:
253//   - startTime: tier start timestamp in Unix seconds.
254//   - err: non-nil when the project or tier cannot be found.
255func GetProjectTierStartTime(projectId string, tier int64) (int64, error) {
256	return getImplementation().GetProjectTierStartTime(projectId, tier)
257}
258
259// GetProjectTierEndTime returns the end time of a project tier.
260//
261// Parameters:
262//   - projectId: unique identifier of the project containing the tier.
263//   - tier: tier duration key, such as 30, 90, or 180.
264//
265// Returns:
266//   - endTime: tier end timestamp in Unix seconds.
267//   - err: non-nil when the project or tier cannot be found.
268func GetProjectTierEndTime(projectId string, tier int64) (int64, error) {
269	return getImplementation().GetProjectTierEndTime(projectId, tier)
270}
271
272// GetDepositCount returns the total number of deposits.
273//
274// Returns:
275//   - count: number of deposit records currently stored.
276func GetDepositCount() int {
277	return getImplementation().GetDepositCount()
278}
279
280// GetCurrentDepositId returns the current deposit counter value.
281//
282// Returns:
283//   - depositId: current deposit counter value; it is not incremented by this read.
284func GetCurrentDepositId() int64 {
285	return getImplementation().GetCurrentDepositId()
286}
287
288// GetProjectTierRewards returns a read-only view of a project tier's reward
289// states, keyed by deposit ID. Reading an entry yields a clone, so the view
290// cannot mutate realm state. nil is returned when the project tier does not
291// exist.
292//
293// Parameters:
294//   - projectId: unique identifier of the project containing the tier.
295//   - tier: tier duration key, such as 30, 90, or 180.
296//
297// Returns:
298//   - rewards: read-only tree of reward states keyed by deposit ID; nil when the tier's reward manager is unavailable.
299func GetProjectTierRewards(projectId string, tier int64) *rotree.ReadOnlyTree {
300	return getImplementation().GetProjectTierRewards(projectId, tier)
301}
302
303// GetDeposit retrieves a deposit by its ID.
304//
305// Parameters:
306//   - depositId: unique identifier of the deposit to inspect.
307//
308// Returns:
309//   - deposit: stored deposit value.
310//   - err: non-nil when depositId does not identify a stored deposit.
311func GetDeposit(depositId string) (Deposit, error) {
312	return getImplementation().GetDeposit(depositId)
313}
314
315// GetDepositProjectID returns the project ID of a deposit by its ID.
316//
317// Parameters:
318//   - depositId: unique identifier of the deposit to inspect.
319//
320// Returns:
321//   - projectId: project identifier associated with the deposit.
322//   - err: non-nil when depositId does not identify a stored deposit.
323func GetDepositProjectID(depositId string) (string, error) {
324	return getImplementation().GetDepositProjectID(depositId)
325}
326
327// GetDepositTier returns the tier of a deposit by its ID.
328//
329// Parameters:
330//   - depositId: unique identifier of the deposit to inspect.
331//
332// Returns:
333//   - tier: tier duration key selected by the deposit.
334//   - err: non-nil when depositId does not identify a stored deposit.
335func GetDepositTier(depositId string) (int64, error) {
336	return getImplementation().GetDepositTier(depositId)
337}
338
339// GetDepositProjectTierID returns the project tier ID of a deposit by its ID.
340//
341// Parameters:
342//   - depositId: unique identifier of the deposit to inspect.
343//
344// Returns:
345//   - projectTierId: composite project-tier identifier derived from the deposit's project and tier.
346//   - err: non-nil when depositId does not identify a stored deposit.
347func GetDepositProjectTierID(depositId string) (string, error) {
348	return getImplementation().GetDepositProjectTierID(depositId)
349}
350
351// GetDepositAmount returns the deposit amount of a deposit by its ID.
352//
353// Parameters:
354//   - depositId: unique identifier of the deposit to inspect.
355//
356// Returns:
357//   - amount: GNS principal deposited, in base units.
358//   - err: non-nil when depositId does not identify a stored deposit.
359func GetDepositAmount(depositId string) (int64, error) {
360	return getImplementation().GetDepositAmount(depositId)
361}
362
363// GetDepositWithdrawnHeight returns the withdrawn height of a deposit by its ID.
364//
365// Parameters:
366//   - depositId: unique identifier of the deposit to inspect.
367//
368// Returns:
369//   - height: withdrawal block height; zero when the deposit has not been withdrawn.
370//   - err: non-nil when depositId does not identify a stored deposit.
371func GetDepositWithdrawnHeight(depositId string) (int64, error) {
372	return getImplementation().GetDepositWithdrawnHeight(depositId)
373}
374
375// GetDepositWithdrawnTime returns the withdrawn time of a deposit by its ID.
376//
377// Parameters:
378//   - depositId: unique identifier of the deposit to inspect.
379//
380// Returns:
381//   - withdrawnAt: withdrawal Unix timestamp in seconds; zero when the deposit has not been withdrawn.
382//   - err: non-nil when depositId does not identify a stored deposit.
383func GetDepositWithdrawnTime(depositId string) (int64, error) {
384	return getImplementation().GetDepositWithdrawnTime(depositId)
385}
386
387// GetDepositCreatedHeight returns the created height of a deposit by its ID.
388//
389// Parameters:
390//   - depositId: unique identifier of the deposit to inspect.
391//
392// Returns:
393//   - height: creation block height of the deposit.
394//   - err: non-nil when depositId does not identify a stored deposit.
395func GetDepositCreatedHeight(depositId string) (int64, error) {
396	return getImplementation().GetDepositCreatedHeight(depositId)
397}
398
399// GetDepositCreatedAt returns the created time of a deposit by its ID.
400//
401// Parameters:
402//   - depositId: unique identifier of the deposit to inspect.
403//
404// Returns:
405//   - createdAt: deposit creation Unix timestamp in seconds.
406//   - err: non-nil when depositId does not identify a stored deposit.
407func GetDepositCreatedAt(depositId string) (int64, error) {
408	return getImplementation().GetDepositCreatedAt(depositId)
409}
410
411// GetDepositEndTime returns the end time of a deposit by its ID.
412//
413// Parameters:
414//   - depositId: unique identifier of the deposit to inspect.
415//
416// Returns:
417//   - endTime: deposit lock/end Unix timestamp in seconds.
418//   - err: non-nil when depositId does not identify a stored deposit.
419func GetDepositEndTime(depositId string) (int64, error) {
420	return getImplementation().GetDepositEndTime(depositId)
421}
422
423// GetTotalGNSStakedAmount returns the total amount of GNS currently staked across all launchpad deposits.
424//
425// Returns:
426//   - amount: total GNS principal currently staked across launchpad deposits, in base units.
427func GetTotalGNSStakedAmount() int64 {
428	return getImplementation().GetTotalGNSStakedAmount()
429}
430
431// GetProjectTierRewardManagerCount returns the total number of reward managers.
432//
433// Returns:
434//   - count: number of project-tier reward managers currently stored.
435func GetProjectTierRewardManagerCount() int {
436	return getImplementation().GetProjectTierRewardManagerCount()
437}
438
439// GetProjectTierRewardManager retrieves a reward manager by project tier ID.
440// Returns a cloned reward manager to prevent external modification.
441//
442// Parameters:
443//   - projectTierId: composite project-tier identifier whose manager is requested.
444//
445// Returns:
446//   - rewardManager: cloned reward manager; nil when the implementation supplies no manager without an error.
447//   - err: non-nil when projectTierId does not identify a stored reward manager.
448func GetProjectTierRewardManager(projectTierId string) (*RewardManager, error) {
449	rewardManager, err := getImplementation().GetProjectTierRewardManager(projectTierId)
450	if err != nil {
451		return nil, err
452	}
453	if rewardManager == nil {
454		return nil, nil
455	}
456	return rewardManager.Clone(), nil
457}
458
459// GetProjectTierRewardDistributeAmountPerSecondX128 returns the distribute amount per second (Q128) of a reward manager.
460//
461// Parameters:
462//   - projectTierId: composite project-tier identifier whose manager is requested.
463//
464// Returns:
465//   - amountPerSecondX128: reward distribution rate per second in Q128 fixed-point token units; nil when no value is available.
466//   - err: non-nil when projectTierId does not identify a stored reward manager.
467func GetProjectTierRewardDistributeAmountPerSecondX128(projectTierId string) (*u256.Uint, error) {
468	amount, err := getImplementation().GetProjectTierRewardDistributeAmountPerSecondX128(projectTierId)
469	if err != nil {
470		return nil, err
471	}
472	if amount == nil {
473		return nil, nil
474	}
475	return amount.Clone(), nil
476}
477
478// GetProjectTierRewardAccumulatedRewardPerDepositX128 returns the accumulated reward per deposit (Q128) of a reward manager.
479//
480// Parameters:
481//   - projectTierId: composite project-tier identifier whose manager is requested.
482//
483// Returns:
484//   - accumulatedRewardPerDepositX128: accumulated reward index per deposited GNS unit in Q128 fixed-point units; nil when no value is available.
485//   - err: non-nil when projectTierId does not identify a stored reward manager.
486func GetProjectTierRewardAccumulatedRewardPerDepositX128(projectTierId string) (*u256.Uint, error) {
487	amount, err := getImplementation().GetProjectTierRewardAccumulatedRewardPerDepositX128(projectTierId)
488	if err != nil {
489		return nil, err
490	}
491	if amount == nil {
492		return nil, nil
493	}
494	return amount.Clone(), nil
495}
496
497// GetProjectTierRewardTotalDistributeAmount returns the total distribute amount of a reward manager.
498//
499// Parameters:
500//   - projectTierId: composite project-tier identifier whose manager is requested.
501//
502// Returns:
503//   - amount: total reward allocation managed for the project tier, in token base units.
504//   - err: non-nil when projectTierId does not identify a stored reward manager.
505func GetProjectTierRewardTotalDistributeAmount(projectTierId string) (int64, error) {
506	return getImplementation().GetProjectTierRewardTotalDistributeAmount(projectTierId)
507}
508
509// GetProjectTierRewardTotalClaimedAmount returns the total claimed amount of a reward manager.
510//
511// Parameters:
512//   - projectTierId: composite project-tier identifier whose manager is requested.
513//
514// Returns:
515//   - amount: total reward amount claimed from the manager, in token base units.
516//   - err: non-nil when projectTierId does not identify a stored reward manager.
517func GetProjectTierRewardTotalClaimedAmount(projectTierId string) (int64, error) {
518	return getImplementation().GetProjectTierRewardTotalClaimedAmount(projectTierId)
519}
520
521// GetProjectTierRewardDistributeStartTime returns the distribute start time of a reward manager.
522//
523// Parameters:
524//   - projectTierId: composite project-tier identifier whose manager is requested.
525//
526// Returns:
527//   - startTime: reward distribution start timestamp in Unix seconds.
528//   - err: non-nil when projectTierId does not identify a stored reward manager.
529func GetProjectTierRewardDistributeStartTime(projectTierId string) (int64, error) {
530	return getImplementation().GetProjectTierRewardDistributeStartTime(projectTierId)
531}
532
533// GetProjectTierRewardDistributeEndTime returns the distribute end time of a reward manager.
534//
535// Parameters:
536//   - projectTierId: composite project-tier identifier whose manager is requested.
537//
538// Returns:
539//   - endTime: reward distribution end timestamp in Unix seconds.
540//   - err: non-nil when projectTierId does not identify a stored reward manager.
541func GetProjectTierRewardDistributeEndTime(projectTierId string) (int64, error) {
542	return getImplementation().GetProjectTierRewardDistributeEndTime(projectTierId)
543}
544
545// GetProjectTierRewardAccumulatedDistributeAmount returns a legacy reward-manager field.
546// The v1 reward paths do not maintain it, so normal reads return zero unless it
547// was explicitly set.
548//
549// Parameters:
550//   - projectTierId: composite project-tier identifier whose manager is requested.
551//
552// Returns:
553//   - amount: legacy accumulated distribution amount in token base units; v1 accounting normally leaves it at zero unless explicitly set.
554//   - err: non-nil when projectTierId does not identify a stored reward manager.
555func GetProjectTierRewardAccumulatedDistributeAmount(projectTierId string) (int64, error) {
556	return getImplementation().GetProjectTierRewardAccumulatedDistributeAmount(projectTierId)
557}
558
559// GetProjectTierRewardAccumulatedTime returns the accumulated time of a reward manager.
560//
561// Parameters:
562//   - projectTierId: composite project-tier identifier whose manager is requested.
563//
564// Returns:
565//   - time: last reward-accumulation timestamp in Unix seconds, or zero before accumulation.
566//   - err: non-nil when projectTierId does not identify a stored reward manager.
567func GetProjectTierRewardAccumulatedTime(projectTierId string) (int64, error) {
568	return getImplementation().GetProjectTierRewardAccumulatedTime(projectTierId)
569}
570
571// GetProjectTierRewardClaimableDuration returns the reward claimable duration of a reward manager.
572//
573// Parameters:
574//   - projectTierId: composite project-tier identifier whose manager is requested.
575//
576// Returns:
577//   - duration: reward claimable window in seconds.
578//   - err: non-nil when projectTierId does not identify a stored reward manager.
579func GetProjectTierRewardClaimableDuration(projectTierId string) (int64, error) {
580	return getImplementation().GetProjectTierRewardClaimableDuration(projectTierId)
581}
582
583// GetRewardState retrieves a reward state by project tier ID and deposit ID.
584// Returns a cloned reward state to prevent external modification.
585//
586// Parameters:
587//   - projectTierId: composite project-tier identifier containing the reward state.
588//   - depositId: deposit identifier whose reward state is requested.
589//
590// Returns:
591//   - rewardState: cloned reward state; nil when the implementation supplies no state without an error.
592//   - err: non-nil when the reward manager or reward state cannot be found.
593func GetRewardState(projectTierId string, depositId string) (*RewardState, error) {
594	rewardState, err := getImplementation().GetRewardState(projectTierId, depositId)
595	if err != nil {
596		return nil, err
597	}
598	if rewardState == nil {
599		return nil, nil
600	}
601	return rewardState.Clone(), nil
602}
603
604// GetProjectActiveStatus returns whether a project is currently active.
605//
606// Parameters:
607//   - projectId: unique identifier of the project to inspect.
608//
609// Returns:
610//   - active: true when the project is active at the current Unix time; false when it is inactive.
611//   - err: non-nil when projectId does not identify a stored project.
612func GetProjectActiveStatus(projectId string) (bool, error) {
613	return getImplementation().GetProjectActiveStatus(projectId)
614}