# Smart Contracts

* [DEGENFUSION](https://etherscan.io/address/0xa95f46a4251cbc11f9fb86021cd060c7ad13fdf6): 0xA95f46a4251CbC11F9FB86021cD060C7aD13fdF6
* [BOUNTY](https://etherscan.io/address/0x80d5c4e7a3b2fd6c376b2ab058e0a3d88931962e): 0x80d5C4E7A3B2FD6C376b2AB058e0a3d88931962e
* [TOKEN](https://etherscan.io/address/0xe062e38d16d949ffb0bd6b62ae2f7a3c930be1c4): 0xe062e38d16d949FFB0bD6b62ae2f7a3c930bE1C4
* [SOL TOKEN](https://solscan.io/token/BfzdNbV6pgLSs7KunQrhPBP1n8BYyF3d3op5xKzf9noK): BfzdNbV6pgLSs7KunQrhPBP1n8BYyF3d3op5xKzf9noK

### DEGENFUSION Contract

#### Core Game Actions

**`mintTier1(uint256 amountToMint)`**

* **Description**: Mints new Tier-1 NFTs by burning ERC-20 tokens
* **Parameters**:
  * `amountToMint`: Number of Tier-1 NFTs to mint
* **Requirements**:
  * User must have sufficient ERC-20 tokens (50 tokens per Tier-1 NFT)
  * Game must be started
* **Effects**:
  * Burns ERC-20 tokens from user
  * Mints Tier-1 NFTs to user
  * Updates Tier-1 supply

**`startMerge(uint256 _tier, uint256 pairsToMerge)`**

* **Description**: Initiates the merging of NFTs of the same tier to attempt upgrading to the next tier
* **Parameters**:
  * `_tier`: The tier of NFTs to merge
  * `pairsToMerge`: Number of NFT pairs to merge
* **Requirements**:
  * Tier must be valid (between 1 and maxTier-1)
  * User must have sufficient NFTs of the specified tier
  * For tiers 2+, tier must be unlocked based on time
  * User must have sufficient tokens for merge fees
* **Effects**:
  * Burns the specified NFTs from user
  * Burns tokens for merge fees
  * Initiates a VRF request for randomness
  * Registers the merge request

**`dismantle(uint256 _tier, uint256 amountToDismantle)`**

* **Description**: Dismantles NFTs of a specified tier to reclaim tokens
* **Parameters**:
  * `_tier`: Tier of NFTs to dismantle
  * `amountToDismantle`: Number of NFTs to dismantle
* **Requirements**:
  * Tier must be valid (between 1 and maxTier)
  * User must have sufficient NFTs of the specified tier
* **Effects**:
  * Burns the specified NFTs
  * Mints tokens to the user based on the dismantle value

**`reclaimMerge(uint256 requestId)`**

* **Description**: Reclaims NFTs from a pending merge that hasn't been fulfilled within the timeout period
* **Parameters**:
  * `requestId`: ID of the merge request to reclaim
* **Requirements**:
  * Merge must not be already fulfilled
  * User must be the initiator of the merge request
  * At least 15 minutes must have passed since the merge request
* **Effects**:
  * Returns the original NFTs to the user
  * Removes the pending merge request

#### View Functions

**`getUnlockTime(uint256 tier)`**

* **Description**: Returns the timestamp when a specified tier will be unlocked
* **Parameters**:
  * `tier`: The tier to check unlock time for
* **Returns**: Timestamp when the tier will be unlocked

**`uri(uint256 tierId)`**

* **Description**: Returns the URI for the metadata of a specific tier
* **Parameters**:
  * `tierId`: The tier ID to get the URI for
* **Returns**: String URI pointing to the metadata JSON

#### Public State Variables

* `gameStartTime`: Timestamp when the game started
* `gameStarted`: Boolean indicating if the game has started
* `keyHash`: Hash used for VRF
* `subId`: Subscription ID for VRF
* `callbackGasLimit`: Gas limit for VRF callbacks
* `baseURI`: Base URI for NFT metadata
* `reclaimTimer`: Constant for the time required before reclaiming (15 minutes)
* `tierUnlockTimer`: Constant for the time between tier unlocks (24 hours)
* `tier1Cost`: Constant for the cost of minting Tier-1 NFTs (50 tokens)
* `maxTier`: Constant for the maximum tier (6)
* `mergeFees`: Array of merge fees for each tier
* `dismantleValue`: Array of token values returned when dismantling each tier
* `supply`: Mapping of current supply for each tier
* `pendingMerges`: Mapping of pending merge requests
* `requestTimestamps`: Mapping of timestamps for merge requests
* `lastMergeRequest`: Mapping of the last merge request for each user
* `mergeResults`: Mapping of merge results

### Project02BountyV1 Contract

#### User Actions

**`claimBounty(uint256 bountyId)`**

* **Description**: Claims a bounty by transferring the required ERC-1155 tokens
* **Parameters**:
  * `bountyId`: ID of the bounty to claim
* **Requirements**:
  * setApprovalForAll (operator: 0x80d5C4E7A3B2FD6C376b2AB058e0a3d88931962e, approved: true) must be called on [DEGENFUSION contract](https://etherscan.io/address/0xa95f46a4251cbc11f9fb86021cd060c7ad13fdf6)
  * Bounty must exist
  * Bounty must not be already claimed
  * User must have the required tokens
* **Effects**:
  * Transfers the specified tokens from user to contract
  * Marks the bounty as claimed
  * Sends the reward to the user

#### View Functions

**`getBountyDetails(uint256 bountyId)`**

* **Description**: Returns the details of a specific bounty
* **Parameters**:
  * `bountyId`: ID of the bounty to get details for
* **Returns**:
  * `tokenContract`: Address of the ERC-1155 token contract
  * `tokenId`: ID of the required token
  * `quantity`: Number of tokens required
  * `reward`: Amount of ETH as reward
  * `available`: Boolean indicating if the bounty is still available

**`getBountyCount()`**

* **Description**: Returns the total number of bounties
* **Returns**: Total number of bounties created

#### Public State Variables

* `admin`: Address of the admin who can create and manage bounties
* `bounties`: Array of all bounties


---

# 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.project02.com/degen-fusion/smart-contracts.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.
