project.gno
MakeProjectID
func MakeProjectID(
tokenPath string,
createdHeight int64
) stringMakeProjectID combines a token path and creation height into a project identifier.
Parameters
tokenPath
string
token path associated with the project.
createdHeight
int64
block height at which the project was created.
Return Values
projectID
string
identifier in "{tokenPath}:{createdHeight}" form.
Types
Project
Project represents a launchpad project.
This struct contains the necessary data and methods to manage and distribute rewards for a specific project.
Fields:
id (string): The unique identifier for the project, formatted as "{tokenPath}:{createdHeight}".
name (string): The name of the project.
tokenPath (string): The path of the token associated with the project.
depositAmount (int64): The total amount of tokens deposited for the project.
recipient (address): The address to receive the project's rewards.
conditions (map[string]*ProjectCondition): A map of token paths to their associated conditions.
tiers (map[int64]*ProjectTier): A map of tier durations to their associated tiers.
tiersRatios (map[int64]int64): A map of tier durations to their associated ratios.
createdHeight (int64): The block height at which the project was created.
createdAt (int64): The Unix timestamp at which the project was created.
Methods
Clone
Clone returns a deep-enough copy of the project for independent map and nested condition/tier mutation; scalar fields are copied directly.
Return Values
clone
*Project
project copy with independently allocated condition, tier, and ratio maps.
Conditions
Conditions returns a copy of the project's token deposit conditions.
Return Values
conditions
map[string]*ProjectCondition
map from token path to cloned condition values; mutations do not alter project state.
CreatedAt
CreatedAt returns the Unix timestamp at which the project was created.
Return Values
time
int64
project creation Unix timestamp.
CreatedHeight
CreatedHeight returns the block height at which the project was created.
Return Values
height
int64
project creation block height.
DepositAmount
DepositAmount returns the total reward-token allocation configured for the project.
Return Values
amount
int64
project reward-token allocation.
GetTier
GetTier returns a copy of the project's tier for one duration.
Parameters
duration
int64
tier duration in seconds.
Return Values
tier
*ProjectTier
cloned tier configuration for the duration, or nil when absent.
err
error
non-nil when no tier is configured for duration.
ID
ID returns the project identifier in "{tokenPath}:{createdHeight}" form.
Return Values
id
string
unique identifier assigned to this project.
IsRecipient
IsRecipient reports whether recipient matches the project's configured recipient address.
Parameters
recipient
address
address to compare with the configured project recipient.
Return Values
matches
bool
true when recipient is the configured project recipient.
Name
Name returns the project's human-readable name.
Return Values
name
string
stored project name.
Recipient
Recipient returns the address authorized to receive the project's rewards.
Return Values
recipient
address
configured project recipient address.
SetCondition
SetCondition replaces one token-path deposit condition in the project-owned map.
Parameters
tokenPath
string
token path whose condition is replaced.
condition
*ProjectCondition
required balance condition for that token path.
SetConditions
SetConditions replaces the project's token deposit conditions. The map and its entries are retained in the project realm for later mutation.
Parameters
conditions
map[string]*ProjectCondition
map from required token path to its deposit condition.
SetCreatedAt
SetCreatedAt replaces the project's creation timestamp.
Parameters
time
int64
Unix timestamp to store as the project creation time.
SetCreatedHeight
SetCreatedHeight replaces the project's creation block height.
Parameters
height
int64
block height to store as the project creation height.
SetDepositAmount
SetDepositAmount replaces the project's total reward-token allocation.
Parameters
amount
int64
total reward-token amount allocated to the project.
SetID
SetID replaces the project's identifier.
Parameters
id
string
project identifier to store, normally in "{tokenPath}:{createdHeight}" form.
SetName
SetName replaces the project's human-readable name.
Parameters
name
string
project name to store.
SetRecipient
SetRecipient replaces the address authorized to receive project rewards.
Parameters
recipient
address
address to store as the project recipient.
SetTier
SetTier replaces one duration entry in the project-owned tier map.
Parameters
duration
int64
tier duration in seconds used as the map key.
tier
*ProjectTier
tier configuration to store for duration.
SetTiers
SetTiers replaces the project's tier map with a project-owned map.
Parameters
tiers
map[int64]*ProjectTier
map from tier duration in seconds to its tier configuration.
SetTiersRatios
SetTiersRatios replaces the project's tier allocation ratios.
Parameters
tiersRatios
map[int64]int64
map from tier duration in seconds to its reward allocation ratio.
SetTokenPath
SetTokenPath replaces the project's reward-token path.
Parameters
tokenPath
string
token path to store as the project's reward token.
Tiers
Tiers returns a copy of the project's configured duration-to-tier map.
Return Values
tiers
map[int64]*ProjectTier
map from tier duration in seconds to cloned tier values.
TiersRatios
TiersRatios returns reward allocation ratios keyed by tier duration.
Return Values
ratios
map[int64]int64
map from tier duration in seconds to its allocation ratio.
TokenPath
TokenPath returns the token path whose tokens are distributed as project rewards.
Return Values
tokenPath
string
configured project reward-token path.
Constructors
func NewProject(name string, tokenPath string, depositAmount int64, recipient address, createdHeight int64, createdAt int64) *Project(source)
Last updated