# Affiliate Contract

## Contract Structure

The contract is structured to handle affiliate-related functionalities, including checking conditions, managing bonuses, and setting parameters.

The Affiliate smart contract manages an affiliate program within the application. It:

* Checks if a member can invite new members based on specific conditions.
* Checks if a member is eligible to receive matching bonuses based on their staking and invitee activities.
* Stores and manages matching bonuses for members.
* Allows authorized users to set various conditions and parameters for the affiliate program.

## Role-based Access Control

The contract implements role-based access control with two roles:

* `BINAR`: Allows setting matching bonuses.
* `TIMELOCK`: Allows setting various contract parameters.

### Constants

* `TOTAL_MATCHING_PART`: Total matching bonus allocation.
* `BETTING_MATCHING_PART`: Matching bonus allocated for betting.
* `STAKING_MATCHING_PART`: Matching bonus allocated for staking.

### Storage

* `inviteStakingCondition`: Minimum staking condition required for inviting new members.
* `matchingStakingCondition`: Minimum staking condition required for receiving matching bonuses.
* `matchingInviteeCondition`: Minimum staking condition required for invitees to trigger matching bonuses.

## Events

* `NewMatchingBonus`: Triggered when a new matching bonus is set.
* `NewPass`: Triggered when a new instance of Pass contract is set.
* `NewConservativeStaking`: Triggered when a new instance of ConservativeStaking contract is set.
* `NewDynamicStaking`: Triggered when a new instance of DynamicStaking contract is set.
* `NewBetsMemory`: Triggered when a new instance of BetsMemory contract is set.
* `NewInviteStakingCondition`: Triggered when the invite staking condition is updated.
* `NewMatchingStakingCondition`: Triggered when the matching staking condition is updated.
* `NewMatchingInviteeCondition`: Triggered when the matching invitee condition is updated.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.celestium.digital/smartcontracts-description/affiliate-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
