> For the complete documentation index, see [llms.txt](https://whitepaper.gmr.center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.gmr.center/gmr-center/leet-lotto/prize-security.md).

# Prize Security

Security is welded into every layer so winners get paid and funds stay safe.

### Contract Level

| Measure                       | Detail                                                                                                                         |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **Audited Logic**             | External audit covering all VRF, Automation and OpenZeppelin contracts, related to ticketing, prize draws and fund management. |
| **Re-entrancy Guards**        | Prevent double-spend exploits                                                                                                  |
| **Proper Nonce/Gas Handling** | Protects against replay and under-priced gas attacks                                                                           |

### Randomness & Fairness

* Chainlink VRF ensures random numbers no single party can predict or tamper with.
* VRF proof is stored on-chain so anyone can verify the winning ticket calculation.

### Prize Distribution

```solidity
// ⚠️ Simplified example
function _distribute(
    PrizeType prizeType,
    address recipient,
    uint256 amount,
    address erc20Token,
    address nftAddress,
    uint256 tokenId
) internal nonReentrant {
    if (prizeType == PrizeType.CURRENCY) {
        Address.sendValue(payable(recipient), amount);
    } else if (prizeType == PrizeType.ERC20) {
        SafeERC20.safeTransfer(IERC20(erc20Token), recipient, amount);
    } else {
        IERC721(nftAddress).safeTransferFrom(address(this), recipient, tokenId);
    }
}
```

* Currency and tokens transfer automatically on winner confirmation.
* NFTs delivered via `safeTransferFrom` to guarantee receipt.

### Ongoing Monitoring

* **Upkeep Alerts** via Chainlink keepers
* **Sentry** and **Datadog** watch contract events and subgraph health


---

# 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://whitepaper.gmr.center/gmr-center/leet-lotto/prize-security.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.
