Robinhood MainnetChain ID: 4663
Contract detail

BrokerMachines

Live Robinhood Chain account facts for 0x59202d37…a63439bb with at least 113 observed transactions. The history total is updating as indexing continues.

Address type
Smart contract
Transactions
113+ observed
First indexed block
#62278416
Latest indexed block
#75445655
History coverage
Recent activity available; total is catching up
Emitted events
302
Verification
Verified
Compiler
0.8.20+commit.a1b79de6
Verification match
exact
Creation transaction
0xddd3aee4…4e03172c
Created at block
#62278416
Language
Solidity
License
MIT
Compiler optimization
Enabled · 200 runs
Deployed bytecode hash
0x5092b307299b4d3db232b29baeb6b90f745ff258a7b24829299fa7e0bcbd2482
Related activity

Transactions

Verified contract

Contract source code

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

import "@limitbreak/creator-token-standards/src/erc721c/ERC721C.sol";
import "@limitbreak/creator-token-standards/src/token/erc721/ERC721OpenZeppelin.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract BrokerMachines is ERC721C, Ownable, IERC2981 {
    using Strings for uint256;

    enum MintMode {
        AllPaid,
        AllFree,
        FirstFreeThenPaid
    }

    uint256 public constant MAX_SUPPLY = 4444;
    uint96 public constant ROYALTY_BPS = 1000;

    uint256 public totalMinted;
    uint256 public teamMinted;
    uint256 public publicMinted;
    bool public mintOpen;
    string private baseTokenURI;

    uint256 public publicWalletLimit = 5;
    uint256 public teamSupplyLimit = 222;
    uint256 public freePerWallet = 1;
    uint256 public mintPrice = 0.0002 ether;
    MintMode public mintMode = MintMode.FirstFreeThenPaid;

    mapping(address => uint256) public publicMintsByWallet;

    event MintOpenUpdated(bool open);
    event BaseURIUpdated(string baseURI);
    event MintModeUpdated(MintMode mode);
    event MintPriceUpdated(uint256 price);
    event PublicWalletLimitUpdated(uint256 limit);
    event TeamSupplyLimitUpdated(uint256 limit);
    event FreePerWalletUpdated(uint256 quantity);
    event PublicMint(address indexed minter, uint256 quantity, uint256 paidAmount);
    event TeamMint(address indexed to, uint256 quantity);
    event Withdraw(address indexed to, uint256 amount);

    constructor(address owner_, string memory initialBaseURI)
        ERC721OpenZeppelin("Broker Machines", "BMACH")
    {
        require(owner_ != address(0), "owner zero");
        _transferOwnership(owner_);
        baseTokenURI = initialBaseURI;
    }

    function _requireCallerIsContractOwner() internal view override {
        require(owner() == _msgSender(), "not owner");
    }

    function openMint(bool open) external onlyOwner {
        mintOpen = open;
        emit MintOpenUpdated(open);
    }

    function setBaseURI(string calldata newBaseURI) external onlyOwner {
        baseTokenURI = newBaseURI;
        emit BaseURIUpdated(newBaseURI);
    }

    function setMintMode(MintMode mode) external onlyOwner {
        mintMode = mode;
        emit MintModeUpdated(mode);
    }

    function setMintPrice(uint256 price) external onlyOwner {
        mintPrice = price;
        emit MintPriceUpdated(price);
    }

    function setPublicWalletLimit(uint256 limit) external onlyOwner {
        require(limit > 0, "zero limit");
        publicWalletLimit = limit;
        emit PublicWalletLimitUpdated(limit);
    }

    function setTeamSupplyLimit(uint256 limit) external onlyOwner {
        require(limit <= MAX_SUPPLY, "over max");
        require(limit >= teamMinted, "below minted");
        teamSupplyLimit = limit;
        emit TeamSupplyLimitUpdated(limit);
    }

    function setFreePerWallet(uint256 quantity) external onlyOwner {
        require(quantity <= publicWalletLimit, "over wallet limit");
        freePerWallet = quantity;
        emit FreePerWalletUpdated(quantity);
    }

    function teamMint(address to, uint256 quantity) external onlyOwner {
        require(to != address(0), "to zero");
        require(quantity > 0, "zero quantity");
        require(teamMinted + quantity <= teamSupplyLimit, "team sold out");
        require(totalMinted + quantity <= MAX_SUPPLY, "sold out");

        teamMinted += quantity;
        for (uint256 i = 0; i < quantity; i++) {
            _mintNext(to);
        }
        emit TeamMint(to, quantity);
    }

    function mint(uint256 quantity) external payable {
        require(mintOpen, "mint closed");
        require(quantity > 0, "zero quantity");
        _checkPublicWalletLimit(_msgSender(), quantity);
        require(totalMinted + quantity <= MAX_SUPPLY, "sold out");

        uint256 requiredPayment = priceFor(_msgSender(), quantity);
        require(msg.value == requiredPayment, "wrong value");

        publicMintsByWallet[_msgSender()] += quantity;
        publicMinted += quantity;
        for (uint256 i = 0; i < quantity; i++) {
            _mintNext(_msgSender());
        }
        emit PublicMint(_msgSender(), quantity, requiredPayment);
    }

    function priceFor(address wallet, uint256 quantity) public view returns (uint256) {
        if (mintMode == MintMode.AllFree) return 0;
        if (mintMode == MintMode.AllPaid) return mintPrice * quantity;

        uint256 alreadyMinted = publicMintsByWallet[wallet];
        if (alreadyMinted >= freePerWallet) return mintPrice * quantity;

        uint256 freeLeft = freePerWallet - alreadyMinted;
        if (quantity <= freeLeft) return 0;
        return mintPrice * (quantity - freeLeft);
    }

    function withdraw() external onlyOwner {
        uint256 amount = address(this).balance;
        require(amount > 0, "empty");
        (bool ok, ) = owner().call{value: amount}("");
        require(ok, "withdraw failed");
        emit Withdraw(owner(), amount);
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "missing token");
        return string.concat(baseTokenURI, tokenId.toString(), ".json");
    }

    function royaltyInfo(uint256, uint256 salePrice)
        external
        view
        override
        returns (address receiver, uint256 royaltyAmount)
    {
        receiver = owner();
        royaltyAmount = (salePrice * ROYALTY_BPS) / 10000;
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721C, IERC165)
        returns (bool)
    {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

    function _mintNext(address to) internal returns (uint256 tokenId) {
        tokenId = totalMinted + 1;
        totalMinted = tokenId;
        _safeMint(to, tokenId);
    }

    function _checkPublicWalletLimit(address wallet, uint256 quantity) internal view {
        if (wallet == owner()) return;
        require(publicMintsByWallet[wallet] + quantity <= publicWalletLimit, "wallet limit");
    }
}