> For the complete documentation index, see [llms.txt](https://buncha.gitbook.io/oas-jumbo-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://buncha.gitbook.io/oas-jumbo-1/jumbo-contract-raffle-logic.md).

# Jumbo! Contract（raffle logic）

## Jumbo! Contract

The block hash of the first block on the drawing day is used as the random number source.

The management will initiate a transaction after the lottery period ends and conduct a raffle　using the above blockhash.

## Detail

input: rank, index, \_blockhash, season MaxSupply

output: Token Id of the winner

input details

rank = grade of prize

index = number of prize winners

\_blockhash = 1st blockhash immediately after the raffle period ends

```
function _getSeasonRandomWinner(
        uint256 rank,
        uint256 index,
        bytes32 _blockhash,
        uint256 seasonMaxSupply
    ) internal pure returns (uint256) {
        uint256 random = uint256(keccak256(abi.encodePacked(rank, index, _blockhash))) % seasonMaxSupply;
        return random + 1; // 1 ~ seasonMaxSupply
    }
```
