> For the complete documentation index, see [llms.txt](https://docs.gnoswap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gnoswap.io/contracts/launchpad/project.gno.md).

# project.gno

{% embed url="<https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno>" %}

## MakeProjectID

```go
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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L340)

## Types

### Project

```go
type Project struct
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L23)

#### Methods

**Clone**

```go
func (p Project) Clone() *Project
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L302)

**Conditions**

```go
func (p *Project) Conditions() map[string]*ProjectCondition
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L120)

**CreatedAt**

```go
func (p *Project) CreatedAt() int64
```

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

#### Return Values

| Name   | Type  | Description                      |
| ------ | ----- | -------------------------------- |
| `time` | int64 | project creation Unix timestamp. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L214)

**CreatedHeight**

```go
func (p *Project) CreatedHeight() int64
```

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

#### Return Values

| Name     | Type  | Description                    |
| -------- | ----- | ------------------------------ |
| `height` | int64 | project creation block height. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L198)

**DepositAmount**

```go
func (p *Project) DepositAmount() int64
```

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

#### Return Values

| Name     | Type  | Description                      |
| -------- | ----- | -------------------------------- |
| `amount` | int64 | project reward-token allocation. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L88)

**GetTier**

```go
func (p *Project) GetTier(
	duration int64
) (*ProjectTier, error)
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L234)

**ID**

```go
func (p *Project) ID() string
```

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

#### Return Values

| Name | Type   | Description                                 |
| ---- | ------ | ------------------------------------------- |
| `id` | string | unique identifier assigned to this project. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L40)

**IsRecipient**

```go
func (p *Project) IsRecipient(
	recipient address
) bool
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L259)

**Name**

```go
func (p *Project) Name() string
```

Name returns the project's human-readable name.

#### Return Values

| Name   | Type   | Description          |
| ------ | ------ | -------------------- |
| `name` | string | stored project name. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L56)

**Recipient**

```go
func (p *Project) Recipient() address
```

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

#### Return Values

| Name        | Type    | Description                           |
| ----------- | ------- | ------------------------------------- |
| `recipient` | address | configured project recipient address. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L104)

**SetCondition**

```go
func (p *Project) SetCondition(
	tokenPath string,
	condition *ProjectCondition
)
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L148)

**SetConditions**

```go
func (p *Project) SetConditions(
	conditions map[string]*ProjectCondition
)
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L135)

**SetCreatedAt**

```go
func (p *Project) SetCreatedAt(
	time int64
)
```

SetCreatedAt replaces the project's creation timestamp.

#### Parameters

| Name   | Type  | Description                                           |
| ------ | ----- | ----------------------------------------------------- |
| `time` | int64 | Unix timestamp to store as the project creation time. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L222)

**SetCreatedHeight**

```go
func (p *Project) SetCreatedHeight(
	height int64
)
```

SetCreatedHeight replaces the project's creation block height.

#### Parameters

| Name     | Type  | Description                                           |
| -------- | ----- | ----------------------------------------------------- |
| `height` | int64 | block height to store as the project creation height. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L206)

**SetDepositAmount**

```go
func (p *Project) SetDepositAmount(
	amount int64
)
```

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

#### Parameters

| Name     | Type  | Description                                         |
| -------- | ----- | --------------------------------------------------- |
| `amount` | int64 | total reward-token amount allocated to the project. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L96)

**SetID**

```go
func (p *Project) SetID(
	id string
)
```

SetID replaces the project's identifier.

#### Parameters

| Name | Type   | Description                                                                  |
| ---- | ------ | ---------------------------------------------------------------------------- |
| `id` | string | project identifier to store, normally in "{tokenPath}:{createdHeight}" form. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L48)

**SetName**

```go
func (p *Project) SetName(
	name string
)
```

SetName replaces the project's human-readable name.

#### Parameters

| Name   | Type   | Description            |
| ------ | ------ | ---------------------- |
| `name` | string | project name to store. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L64)

**SetRecipient**

```go
func (p *Project) SetRecipient(
	recipient address
)
```

SetRecipient replaces the address authorized to receive project rewards.

#### Parameters

| Name        | Type    | Description                                |
| ----------- | ------- | ------------------------------------------ |
| `recipient` | address | address to store as the project recipient. |

[source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L112)

**SetTier**

```go
func (p *Project) SetTier(
	duration int64,
	tier *ProjectTier
)
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L248)

**SetTiers**

```go
func (p *Project) SetTiers(
	tiers map[int64]*ProjectTier
)
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L170)

**SetTiersRatios**

```go
func (p *Project) SetTiersRatios(
	tiersRatios map[int64]int64
)
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L190)

**SetTokenPath**

```go
func (p *Project) SetTokenPath(
	tokenPath string
)
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L80)

**Tiers**

```go
func (p *Project) Tiers() map[int64]*ProjectTier
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L156)

**TiersRatios**

```go
func (p *Project) TiersRatios() map[int64]int64
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L182)

**TokenPath**

```go
func (p *Project) TokenPath() string
```

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](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L72)

#### Constructors

* `func NewProject(name string, tokenPath string, depositAmount int64, recipient address, createdHeight int64, createdAt int64) *Project` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project.gno#L275))
