For the complete documentation index, see llms.txt. This page is also available as Markdown.

project.gno

MakeProjectID

func MakeProjectID(
	tokenPath string,
	createdHeight int64
) string

MakeProjectID combines a token path and creation height into a project identifier.

Parameters

Name
Type
Description

tokenPath

string

token path associated with the project.

createdHeight

int64

block height at which the project was created.

Return Values

Name
Type
Description

projectID

string

identifier in "{tokenPath}:{createdHeight}" form.

source

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.

source

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

Name
Type
Description

clone

*Project

project copy with independently allocated condition, tier, and ratio maps.

source

Conditions

Conditions returns a copy of the project's token deposit conditions.

Return Values

Name
Type
Description

conditions

map[string]*ProjectCondition

map from token path to cloned condition values; mutations do not alter project state.

source

CreatedAt

CreatedAt returns the Unix timestamp at which the project was created.

Return Values

Name
Type
Description

time

int64

project creation Unix timestamp.

source

CreatedHeight

CreatedHeight returns the block height at which the project was created.

Return Values

Name
Type
Description

height

int64

project creation block height.

source

DepositAmount

DepositAmount returns the total reward-token allocation configured for the project.

Return Values

Name
Type
Description

amount

int64

project reward-token allocation.

source

GetTier

GetTier returns a copy of the project's tier for one duration.

Parameters

Name
Type
Description

duration

int64

tier duration in seconds.

Return Values

Name
Type
Description

tier

*ProjectTier

cloned tier configuration for the duration, or nil when absent.

err

error

non-nil when no tier is configured for duration.

source

ID

ID returns the project identifier in "{tokenPath}:{createdHeight}" form.

Return Values

Name
Type
Description

id

string

unique identifier assigned to this project.

source

IsRecipient

IsRecipient reports whether recipient matches the project's configured recipient address.

Parameters

Name
Type
Description

recipient

address

address to compare with the configured project recipient.

Return Values

Name
Type
Description

matches

bool

true when recipient is the configured project recipient.

source

Name

Name returns the project's human-readable name.

Return Values

Name
Type
Description

name

string

stored project name.

source

Recipient

Recipient returns the address authorized to receive the project's rewards.

Return Values

Name
Type
Description

recipient

address

configured project recipient address.

source

SetCondition

SetCondition replaces one token-path deposit condition in the project-owned map.

Parameters

Name
Type
Description

tokenPath

string

token path whose condition is replaced.

condition

*ProjectCondition

required balance condition for that token path.

source

SetConditions

SetConditions replaces the project's token deposit conditions. The map and its entries are retained in the project realm for later mutation.

Parameters

Name
Type
Description

conditions

map[string]*ProjectCondition

map from required token path to its deposit condition.

source

SetCreatedAt

SetCreatedAt replaces the project's creation timestamp.

Parameters

Name
Type
Description

time

int64

Unix timestamp to store as the project creation time.

source

SetCreatedHeight

SetCreatedHeight replaces the project's creation block height.

Parameters

Name
Type
Description

height

int64

block height to store as the project creation height.

source

SetDepositAmount

SetDepositAmount replaces the project's total reward-token allocation.

Parameters

Name
Type
Description

amount

int64

total reward-token amount allocated to the project.

source

SetID

SetID replaces the project's identifier.

Parameters

Name
Type
Description

id

string

project identifier to store, normally in "{tokenPath}:{createdHeight}" form.

source

SetName

SetName replaces the project's human-readable name.

Parameters

Name
Type
Description

name

string

project name to store.

source

SetRecipient

SetRecipient replaces the address authorized to receive project rewards.

Parameters

Name
Type
Description

recipient

address

address to store as the project recipient.

source

SetTier

SetTier replaces one duration entry in the project-owned tier map.

Parameters

Name
Type
Description

duration

int64

tier duration in seconds used as the map key.

tier

*ProjectTier

tier configuration to store for duration.

source

SetTiers

SetTiers replaces the project's tier map with a project-owned map.

Parameters

Name
Type
Description

tiers

map[int64]*ProjectTier

map from tier duration in seconds to its tier configuration.

source

SetTiersRatios

SetTiersRatios replaces the project's tier allocation ratios.

Parameters

Name
Type
Description

tiersRatios

map[int64]int64

map from tier duration in seconds to its reward allocation ratio.

source

SetTokenPath

SetTokenPath replaces the project's reward-token path.

Parameters

Name
Type
Description

tokenPath

string

token path to store as the project's reward token.

source

Tiers

Tiers returns a copy of the project's configured duration-to-tier map.

Return Values

Name
Type
Description

tiers

map[int64]*ProjectTier

map from tier duration in seconds to cloned tier values.

source

TiersRatios

TiersRatios returns reward allocation ratios keyed by tier duration.

Return Values

Name
Type
Description

ratios

map[int64]int64

map from tier duration in seconds to its allocation ratio.

source

TokenPath

TokenPath returns the token path whose tokens are distributed as project rewards.

Return Values

Name
Type
Description

tokenPath

string

configured project reward-token path.

source

Constructors

  • func NewProject(name string, tokenPath string, depositAmount int64, recipient address, createdHeight int64, createdAt int64) *Project (source)

Last updated