PathrockNetwork Gno Explorer
HomeBlocksTransactionsRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/gnoswap/launchpad

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
launchpad
Namespace
gnoswap
Files
19 (README)(gnomod.toml)
Exported functions
71
Module
gno.land/r/gnoswap/launchpad
gno
0.9

Files (19)

  • README.mdmarkdown
  • gnomod.tomltoml
  • counter.gnogno
  • deposit.gnogno
  • doc.gnogno
  • errors.gnogno
  • getter_utils.gnogno
  • getter.gnogno
  • project_condition.gnogno
  • project_tier.gnogno
  • project.gnogno
  • proxy.gnogno
  • render.gnogno
  • reward_manager.gnogno
  • reward_state.gnogno
  • state.gnogno
  • store.gnogno
  • types.gnogno
  • upgrade.gnogno
  • project_condition.gnogno
    1package launchpad23import (4	"strconv"5	"strings"67	ufmt "gno.land/p/nt/ufmt/v0"8

    Functions

    • CollectDepositGns(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, depositID string) (int64, interface {Error func() string})

    • CollectEmissionReward(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})

    • CollectProtocolFee(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})

    • CollectProtocolFeeReward(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, tokenPath string)

    • CollectRewardByDepositId(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, depositID string) int64

    • CreateProject(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, name string, tokenPath string, recipient string, depositAmount int64, conditionTokens string, conditionAmounts string, tier30Ratio int64, tier90Ratio int64, tier180Ratio int64, startTime int64) string

    • DefaultDeposit() struct{depositor .uverse.address; id string; projectID string; tier int64; depositAmount int64; withdrawnHeight int64; withdrawnTime int64; createdHeight int64; createdAt int64; endTime int64}

    • DepositGns(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, targetProjectTierID string, depositAmount int64, referrer string) string

    • GetCurrentDepositId() int64

    • GetDeposit(depositId string) (struct{depositor .uverse.address; id string; projectID string; tier int64; depositAmount int64; withdrawnHeight int64; withdrawnTime int64; createdHeight int64; createdAt int64; endTime int64}, interface {Error func() string})

    • GetDepositAmount(depositId string) (int64, interface {Error func() string})

    • GetDepositCount() int

    • GetDepositCreatedAt(depositId string) (int64, interface {Error func() string})

    • GetDepositCreatedHeight(depositId string) (int64, interface {Error func() string})

    • GetDepositEndTime(depositId string) (int64, interface {Error func() string})

    • GetDepositProjectID(depositId string) (string, interface {Error func() string})

    • GetDepositProjectTierID(depositId string) (string, interface {Error func() string})

    • GetDepositTier(depositId string) (int64, interface {Error func() string})

    • GetDepositWithdrawnHeight(depositId string) (int64, interface {Error func() string})

    • GetDepositWithdrawnTime(depositId string) (int64, interface {Error func() string})

    • GetImplementationPackagePath() string

    • GetProjectActiveStatus(projectId string) (bool, interface {Error func() string})

    • GetProjectCondition(projectId string, tokenPath string) (*gno.land/r/gnoswap/launchpad.ProjectCondition, interface {Error func() string})

    • GetProjectCreatedAt(projectId string) (int64, interface {Error func() string})

    • GetProjectCreatedHeight(projectId string) (int64, interface {Error func() string})

    • GetProjectDepositAmount(projectId string) (int64, interface {Error func() string})

    • GetProjectName(projectId string) (string, interface {Error func() string})

    • GetProjectRecipient(projectId string) (string, interface {Error func() string})

    • GetProjects() *gno.land/p/nt/bptree/rotree/v0.ReadOnlyTree

    • GetProjectTier(projectId string, tier int64) (*gno.land/r/gnoswap/launchpad.ProjectTier, interface {Error func() string})

    • GetProjectTierDistributeAmountPerSecondX128(projectId string, tier int64) (*gno.land/p/gnoswap/uint256/v1.Uint, interface {Error func() string})

    • GetProjectTierEndTime(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTierRewardAccumulatedDistributeAmount(projectTierId string) (int64, interface {Error func() string})

    • GetProjectTierRewardAccumulatedRewardPerDepositX128(projectTierId string) (*gno.land/p/gnoswap/uint256/v1.Uint, interface {Error func() string})

    • GetProjectTierRewardAccumulatedTime(projectTierId string) (int64, interface {Error func() string})

    • GetProjectTierRewardClaimableDuration(projectTierId string) (int64, interface {Error func() string})

    • GetProjectTierRewardDistributeAmountPerSecondX128(projectTierId string) (*gno.land/p/gnoswap/uint256/v1.Uint, interface {Error func() string})

    • GetProjectTierRewardDistributeEndTime(projectTierId string) (int64, interface {Error func() string})

    • GetProjectTierRewardDistributeStartTime(projectTierId string) (int64, interface {Error func() string})

    • GetProjectTierRewardManager(projectTierId string) (*gno.land/r/gnoswap/launchpad.RewardManager, interface {Error func() string})

    • GetProjectTierRewardManagerCount() int

    • GetProjectTierRewards(projectId string, tier int64) *gno.land/p/nt/bptree/rotree/v0.ReadOnlyTree

    • GetProjectTierRewardTotalClaimedAmount(projectTierId string) (int64, interface {Error func() string})

    • GetProjectTierRewardTotalDistributeAmount(projectTierId string) (int64, interface {Error func() string})

    • GetProjectTiersRatios(projectId string) (map[int64]int64, interface {Error func() string})

    • GetProjectTierStartTime(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTierTotalCollectedAmount(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTierTotalDepositAmount(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTierTotalDepositCount(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTierTotalDistributeAmount(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTierTotalWithdrawAmount(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTierTotalWithdrawCount(projectId string, tier int64) (int64, interface {Error func() string})

    • GetProjectTokenPath(projectId string) (string, interface {Error func() string})

    • GetRewardState(projectTierId string, depositId string) (*gno.land/r/gnoswap/launchpad.RewardState, interface {Error func() string})

    • GetTotalGNSStakedAmount() int64

    • MakeDeposit(depositID string, projectID string, tier int64, depositor string, depositAmount int64, createdHeight int64, createdTime int64, endTime int64) struct{depositor .uverse.address; id string; projectID string; tier int64; depositAmount int64; withdrawnHeight int64; withdrawnTime int64; createdHeight int64; createdAt int64; endTime int64}

    • MakeProjectID(tokenPath string, createdHeight int64) string

    • MakeProjectTierID(projectID string, duration int64) string

    • NewBPTreeN(fanout int) *gno.land/p/nt/bptree/v0.BPTree

    • NewCounter() *gno.land/r/gnoswap/launchpad.Counter

    • NewLaunchpadStore(kvStore interface {AddAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error; Delete func(int, .uverse.realm, string) .uverse.error; Get func(string) (interface {}, .uverse.error); GetAddress func(string) (.uverse.address, .uverse.error); GetAllKeys func() ([]string, .uverse.error); GetAuthorizedCallers func() (map[.uverse.address]gno.land/p/gnoswap/store/v1.Permission, .uverse.error); GetBPTree func(string) (*gno.land/p/nt/bptree/v0.BPTree, .uverse.error); GetBool func(string) (bool, .uverse.error); GetDomainAddress func() .uverse.address; GetInt64 func(string) (int64, .uverse.error); GetString func(string) (string, .uverse.error); GetUint64 func(string) (uint64, .uverse.error); Has func(string) bool; IsWriteAuthorized func(.uverse.address) bool; RemoveAuthorizedCaller func(int, .uverse.realm, .uverse.address) .uverse.error; Set func(int, .uverse.realm, string, interface {}) .uverse.error; UpdateAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error}) interface {GetDepositCounter func() *gno.land/r/gnoswap/launchpad.Counter; GetDeposits func() *gno.land/p/nt/bptree/v0.BPTree; GetProjectRecipients func() *gno.land/p/nt/bptree/v0.BPTree; GetProjectTierRewardManagers func() *gno.land/p/nt/bptree/v0.BPTree; GetProjects func() *gno.land/p/nt/bptree/v0.BPTree; GetTotalGNSStakedAmount func() int64; HasDepositCounterStoreKey func() bool; HasDepositsKey func() bool; HasProjectRecipientsKey func() bool; HasProjectTierRewardManagersKey func() bool; HasProjectsKey func() bool; HasTotalGNSStakedAmountKey func() bool; NextDepositID func() string; SetDepositCounter func(int, .uverse.realm, *gno.land/r/gnoswap/launchpad.Counter) .uverse.error; SetDeposits func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetProjectRecipients func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetProjectTierRewardManagers func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetProjects func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error; SetTotalGNSStakedAmount func(int, .uverse.realm, int64) .uverse.error}

    • NewProject(name string, tokenPath string, depositAmount int64, recipient string, createdHeight int64, createdAt int64) *gno.land/r/gnoswap/launchpad.Project

    • NewProjectCondition(tokenPath string, minimumAmount int64) *gno.land/r/gnoswap/launchpad.ProjectCondition

    • NewProjectConditionsWithError(conditionTokens string, conditionAmounts string) ([]*gno.land/r/gnoswap/launchpad.ProjectCondition, interface {Error func() string})

    • NewProjectTier(projectID string, tierDuration int64, totalDistributeAmount int64, startTime int64, endTime int64) *gno.land/r/gnoswap/launchpad.ProjectTier

    • NewRewardManager(totalDistributeAmount int64, distributeStartTime int64, distributeEndTime int64, rewardCollectableDuration int64) *gno.land/r/gnoswap/launchpad.RewardManager

    • NewRewardState(accumulatedRewardPerDepositX128 *gno.land/p/gnoswap/uint256/v1.Uint, depositAmount int64, distributeStartTime int64, distributeEndTime int64, claimableTime int64) *gno.land/r/gnoswap/launchpad.RewardState

    • RegisterInitializer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, initializer func(int, .uverse.realm, gno.land/r/gnoswap/launchpad.ILaunchpadStore) gno.land/r/gnoswap/launchpad.ILaunchpad)

    • Render(path string) string

    • TransferLeftFromProjectByAdmin(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, projectID string, recipient string) int64

    • UpgradeImpl(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, packagePath string)

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    Rendered

    RenderedRawgnoweb ↗
    )
    9
    10const stringSplitterPad = "*PAD*"
    11
    12// ProjectCondition represents a condition for a project.
    13//
    14// This struct contains the necessary data and methods to manage and distribute
    15// rewards for a specific project.
    16//
    17// Fields:
    18// - tokenPath (string): The path of the token associated with the project.
    19// - minimumAmount (int64): The minimum amount of the token required for the project.
    20type ProjectCondition struct {
    21 tokenPath string
    22 minimumAmount int64
    23}
    24
    25// TokenPath returns the token contract path required by this condition.
    26//
    27// Returns:
    28// - tokenPath: configured condition token path; an empty string means no token is configured.
    29func (p *ProjectCondition) TokenPath() string {
    30 return p.tokenPath
    31}
    32
    33// MinimumAmount returns the minimum balance amount required by this condition.
    34//
    35// Returns:
    36// - minimumAmount: minimum amount in the token's base units; values at or below zero make the condition unavailable.
    37func (p *ProjectCondition) MinimumAmount() int64 {
    38 return p.minimumAmount
    39}
    40
    41// IsAvailable reports whether this condition has a non-empty token path and a positive minimum amount.
    42//
    43// Returns:
    44// - available: true when both the token path and minimum amount are valid; false otherwise.
    45func (p *ProjectCondition) IsAvailable() bool {
    46 return p.tokenPath != "" && p.minimumAmount > 0
    47}
    48
    49// CheckBalanceCondition validates an input token balance against this condition.
    50//
    51// Parameters:
    52// - inputTokenPath: token path whose balance is being checked; it must equal the condition token path.
    53// - inputAmount: input token balance in base units; it must be at least the configured minimum.
    54//
    55// Returns:
    56// - err: nil when the token path and amount satisfy the condition; non-nil describing a mismatch otherwise.
    57func (p *ProjectCondition) CheckBalanceCondition(inputTokenPath string, inputAmount int64) error {
    58 if p.tokenPath != inputTokenPath {
    59 return ufmt.Errorf("token path(%s) is not matched", inputTokenPath)
    60 }
    61
    62 if inputAmount < p.minimumAmount {
    63 return ufmt.Errorf("input amount(%d) is less than minimum amount(%d)", inputAmount, p.minimumAmount)
    64 }
    65
    66 return nil
    67}
    68
    69// Clone returns an independent copy of this project condition.
    70//
    71// Returns:
    72// - condition: copied token path and minimum amount in a new ProjectCondition value.
    73func (p ProjectCondition) Clone() *ProjectCondition {
    74 return &ProjectCondition{
    75 tokenPath: p.tokenPath,
    76 minimumAmount: p.minimumAmount,
    77 }
    78}
    79
    80// NewProjectCondition creates a project condition for a token path and minimum amount.
    81//
    82// Parameters:
    83// - tokenPath: token contract path whose balance is required.
    84// - minimumAmount: minimum balance in the token's base units.
    85//
    86// Returns:
    87// - condition: newly allocated project condition containing the supplied values.
    88func NewProjectCondition(tokenPath string, minimumAmount int64) *ProjectCondition {
    89 return &ProjectCondition{
    90 tokenPath: tokenPath,
    91 minimumAmount: minimumAmount,
    92 }
    93}
    94
    95// NewProjectConditionsWithError parses parallel *PAD*-separated token paths and minimum amounts.
    96//
    97// Parameters:
    98// - conditionTokens: *PAD*-separated token contract paths, in condition order.
    99// - conditionAmounts: *PAD*-separated decimal int64 minimum amounts paired by index with conditionTokens; entries beyond the token list are not consumed.
    100//
    101// Returns:
    102// - conditions: parsed available conditions in the same order as their token paths; empty when both inputs are empty.
    103// - err: nil on successful parsing; non-nil when a token lacks a matching amount, an amount is not a valid int64, or a condition is unavailable.
    104func NewProjectConditionsWithError(conditionTokens string, conditionAmounts string) ([]*ProjectCondition, error) {
    105 if conditionTokens == "" && conditionAmounts == "" {
    106 return []*ProjectCondition{}, nil
    107 }
    108
    109 conditions := []*ProjectCondition{}
    110
    111 tokenPaths := strings.Split(conditionTokens, stringSplitterPad)
    112 minimumAmounts := strings.Split(conditionAmounts, stringSplitterPad)
    113
    114 for index, tokenPath := range tokenPaths {
    115 if index >= len(minimumAmounts) {
    116 return nil, ufmt.Errorf("condition amount(%s) is not matched with condition token(%s)", conditionAmounts, conditionTokens)
    117 }
    118
    119 minimumAmount, err := strconv.ParseInt(minimumAmounts[index], 10, 64)
    120 if err != nil {
    121 return nil, ufmt.Errorf("condition amount(%s) is not a valid integer", minimumAmounts[index])
    122 }
    123
    124 condition := NewProjectCondition(tokenPath, minimumAmount)
    125 if !condition.IsAvailable() {
    126 return nil, ufmt.Errorf("condition(%s) is not available", condition.TokenPath())
    127 }
    128
    129 conditions = append(conditions, condition)
    130 }
    131
    132 return conditions, nil
    133}
    134

    vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.