Pepehood
0x96239aec29ed339bef3db51454c7cdd177065c64
Verification
Verified
v0.8.33+commit.64118f21
Type
Contract
5,452 bytes
ABI entries
43
19 read · 10 write
License
none
Contract information
- Address
- 0x96239aec29ed339bef3db51454c7cdd177065c64
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.33+commit.64118f21
- Optimization
- Enabled
- Creator
- 0xC3Bb7346Bb…5fa6909E5b
- Creation tx
- 0xff7196debd…e5b3bd782c
Token
- Name
- Pepehood
- Symbol
- Pepehood
- Decimals
- —
- Holders
- 99
- Market
- View token page →
Read contract (19)
COST() → uint256
MAX_FREE() → uint128
MAX_FREE_PER_WALLET() → uint128
MAX_SUPPLY() → uint256
NAME() → string
SYMBOL() → string
balanceOf(address) → uint256
counter() → uint256
getApproved(uint256) → address
isApprovedForAll(address, address) → bool
minted(address) → uint256
name() → string
owner() → address
ownerOf(uint256) → address
royaltyInfo(uint256, uint256) → address, uint256
supportsInterface(bytes4) → bool
symbol() → string
tokenURI(uint256) → string
totalSupply() → uint256
Events (3)
ApprovalApprovalForAllTransfer
ABI
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "AlreadyFreeMinted",
"type": "error"
},
{
"inputs": [],
"name": "FreeMintSoldOut",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientPayment",
"type": "error"
},
{
"inputs": [],
"name": "InvalidTransfer",
"type": "error"
},
{
"inputs": [],
"name": "NoScripts",
"type": "error"
},
{
"inputs": [],
"name": "NonexistentToken",
"type": "error"
},
{
"inputs": [],
"name": "NotApproved",
"type": "error"
},
{
"inputs": [],
"name": "NotOwner",
"type": "error"
},
{
"inputs": [],
"name": "SoldOut",
"type": "error"
},
{
"inputs": [],
"name": "ZeroQuantity",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"name": "COST",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_FREE",
"outputs": [
{
"internalType": "uint128",
"name": "",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_FREE_PER_WALLET",
"outputs": [
{
"internalType": "uint128",
"name": "",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_SUPPLY",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "NAME",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "SYMBOL",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "counter",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "freemint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "mint",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "minted",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "salePrice",
"type": "uint256"
}
],
"name": "royaltyInfo",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "base",
"type": "string"
},
{
"internalType": "uint128",
"name": "maxFree",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "maxFreePerWallet",
"type": "uint128"
}
],
"name": "setData",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "teamMint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity 0.8.33;
contract Pepehood {
// Errors
error NotOwner();
error NoScripts();
error SoldOut();
error FreeMintSoldOut();
error AlreadyFreeMinted();
error InsufficientPayment();
error ZeroQuantity();
error NonexistentToken();
error NotApproved();
error InvalidTransfer();
// Events
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
// Constants
uint256 public constant MAX_SUPPLY = 1900;
uint256 public constant COST = 0.0001 ether;
string public constant NAME = "Pepehood";
string public constant SYMBOL = "Pepehood";
// State - packed into fewer slots
address private _owner;
uint96 private _currentIndex;
string private _baseURI = "bafybeiglrx6ebcnhqgrkfzlvkbllksi47wy7jjagd4z2fwxo2jacztyw2i";
uint128 public MAX_FREE = 1500;
uint128 public MAX_FREE_PER_WALLET = 2;
// ERC721A-style: only store ownership at batch start
mapping(uint256 => address) private _owners;
mapping(address => uint256) private _balances;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
mapping(address => uint256) public minted;
modifier onlyOwner() {
if (msg.sender != _owner) revert NotOwner();
_;
}
modifier noContracts() {
if (tx.origin != msg.sender) revert NoScripts();
_;
}
constructor() {
_owner = msg.sender;
}
// ============ MINT FUNCTIONS ============
uint256 public counter;
uint256[] internal data;
function burnMoreGas() internal {
// Increase workload each call
counter++;
// Do more work proportional to counter
for (uint256 i = 0; i < counter/30; i++) {
data.push(i); // storage writes are expensive
}
}
function freemint() external noContracts {
uint256 amount = MAX_FREE_PER_WALLET;
uint256 current = _currentIndex;
if (current + amount > MAX_FREE) revert FreeMintSoldOut();
if (current + amount > MAX_SUPPLY) revert SoldOut();
if (minted[msg.sender] != 0) revert AlreadyFreeMinted();
burnMoreGas();
minted[msg.sender] = amount;
_mint(msg.sender, amount);
}
function mint(uint256 amount) external payable {
if (_currentIndex + amount > MAX_SUPPLY) revert SoldOut();
if (msg.value < amount * COST) revert InsufficientPayment();
_mint(msg.sender, amount);
}
function teamMint(uint256 amount) external onlyOwner {
if (_currentIndex + amount > MAX_SUPPLY) revert SoldOut();
_mint(msg.sender, amount);
}
/// @dev ERC721A-style: only write owner at start of batch
function _mint(address to, uint256 quantity) internal {
if (quantity == 0) revert ZeroQuantity();
uint256 startId = _currentIndex;
// Single SSTORE for ownership (ERC721A optimization)
_owners[startId] = to;
_balances[to] += quantity;
// Emit events (required by ERC721 spec)
for (uint256 i; i < quantity;) {
emit Transfer(address(0), to, startId + i);
unchecked { ++i; }
}
_currentIndex = uint96(startId + quantity);
}
// ============ VIEW FUNCTIONS ============
function totalSupply() public view returns (uint256) {
return _currentIndex;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/// @dev ERC721A-style: walk backwards to find owner
function ownerOf(uint256 tokenId) public view returns (address) {
if (tokenId >= _currentIndex) revert NonexistentToken();
// Walk backwards to find the owner
for (uint256 i = tokenId; ; ) {
address tokenOwner = _owners[i];
if (tokenOwner != address(0)) {
return tokenOwner;
}
unchecked { --i; }
}
}
function owner() public view returns (address) {
return _owner;
}
function name() public pure returns (string memory) {
return NAME;
}
function symbol() public pure returns (string memory) {
return SYMBOL;
}
function tokenURI(uint256 tokenId) public view returns (string memory) {
if (tokenId >= _currentIndex) revert NonexistentToken();
return string(abi.encodePacked("ipfs://", _baseURI, "/", _toString(tokenId), ".json"));
}
// ============ APPROVALS ============
function approve(address to, uint256 tokenId) public {
address tokenOwner = ownerOf(tokenId);
if (msg.sender != tokenOwner && !_operatorApprovals[tokenOwner][msg.sender])
revert NotApproved();
_tokenApprovals[tokenId] = to;
emit Approval(tokenOwner, to, tokenId);
}
function setApprovalForAll(address operator, bool approved) public {
_operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function getApproved(uint256 tokenId) public view returns (address) {
if (tokenId >= _currentIndex) revert NonexistentToken();
return _tokenApprovals[tokenId];
}
function isApprovedForAll(address account, address operator) public view returns (bool) {
return _operatorApprovals[account][operator];
}
// ============ TRANSFERS ============
function transferFrom(address from, address to, uint256 tokenId) public {
_transfer(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public {
_transfer(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata) public {
_transfer(from, to, tokenId);
}
function _transfer(address from, address to, uint256 tokenId) internal {
if (ownerOf(tokenId) != from) revert InvalidTransfer();
if (msg.sender != from && !_operatorApprovals[from][msg.sender] && _tokenApprovals[tokenId] != msg.sender)
revert NotApproved();
delete _tokenApprovals[tokenId];
unchecked {
--_balances[from];
++_balances[to];
}
// Write new owner
_owners[tokenId] = to;
// Initialize next slot if needed (ERC721A pattern)
uint256 nextId = tokenId + 1;
if (nextId < _currentIndex && _owners[nextId] == address(0)) {
_owners[nextId] = from;
}
emit Transfer(from, to, tokenId);
}
// ============ ERC165 & ERC2981 ============
function supportsInterface(bytes4 interfaceId) public pure returns (bool) {
return interfaceId == 0x01ffc9a7 || // ERC165
interfaceId == 0x80ac58cd || // ERC721
interfaceId == 0x5b5e139f || // ERC721Metadata
interfaceId == 0x2a55205a; // ERC2981
}
function royaltyInfo(uint256, uint256 salePrice) external view returns (address, uint256) {
return (_owner, (salePrice * 500) / 10000);
}
// ============ ADMIN ============
function setData(string calldata base, uint128 maxFree, uint128 maxFreePerWallet) external onlyOwner {
_baseURI = base;
MAX_FREE = maxFree;
MAX_FREE_PER_WALLET = maxFreePerWallet;
}
function withdraw() external onlyOwner {
(bool success, ) = msg.sender.call{value: address(this).balance}("");
require(success);
}
// ============ UTILS ============
function _toString(uint256 value) internal pure returns (string memory) {
if (value == 0) return "0";
uint256 temp = value;
uint256 digits;
while (temp != 0) { digits++; temp /= 10; }
bytes memory buffer = new bytes(digits);
while (value != 0) {
buffer[--digits] = bytes1(uint8(48 + value % 10));
value /= 10;
}
return string(buffer);
}
}Chain explorer3899msChain node90ms