MonkeyHoodRaffle

0x7866e5a6e5f95e8b2e8a386a3423c81059e3724e

Verification
Verified
0.8.34+commit.80d5c536
Type
Contract
5,593 bytes
ABI entries
22
12 read · 6 write
License
none

Contract information

Address
0x7866e5a6e5f95e8b2e8a386a3423c81059e3724e
Chain
Robinhood Chain (4663)
Compiler
0.8.34+commit.80d5c536
Optimization
Disabled
Creation tx
0x131b909518…397e1b86d8

Token

Not a token

This contract does not expose ERC-20 metadata.

Read contract (12)

entries(uint256)address
entryCount(address)uint256
entryFee()uint256
getEntries(uint256, uint256)address[]
getUniqueWallets()address[]
hasEntered(address)bool
owner()address
raffleOpen()bool
totalEntries()uint256
totalRaised()uint256
totalUniqueParticipants()uint256
uniqueWallets(uint256)address

Events (3)

EnteredRaffleClosedRaffleOpened

ABI

[
  {
    "inputs": [],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "participant",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "totalEntries",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "uniqueParticipants",
        "type": "uint256"
      }
    ],
    "name": "Entered",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "totalEntries",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "uniqueParticipants",
        "type": "uint256"
      }
    ],
    "name": "RaffleClosed",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [],
    "name": "RaffleOpened",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "closeRaffle",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "enter",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "name": "entries",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "name": "entryCount",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "entryFee",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "offset",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "limit",
        "type": "uint256"
      }
    ],
    "name": "getEntries",
    "outputs": [
      {
        "internalType": "address[]",
        "name": "",
        "type": "address[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getUniqueWallets",
    "outputs": [
      {
        "internalType": "address[]",
        "name": "",
        "type": "address[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "name": "hasEntered",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "openRaffle",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "owner",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "raffleOpen",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "_fee",
        "type": "uint256"
      }
    ],
    "name": "setEntryFee",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "totalEntries",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "totalRaised",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "totalUniqueParticipants",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_new",
        "type": "address"
      }
    ],
    "name": "transferOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "name": "uniqueWallets",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "withdraw",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

Source code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

// ─────────────────────────────────────────────────────────────────────────────
// CONTRACT 1 — Deploy on Robinhood Chain
// Handles: payments, participant list, treasury
// Each payment = one entry in the pool (more payments = more chances)
// Owner can close the raffle at any time to stop new entries
// ─────────────────────────────────────────────────────────────────────────────

contract MonkeyHoodRaffle {
    address public owner;
    uint256 public entryFee  = 0.000003 ether; // ~$0.01
    bool    public raffleOpen = true;

    // Each entry push — same wallet can appear multiple times
    // More entries = more chances when VRF picks winner indices
    address[] public entries;

    // Unique wallets that have entered at least once
    address[] public uniqueWallets;
    mapping(address => bool) public hasEntered;
    mapping(address => uint256) public entryCount;

    event Entered(address indexed participant, uint256 totalEntries, uint256 uniqueParticipants);
    event RaffleClosed(uint256 totalEntries, uint256 uniqueParticipants);
    event RaffleOpened();

    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    constructor() {
        owner = msg.sender;
    }

    function enter() external payable {
        require(raffleOpen, "Raffle is closed");
        require(msg.value >= entryFee, "Send at least 0.000003 ETH");

        // Each payment gets one slot in the pool
        entries.push(msg.sender);
        entryCount[msg.sender]++;

        // Track unique wallets separately
        if (!hasEntered[msg.sender]) {
            uniqueWallets.push(msg.sender);
            hasEntered[msg.sender] = true;
        }

        emit Entered(msg.sender, entries.length, uniqueWallets.length);
    }

    // Owner closes raffle — no new entries after this
    function closeRaffle() external onlyOwner {
        raffleOpen = false;
        emit RaffleClosed(entries.length, uniqueWallets.length);
    }

    // Owner can reopen if needed
    function openRaffle() external onlyOwner {
        raffleOpen = true;
        emit RaffleOpened();
    }

    // Paginated entry pool — use offset + limit to read in chunks
    // e.g. getEntries(0, 500) → first 500, getEntries(500, 500) → next 500
    // Index picked by VRF → entries[index] = winner wallet
    function getEntries(uint256 offset, uint256 limit) external view returns (address[] memory) {
        uint256 total = entries.length;
        if (offset >= total) return new address[](0);
        uint256 end = offset + limit > total ? total : offset + limit;
        uint256 size = end - offset;
        address[] memory page = new address[](size);
        for (uint256 i = 0; i < size; i++) {
            page[i] = entries[offset + i];
        }
        return page;
    }

    // Unique wallets only
    function getUniqueWallets() external view returns (address[] memory) {
        return uniqueWallets;
    }

    function totalEntries() external view returns (uint256) {
        return entries.length;
    }

    function totalUniqueParticipants() external view returns (uint256) {
        return uniqueWallets.length;
    }

    function totalRaised() external view returns (uint256) {
        return address(this).balance;
    }

    function withdraw() external onlyOwner {
        uint256 bal = address(this).balance;
        require(bal > 0, "Nothing to withdraw");
        (bool ok, ) = payable(owner).call{value: bal}("");
        require(ok, "Transfer failed");
    }

    function setEntryFee(uint256 _fee) external onlyOwner {
        entryFee = _fee;
    }

    function transferOwnership(address _new) external onlyOwner {
        require(_new != address(0), "Invalid");
        owner = _new;
    }
}
Chain explorer1952msChain node76ms