# Contract

<figure><img src="/files/sPQgWx2WKx7894xnG4V4" alt=""><figcaption><p>Main</p></figcaption></figure>

[Github](https://github.com/currentxchange/loot)

### Loot Contract Actions

#### 📝 User Registration (`regnewuser`)

* **Purpose**: Registers a user on the contract, enabling participation in NFT staking and rewards.
* **Parameters**:
  * `user`: Account name to be registered.
  * `referrer`: (Optional) Account name of the referrer, if any.

#### 💰 Claiming Rewards (`claim`)

* **Purpose**: Allows users to claim accumulated rewards from staked NFTs.
* **Parameters**:
  * `user`: Account name claiming the rewards.
  * `collection`: Name of the NFT collection from which to claim rewards.

#### 🔄 Unstaking NFTs (`unstake`)

* **Purpose**: Enables users to remove their NFTs from staking, halting reward accumulation.
* **Parameters**:
  * `user`: Account name performing the unstake action.
  * `asset_ids`: List of NFT asset IDs to be unstaked.

#### 🔄 Resetting User Data (`resetuser`)

* **Purpose**: Clears a user's staking data and returns any staked NFTs.
* **Parameters**:
  * `user`: Account name whose data is to be reset.

#### 💸 Refunding Tokens (`refund`)

* **Purpose**: Issues a refund of tokens to a user under specific conditions.
* **Parameters**:
  * `user`: Recipient of the refund.
  * `collection`: Collection associated with the refund.
  * `refund_amount`: Amount of tokens to be refunded.

#### 🌐 Registering NFT Collection (`setnftcolrew`)

* **Purpose**: Sets up a new NFT collection for staking with specific reward parameters.
* **Parameters**:
  * `user`: Account initiating the registration.
  * `collection`: Collection name.
  * `token_symbol`: Token symbol for rewards.
  * `token_contract`: Contract managing the reward tokens.
  * `time_unit_length`: Length of time units for reward calculation.
  * `unstake_period`: Minimum staking period before NFTs can be unstaked.
  * `reward_series_referral`: Series for calculating referral rewards.
  * `reward_coefficient_referral`: Coefficient for referral reward calculation.
  * `reward_series_hodl`: Series for calculating holding rewards.
  * `reward_coefficient_hodl`: Coefficient for holding reward calculation.

#### ➕ Adding Eligible NFT Templates (`addtemplates`)

* **Purpose**: Includes NFT templates in the staking program of a collection.
* **Parameters**:
  * `user`: Account adding the templates.
  * `template_id`: ID of the template to be added.
  * `collection`: Collection to which the template belongs.
  * `timeunit_rate`: Reward rate per time unit for the template.

#### ➖ Removing NFT Templates (`rmtemplates`)

* **Purpose**: Excludes NFT templates from the staking program of a collection.
* **Parameters**:
  * `user`: Account removing the templates.
  * `template_id`: ID of the template to be removed.
  * `collection`: Collection from which the template is removed.

#### 🔔 Receiving NFTs (`receiveassets`)

* **Purpose**: Automatically stakes NFTs sent to the contract and updates user staking data.
* **Parameters**:
  * Handled through `atomicassets::transfer` notifications; no direct user parameters.

#### 📈 Handling Token Transfers (`on_transfer`)

* **Purpose**: Manages incoming token transfers to fund the contract's reward pool.
* **Parameters**:
  * Handled through token `transfer` notifications; the memo should contain the collection name.

<br>


---

# 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.cxc.world/loot/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.
