APE Price: $1.12 (+0.93%)

Contract

0xD0C95368A6Ac6f492945655B6a370700d41f8EAB

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0.05 APE

APE Value

$0.06 (@ $1.12/APE)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Mint78949262025-01-10 12:15:4314 hrs ago1736511343IN
0xD0C95368...0d41f8EAB
0.01 APE0.0017733225.42069
Mint78949152025-01-10 12:15:2414 hrs ago1736511324IN
0xD0C95368...0d41f8EAB
0.01 APE0.002642725.42069
Mint78947862025-01-10 12:11:4014 hrs ago1736511100IN
0xD0C95368...0d41f8EAB
0.01 APE0.0022080125.42069
Mint78762902025-01-10 6:02:5621 hrs ago1736488976IN
0xD0C95368...0d41f8EAB
0.01 APE0.0017733225.42069
Mint78762802025-01-10 6:02:5021 hrs ago1736488970IN
0xD0C95368...0d41f8EAB
0.01 APE0.0022080125.42069

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x2D124a0d...c66618E6e
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
NFTSale

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
No with 200 runs

Other Settings:
paris EvmVersion
File 1 of 3 : NFTSale.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

contract NFTSale {
    address public admin;
    address public nftContract;
    uint256 public price;
    uint256 public currentIndex;
    uint256 public endId;

    mapping(address => uint256) public purchases;

    uint256 public constant MAX_PURCHASES_PER_WALLET = 10;

    event Purchase(address indexed buyer, uint256 indexed tokenId);
    event PriceUpdated(uint256 newPrice);
    event EndIdUpdated(uint256 newEndId);

    constructor(
        address _nftContract,
        uint256 _price,
        uint256 _startId,
        uint256 _endId
    ) {
        admin = msg.sender;
        nftContract = _nftContract;
        price = _price;
        currentIndex = _startId;
        endId = _endId;
    }

    modifier onlyAdmin() {
        require(msg.sender == admin, "Only admin can perform this action");
        _;
    }

    function updatePrice(uint256 _newPrice) external onlyAdmin {
        require(_newPrice > 0, "Price must be greater than zero");
        price = _newPrice;
        emit PriceUpdated(_newPrice);
    }

    function mint() external payable {
        require(currentIndex <= endId, "All NFTs sold out");
        require(msg.value == price, "Incorrect payment amount.");
        require(
            purchases[msg.sender] < MAX_PURCHASES_PER_WALLET,
            "Purchase limit reached for this wallet"
        );

        uint256 tokenId = currentIndex;
        currentIndex++;
        purchases[msg.sender]++;

        IERC721(nftContract).transferFrom(admin, msg.sender, tokenId);

        emit Purchase(msg.sender, tokenId);
    }

    function withdraw() external onlyAdmin {
        payable(admin).transfer(address(this).balance);
    }

    function getRemainingNFTs() external view returns (uint256) {
        return endId - currentIndex + 1;
    }

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

File 2 of 3 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 3 of 3 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Settings
{
  "evmVersion": "paris",
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_startId","type":"uint256"},{"internalType":"uint256","name":"_endId","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newEndId","type":"uint256"}],"name":"EndIdUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Purchase","type":"event"},{"inputs":[],"name":"MAX_PURCHASES_PER_WALLET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRemainingNFTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"nftContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"purchases","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newPrice","type":"uint256"}],"name":"updatePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x6080604052600436106100a75760003560e01c8063842a77d311610064578063842a77d3146101795780638d6cc56d146101b657806394f90cca146101df578063a035b1fe1461020a578063d56d229d14610235578063f851a44014610260576100a7565b80631249c58b146100ac578063238c6721146100b657806326987b60146100e15780633ccfd60b1461010c5780636f9fb98a1461012357806377df012e1461014e575b600080fd5b6100b461028b565b005b3480156100c257600080fd5b506100cb610504565b6040516100d89190610859565b60405180910390f35b3480156100ed57600080fd5b506100f6610527565b6040516101039190610859565b60405180910390f35b34801561011857600080fd5b5061012161052d565b005b34801561012f57600080fd5b50610138610624565b6040516101459190610859565b60405180910390f35b34801561015a57600080fd5b506101636106bb565b6040516101709190610859565b60405180910390f35b34801561018557600080fd5b506101a0600480360381019061019b91906108d7565b6106c1565b6040516101ad9190610859565b60405180910390f35b3480156101c257600080fd5b506101dd60048036038101906101d89190610930565b6106d9565b005b3480156101eb57600080fd5b506101f46107eb565b6040516102019190610859565b60405180910390f35b34801561021657600080fd5b5061021f6107f0565b60405161022c9190610859565b60405180910390f35b34801561024157600080fd5b5061024a6107f6565b604051610257919061096c565b60405180910390f35b34801561026c57600080fd5b5061027561081c565b604051610282919061096c565b60405180910390f35b60045460035411156102d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c9906109e4565b60405180910390fd5b6002543414610316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030d90610a50565b60405180910390fd5b600a600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038f90610ae2565b60405180910390fd5b60006003549050600360008154809291906103b290610b31565b9190505550600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061040790610b31565b9190505550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633846040518463ffffffff1660e01b815260040161048b93929190610b79565b600060405180830381600087803b1580156104a557600080fd5b505af11580156104b9573d6000803e3d6000fd5b50505050803373ffffffffffffffffffffffffffffffffffffffff167f2499a5330ab0979cc612135e7883ebc3cd5c9f7a8508f042540c34723348f63260405160405180910390a350565b600060016003546004546105189190610bb0565b6105229190610be4565b905090565b60035481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b290610c8a565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610621573d6000803e3d6000fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ac90610c8a565b60405180910390fd5b47905090565b60045481565b60056020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610767576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075e90610c8a565b60405180910390fd5b600081116107aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a190610cf6565b60405180910390fd5b806002819055507f66cbca4f3c64fecf1dcb9ce094abcf7f68c3450a1d4e3a8e917dd621edb4ebe0816040516107e09190610859565b60405180910390a150565b600a81565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000819050919050565b61085381610840565b82525050565b600060208201905061086e600083018461084a565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006108a482610879565b9050919050565b6108b481610899565b81146108bf57600080fd5b50565b6000813590506108d1816108ab565b92915050565b6000602082840312156108ed576108ec610874565b5b60006108fb848285016108c2565b91505092915050565b61090d81610840565b811461091857600080fd5b50565b60008135905061092a81610904565b92915050565b60006020828403121561094657610945610874565b5b60006109548482850161091b565b91505092915050565b61096681610899565b82525050565b6000602082019050610981600083018461095d565b92915050565b600082825260208201905092915050565b7f416c6c204e46547320736f6c64206f7574000000000000000000000000000000600082015250565b60006109ce601183610987565b91506109d982610998565b602082019050919050565b600060208201905081810360008301526109fd816109c1565b9050919050565b7f496e636f7272656374207061796d656e7420616d6f756e742e00000000000000600082015250565b6000610a3a601983610987565b9150610a4582610a04565b602082019050919050565b60006020820190508181036000830152610a6981610a2d565b9050919050565b7f5075726368617365206c696d6974207265616368656420666f7220746869732060008201527f77616c6c65740000000000000000000000000000000000000000000000000000602082015250565b6000610acc602683610987565b9150610ad782610a70565b604082019050919050565b60006020820190508181036000830152610afb81610abf565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610b3c82610840565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610b6e57610b6d610b02565b5b600182019050919050565b6000606082019050610b8e600083018661095d565b610b9b602083018561095d565b610ba8604083018461084a565b949350505050565b6000610bbb82610840565b9150610bc683610840565b9250828203905081811115610bde57610bdd610b02565b5b92915050565b6000610bef82610840565b9150610bfa83610840565b9250828201905080821115610c1257610c11610b02565b5b92915050565b7f4f6e6c792061646d696e2063616e20706572666f726d2074686973206163746960008201527f6f6e000000000000000000000000000000000000000000000000000000000000602082015250565b6000610c74602283610987565b9150610c7f82610c18565b604082019050919050565b60006020820190508181036000830152610ca381610c67565b9050919050565b7f5072696365206d7573742062652067726561746572207468616e207a65726f00600082015250565b6000610ce0601f83610987565b9150610ceb82610caa565b602082019050919050565b60006020820190508181036000830152610d0f81610cd3565b905091905056fea26469706673582212205df62156e2016d17333c8097e26116ae6416bb71ba25de437f643ab6548dd1e264736f6c63430008150033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.