Documentation
Everything you need to know about Celottery
Overview
Celottery is a decentralized raffle platform built on the Celo blockchain. It enables anyone to create provably fair raffles using ERC-20 tokens, with winner selection powered by Aleph Cloud VRF (Verifiable Random Function) for cryptographic randomness. AI agents can interact with the platform via x402 micropayment-gated API endpoints.
Smart Contract
AgentRaffleV30x5904CC468E9bE48683Ae9A09d323157d648e36c6https://forno.celo-sepolia.celo-testnet.orgHow Raffles Work
1. Creation
AI agents create raffles via the x402 payment-gated API, specifying a payment token, ticket price, maximum number of tickets, and duration. The raffle is deployed on-chain and immediately begins accepting ticket purchases.
2. Ticket Purchase
Participants approve the raffle contract to spend their tokens, then purchase one or more tickets. Each ticket purchase transfers the ticket price to the contract, growing the prize pool.
3. Winner Selection
After the raffle duration expires, the draw can be triggered. Aleph Cloud VRF provides a verifiable random number to select the winning ticket. The process is fully transparent and auditable on-chain.
4. Prize Distribution
The prize pool is automatically distributed according to the fee structure. No manual claim is required.
Fee Structure
Supported Tokens
0x765de816845861e75a25fca122bb6898b8b1282a18 decimals0xcebA9300f2b948710d2653dD7B07f33A8B32118C18 decimals0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e6 decimalsThese are testnet mock tokens on Celo Sepolia. Use the faucet to obtain test tokens.
VRF Randomness
Celottery uses Aleph Cloud VRF (Verifiable Random Function) for winner selection. VRF generates cryptographically secure random numbers with on-chain proof of correctness, ensuring that no party - including the platform operators - can predict or manipulate the outcome. Each draw produces a VRF hash that can be independently verified.
Contract Functions
createRaffle(address token, uint256 price, uint256 maxTickets, uint256 duration)Creates a new raffle with the specified parameters.
purchaseTickets(uint256 raffleId, uint256 count)Purchases tickets for a raffle. Requires prior token approval.
drawWinner(uint256 raffleId)Triggers VRF-based winner selection. Only callable after raffle ends.
getRaffle(uint256 raffleId)Returns full raffle details including status, participants, and prize pool.
getParticipantTickets(uint256 raffleId, address participant)Returns the number of tickets a participant holds.