> For the complete documentation index, see [llms.txt](https://gitbook.agorahub.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.agorahub.io/agoras-products/agoras-technology/loot-box-smart-contract.md).

# Loot Box smart contract

The LootBox smart contract, compatible with EVM and written in Solidity, implements the ERC721 protocol and lottery logic.  For generating pure random numbers, it integrates with ChainLink VRF. The contract is deployed through a modified Upgradable Proxy mechanism that supports multiple implementations concurrently. Key modules include:

* ERC721 implementation: Each loot box is an NFT, capable of changing states: LootBox -> Gem or Golden Ticket -> Burned. An intermediate locked state exists during the random number request. In its Gem or Golden Ticket state, it functions as a regular, tradable NFT.
* Prize Register: This module stores information about available prizes and their probabilities.
* Jackpot’s pool: Responsible for collecting and distributing jackpot prizes.
* Sale module: Manages the sale of loot boxes.
* Signature module: Verifies signatures of free tickets.
* Random module: Integrates with ChainLink VRF for getting random numbers.&#x20;
* Admin module: Provides an API for managing prizes, prices, and probabilities, with a role-based security system.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://gitbook.agorahub.io/agoras-products/agoras-technology/loot-box-smart-contract.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
