Contract detail
RobinBonsai
Live Robinhood Chain account facts for 0xd1b4d1af…f43445de with at least 8258 observed transactions. The history total is updating as indexing continues.
- Address type
- Smart contract
- Transactions
- 8258+ observed
- First indexed block
- #28614032
- Latest indexed block
- #61070925
- History coverage
- Recent activity available; total is catching up
- Native balance
- 0 ETH
- Balance observed at
- Block #36873039
- Funding transaction
- 0xec629929…4a16aacd in block #28649678
- Emitted events
- 9150
- Token tracker
- Robin Bonsai (RBONSAI)
- Verification
- Verified
- Compiler
- v0.8.28+commit.7893614a
- Verification match
- full
- Creation transaction
- 0x9d99e53d…5a8a8d7a
- Created at block
- #28614032
- Language
- solidity
- EVM version
- cancun
- License
- mit
- Compiler optimization
- Enabled · 200 runs
Related activity
Transactions
Verified contract
Contract source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ERC721Royalty} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
interface ITransferValidator721 {
function validateTransfer(address caller, address from, address to, uint256 tokenId) external view;
}
/// @notice ERC-721 creator-token interface used by OpenSea Seaport Hooks.
interface ICreatorToken {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction);
function setTransferValidator(address validator) external;
}
contract RobinBonsai is ERC721Royalty, Ownable2Step, ReentrancyGuard, ICreatorToken {
using Strings for uint256;
uint256 public constant MAX_SUPPLY = 7_777;
uint256 public constant TEAM_ALLOCATION = 300;
uint256 public constant MAX_PER_WALLET = 10;
uint256 public constant MAX_PER_TRANSACTION = 5;
uint256 public constant ROYALTY_BPS = 1_000; // 10%
address public immutable teamWallet;
uint256 public totalSupply;
uint256 public teamMinted;
uint256 public priceStep = 0.0001 ether;
bool public firstMintFree = true;
bool public saleActive;
bool public revealed;
bool public metadataFrozen;
string public placeholderURI;
string private baseTokenURI;
address private transferValidator;
mapping(address => uint256) public mintedByWallet;
error SaleClosed();
error InvalidQuantity();
error WalletLimit();
error SoldOut();
error WrongPayment(uint256 expected, uint256 received);
error MetadataIsFrozen();
error InvalidURI();
error InvalidAddress();
error WithdrawFailed();
error TeamAllocationExceeded();
event SaleStateUpdated(bool active);
event FirstMintFreeUpdated(bool enabled);
event PriceStepUpdated(uint256 oldPrice, uint256 newPrice);
event MetadataRevealed(string baseURI);
event MetadataFrozenForever(string baseURI);
event Withdrawal(address indexed receiver, uint256 amount);
constructor(address initialOwner, address royaltyReceiver, string memory initialPlaceholder)
ERC721("Robin Bonsai", "RBONSAI")
Ownable(initialOwner)
{
if (initialOwner == address(0) || royaltyReceiver == address(0)) revert InvalidAddress();
if (bytes(initialPlaceholder).length == 0) revert InvalidURI();
teamWallet = initialOwner;
placeholderURI = initialPlaceholder;
_setDefaultRoyalty(royaltyReceiver, uint96(ROYALTY_BPS));
}
/// @notice Exact price for a wallet's next `quantity` NFTs.
/// Token #1 is free while firstMintFree is enabled. Later lifetime tokens
/// cost 0.0001, 0.0002, ... 0.0009 ETH with the default priceStep.
function quote(address wallet, uint256 quantity) public view returns (uint256 totalPrice) {
if (quantity == 0 || quantity > MAX_PER_TRANSACTION) revert InvalidQuantity();
uint256 alreadyMinted = mintedByWallet[wallet];
if (alreadyMinted + quantity > MAX_PER_WALLET) revert WalletLimit();
for (uint256 i; i < quantity; ++i) {
uint256 lifetimeIndex = alreadyMinted + i; // 0 for the first NFT
if (lifetimeIndex == 0 && firstMintFree) continue;
totalPrice += firstMintFree ? lifetimeIndex * priceStep : (lifetimeIndex + 1) * priceStep;
}
}
function mint(uint256 quantity) external payable nonReentrant {
if (!saleActive) revert SaleClosed();
uint256 requiredValue = quote(msg.sender, quantity);
if (msg.value != requiredValue) revert WrongPayment(requiredValue, msg.value);
if (totalSupply + quantity > MAX_SUPPLY - (TEAM_ALLOCATION - teamMinted)) revert SoldOut();
mintedByWallet[msg.sender] += quantity;
uint256 firstId = totalSupply + 1;
totalSupply += quantity;
for (uint256 i; i < quantity; ++i) _safeMint(msg.sender, firstId + i);
}
function teamMint(uint256 quantity) external onlyOwner nonReentrant {
if (quantity == 0 || teamMinted + quantity > TEAM_ALLOCATION) revert TeamAllocationExceeded();
if (totalSupply + quantity > MAX_SUPPLY) revert SoldOut();
uint256 firstId = totalSupply + 1;
teamMinted += quantity;
totalSupply += quantity;
for (uint256 i; i < quantity; ++i) _safeMint(teamWallet, firstId + i);
}
function tokenURI(uint256 tokenId) public view override returns (string memory) {
_requireOwned(tokenId);
if (!revealed) return placeholderURI;
return string.concat(baseTokenURI, tokenId.toString(), ".json");
}
function setSaleActive(bool active) external onlyOwner {
saleActive = active;
emit SaleStateUpdated(active);
}
/// @notice Emergency anti-bot switch. When disabled, a wallet's first NFT
/// costs one priceStep instead of being free. Existing wallet counters remain intact.
function setFirstMintFree(bool enabled) external onlyOwner {
firstMintFree = enabled;
emit FirstMintFreeUpdated(enabled);
}
function setPriceStep(uint256 newPriceStep) external onlyOwner {
if (newPriceStep == 0) revert WrongPayment(1, 0);
uint256 oldPrice = priceStep;
priceStep = newPriceStep;
emit PriceStepUpdated(oldPrice, newPriceStep);
}
function setPlaceholderURI(string calldata value) external onlyOwner {
if (metadataFrozen) revert MetadataIsFrozen();
if (bytes(value).length == 0) revert InvalidURI();
placeholderURI = value;
}
function reveal(string calldata newBaseURI) external onlyOwner {
if (metadataFrozen) revert MetadataIsFrozen();
if (bytes(newBaseURI).length == 0) revert InvalidURI();
baseTokenURI = newBaseURI;
revealed = true;
emit MetadataRevealed(newBaseURI);
}
function freezeMetadata() external onlyOwner {
if (!revealed || bytes(baseTokenURI).length == 0) revert InvalidURI();
metadataFrozen = true;
emit MetadataFrozenForever(baseTokenURI);
}
function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
if (receiver == address(0) || feeNumerator > 1_000) revert InvalidAddress();
_setDefaultRoyalty(receiver, feeNumerator);
}
function withdraw(address payable receiver) external onlyOwner nonReentrant {
if (receiver == address(0)) revert InvalidAddress();
uint256 amount = address(this).balance;
(bool ok,) = receiver.call{value: amount}("");
if (!ok) revert WithdrawFailed();
emit Withdrawal(receiver, amount);
}
function getTransferValidator() external view returns (address validator) {
return transferValidator;
}
function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) {
return (ITransferValidator721.validateTransfer.selector, true);
}
function setTransferValidator(address validator) external onlyOwner {
address oldValidator = transferValidator;
transferValidator = validator;
emit TransferValidatorUpdated(oldValidator, validator);
}
function _update(address to, uint256 tokenId, address auth) internal override returns (address from) {
from = _ownerOf(tokenId);
// Mint and burn remain possible without marketplace validation.
if (from != address(0) && to != address(0) && transferValidator != address(0)) {
ITransferValidator721(transferValidator).validateTransfer(msg.sender, from, to, tokenId);
}
return super._update(to, tokenId, auth);
}
function supportsInterface(bytes4 interfaceId) public view override(ERC721Royalty) returns (bool) {
return super.supportsInterface(interfaceId);
}
}