> 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_condition.gno.md).

# project\_condition.gno

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

## Types

### ProjectCondition

```go
type ProjectCondition struct
```

ProjectCondition represents a condition for a project.

This struct contains the necessary data and methods to manage and distribute rewards for a specific project.

Fields:

* tokenPath (string): The path of the token associated with the project.
* minimumAmount (int64): The minimum amount of the token required for the project.

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

#### Methods

**CheckBalanceCondition**

```go
func (p *ProjectCondition) CheckBalanceCondition(
	inputTokenPath string,
	inputAmount int64
) error
```

CheckBalanceCondition validates an input token balance against this condition.

#### Parameters

| Name             | Type   | Description                                                                        |
| ---------------- | ------ | ---------------------------------------------------------------------------------- |
| `inputTokenPath` | string | token path whose balance is being checked; it must equal the condition token path. |
| `inputAmount`    | int64  | input token balance in base units; it must be at least the configured minimum.     |

#### Return Values

| Name  | Type  | Description                                                                                        |
| ----- | ----- | -------------------------------------------------------------------------------------------------- |
| `err` | error | nil when the token path and amount satisfy the condition; non-nil describing a mismatch otherwise. |

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

**Clone**

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

Clone returns an independent copy of this project condition.

#### Return Values

| Name        | Type               | Description                                                           |
| ----------- | ------------------ | --------------------------------------------------------------------- |
| `condition` | \*ProjectCondition | copied token path and minimum amount in a new ProjectCondition value. |

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

**IsAvailable**

```go
func (p *ProjectCondition) IsAvailable() bool
```

IsAvailable reports whether this condition has a non-empty token path and a positive minimum amount.

#### Return Values

| Name        | Type | Description                                                                  |
| ----------- | ---- | ---------------------------------------------------------------------------- |
| `available` | bool | true when both the token path and minimum amount are valid; false otherwise. |

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

**MinimumAmount**

```go
func (p *ProjectCondition) MinimumAmount() int64
```

MinimumAmount returns the minimum balance amount required by this condition.

#### Return Values

| Name            | Type  | Description                                                                                       |
| --------------- | ----- | ------------------------------------------------------------------------------------------------- |
| `minimumAmount` | int64 | minimum amount in the token's base units; values at or below zero make the condition unavailable. |

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

**TokenPath**

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

TokenPath returns the token contract path required by this condition.

#### Return Values

| Name        | Type   | Description                                                                    |
| ----------- | ------ | ------------------------------------------------------------------------------ |
| `tokenPath` | string | configured condition token path; an empty string means no token is configured. |

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

#### Constructors

* `func GetProjectCondition(projectId string, tokenPath string) (*ProjectCondition, error)` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/getter.gno#L76))
* `func NewProjectCondition(tokenPath string, minimumAmount int64) *ProjectCondition` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project_condition.gno#L88))
* `func NewProjectConditionsWithError(conditionTokens string, conditionAmounts string) ([]*ProjectCondition, error)` ([source](https://github.com/gnoswap-labs/gnoswap/blob/d9d34bd345a36c3eedaccf491c6615b0ac4168cd/contract/r/gnoswap/launchpad/project_condition.gno#L104))
