Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x2D7Ea6190Bc97331d41254635C0B640E79e928AC
Balance 0 ETH
Nonce 1
Code Size 4414 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

4414 bytes
0x6080604081815260048036101561001557600080fd5b600092833560e01c90816301ffc9a714610b69575080630ba3840814610b295780630e4fff9b14610ae857806313f8ffc7146107f05780631581b600146107c7578063243f7c49146107a5578063248a9ca31461077c5780632a0acc6a146107595780632f2ff15d1461073057806336568abe146106e95780633ccfd60b14610687578063616c59a71461065e5780636c19e7831461061e578063711bba63146105de578063715018a61461057d57806388f00f5f1461028c5780638da5cb5b1461026357806391d148541461021f578063a217fddf14610204578063b46b8861146101e1578063d547741f146101a35763f2fde38b1461011557600080fd5b3461019f57602036600319011261019f5761012e610bd3565b90610137610dce565b6001600160a01b03918216928315610189575050600154826001600160601b0360a01b821617600155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8280fd5b50903461019f578060031936011261019f576101dd91356101d860016101c7610bbd565b938387528660205286200154610cb5565b610d59565b5080f35b5050346102005781600319360112610200576020906003549051908152f35b5080fd5b50503461020057816003193601126102005751908152602090f35b503461019f578160031936011261019f578160209361023c610bbd565b92358152808552209060018060a01b0316600052825260ff81600020541690519015158152f35b50503461020057816003193601126102005760015490516001600160a01b039091168152602090f35b5061029636610be9565b969283969195969492945160209889820197898952858784015260018060a01b0392838516996001600160601b03198660601b1660608301528960748301523460948301526094825260c082019082821067ffffffffffffffff83111761056857936103578f9796959461036694846103749761035d968f528251902060fc60e08401937f19457468657265756d205369676e6564204d6573736167653a0a33320000000085520152603c815261034c81610e24565b519020923691610e7e565b90610fe0565b909291926110ac565b828060075416911614610eb5565b848352838a52858320886000528a52610394866000205460035411610ef5565b600254168551966362720d9160e11b978881528b818781865afa90811561055e578591610529575b50906103c9911115610f41565b6103d4341515610f7f565b855196875289878581845afa96871561051f5783976104e7575b50803b1561019f5785516340c10f1960e01b81526001600160a01b03909216848301908152602081018890528391839182908490829060400103925af180156104dd576104b9575b5096829160a097969594937f91ad4542ef65357768fea310c0b82b3584fbcc1f4ec269a3832ccd9de08a4613995281528289208560005281528260002061047d8154610fbb565b9055858952600581528289208560005281528260002061049d8154610fbb565b905582519586528501528301526060820152346080820152a180f35b6104c99097969594939297610dfa565b6104d95790919293948738610436565b8780fd5b85513d84823e3d90fd5b8a809298508194503d8311610518575b6105018183610e40565b810103126105135789915195386103ee565b600080fd5b503d6104f7565b86513d85823e3d90fd5b809295508c8092503d8311610557575b6105438183610e40565b8101031261051357518b93906103c96103bc565b503d610539565b88513d87823e3d90fd5b604188634e487b7160e01b6000525260246000fd5b83346105db57806003193601126105db57610596610dce565b600180546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b83346105db5760203660031901126105db576105f8610bd3565b610600610c53565b60018060a01b03166001600160601b0360a01b600254161760025580f35b83346105db5760203660031901126105db57610638610bd3565b610640610c53565b60018060a01b03166001600160601b0360a01b600754161760075580f35b50503461020057816003193601126102005760025490516001600160a01b039091168152602090f35b5050346102005781600319360112610200576106a1610c53565b8180808060018060a01b036006541647905af1903d156106e3573d6106d16106c882610e62565b92519283610e40565b81528260203d92013e5b156105db5780f35b506106db565b50919034610200578060031936011261020057610704610bbd565b90336001600160a01b0383160361072157506101dd919235610d59565b5163334bd91960e11b81528390fd5b50903461019f578060031936011261019f576101dd913561075460016101c7610bbd565b610cdb565b505034610200578160031936011261020057516420a226a4a760d91b8152602090f35b503461019f57602036600319011261019f57816020936001923581528085522001549051908152f35b838234610200576020366003190112610200576107c0610c53565b3560035580f35b50503461020057816003193601126102005760065490516001600160a01b039091168152602090f35b5091906107fc36610be9565b86939596949294519160209283810189815285878301523360601b60608301526001600160601b03198960601b1660748301528760888301523460a883015260a8825260e082019082821067ffffffffffffffff831117610ad557926108b39a9b9c9492826108aa95610357948b528251902061011c6101008401937f19457468657265756d205369676e6564204d6573736167653a0a33320000000085520152603c815261034c81610e24565b909891986110ac565b6007546001600160a01b03976108ce91891690891614610eb5565b828952808252838920338a5282526108ec848a205460035411610ef5565b866002541684516362720d9160e11b9687825284828581865afa8015610acb578c90610a98575b61091f92501115610f41565b61092a341515610f7f565b845195865282868381845afa958615610a5b578a96610a65575b5089813b156105db5785516340c10f1960e01b81526001600160a01b038916848201908152602081018990529092839182908490829060400103925af18015610a5b57610a17575b50917fa70db26e65d07b4258d9b3233a990b1af013b0363d47dedab89ac0ba893b05ee9795939160c0979593828b528152828a20336000528152826000206109d48154610fbb565b9055868a5260058152828a20336000528152826000206109f48154610fbb565b905582519687528601528401523360608401521660808201523460a0820152a180f35b9160c09795939199610a4c7fa70db26e65d07b4258d9b3233a990b1af013b0363d47dedab89ac0ba893b05ee9a989694610dfa565b9991939597509193959761098c565b85513d8c823e3d90fd5b9095508281813d8311610a91575b610a7d8183610e40565b81010312610a8d57519438610944565b8980fd5b503d610a73565b508482813d8311610ac4575b610aae8183610e40565b81010312610ac05761091f9151610913565b8b80fd5b503d610aa4565b87513d8e823e3d90fd5b634e487b7160e01b8c5260418d5260248cfd5b503461019f578160031936011261019f576020928291610b06610bbd565b90358252600585528282206001600160a01b039091168252845220549051908152f35b503461019f578160031936011261019f576020928291610b47610bbd565b813583529085528282206001600160a01b039091168252845220549051908152f35b9250503461019f57602036600319011261019f573563ffffffff60e01b811680910361019f5760209250637965db0b60e01b8114908115610bac575b5015158152f35b6301ffc9a760e01b14905038610ba5565b602435906001600160a01b038216820361051357565b600435906001600160a01b038216820361051357565b9060a06003198301126105135760043591602435916044356001600160a01b038116810361051357916064359160843567ffffffffffffffff9283821161051357806023830112156105135781600401359384116105135760248483010111610513576024019190565b3360009081527fff164f808567eb9100129b1d5aead1611f532533c7a4cedced7e7f0a6271f53160205260409020546420a226a4a760d91b9060ff1615610c975750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b80600052600060205260406000203360005260205260ff6040600020541615610c975750565b9060009180835282602052604083209160018060a01b03169182845260205260ff60408420541615600014610d5457808352826020526040832082845260205260408320600160ff198254161790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a4600190565b505090565b9060009180835282602052604083209160018060a01b03169182845260205260ff604084205416600014610d545780835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b6001546001600160a01b03163303610de257565b60405163118cdaa760e01b8152336004820152602490fd5b67ffffffffffffffff8111610e0e57604052565b634e487b7160e01b600052604160045260246000fd5b6060810190811067ffffffffffffffff821117610e0e57604052565b90601f8019910116810190811067ffffffffffffffff821117610e0e57604052565b67ffffffffffffffff8111610e0e57601f01601f191660200190565b929192610e8a82610e62565b91610e986040519384610e40565b829481845281830111610513578281602093846000960137010152565b15610ebc57565b60405162461bcd60e51b8152602060048201526011602482015270496e76616c6964205369676e617475726560781b6044820152606490fd5b15610efc57565b60405162461bcd60e51b815260206004820152601760248201527f45786365656473204d6178204d696e7420416d6f756e740000000000000000006044820152606490fd5b15610f4857565b60405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a5908151bdad95b9259608a1b6044820152606490fd5b15610f8657565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642056616c756560981b6044820152606490fd5b6000198114610fca5760010190565b634e487b7160e01b600052601160045260246000fd5b81519190604183036110115761100a92506020820151906060604084015193015160001a9061101c565b9192909190565b505060009160029190565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084116110a057926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156110945780516001600160a01b0381161561108b57918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b600481101561111b57806110be575050565b600181036110d85760405163f645eedf60e01b8152600490fd5b600281036110f95760405163fce698f760e01b815260048101839052602490fd5b6003146111035750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fdfea164736f6c6343000814000a

Verified Source Code Partial Match

Compiler: v0.8.20+commit.a1b79de6 EVM: paris Optimization: Yes (200 runs)
NoaMinter.sol 118 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./INinjaOtomebyAkezie.sol";

contract NoaMinter is AccessControl, Ownable {
    using ECDSA for bytes32;

    event Minted(uint256 month, uint256 term, uint256 tokenId, address sender, address to, uint256 value);
    event PiementMinted(uint256 month, uint256 term,uint256 tokenId, address to, uint256 value);

    // Role
    bytes32 public constant ADMIN = "ADMIN";

    // Mint
    INinjaOtomebyAkezie public noaContract;
    uint256 public maxMintAmountPerTerm;
    mapping(uint256 => mapping(address => uint256)) public mintedAmountPerTerm;
    mapping(uint256 => mapping(address => uint256)) public mintedAmountPerMonth;
    address public withdrawAddress;
    address private signer;

    modifier isValidSignature (uint256 _month, uint256 _term, address _to, uint256 _maxTokenId, bytes calldata _signature) {
        bytes32 messageHash = keccak256(
            abi.encodePacked(
                _month,
                _term,
                msg.sender,
                _to,
                _maxTokenId,
                msg.value
            )
        );
        bytes32 message = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", messageHash));
        address recoveredAddress = ECDSA.recover(message, _signature);
        require(recoveredAddress == signer, "Invalid Signature");
        _;
    }
    modifier isValidSignaturePiement (uint256 _month, uint256 _term, address _to, uint256 _maxTokenId, bytes calldata _signature) {
        bytes32 messageHash = keccak256(
            abi.encodePacked(
                _month,
                _term,
                _to,
                _maxTokenId,
                msg.value
            )
        );
        bytes32 message = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", messageHash));
        address recoveredAddress = ECDSA.recover(message, _signature);
        require(recoveredAddress == signer, "Invalid Signature");
        _;
    }
    modifier withinMaxMintAmountPerTerm (uint256 _term, address _minter) {
        require(mintedAmountPerTerm[_term][_minter] < maxMintAmountPerTerm, "Exceeds Max Mint Amount");
        _;
    }
    modifier isValidTokenId (uint256 _maxTokenId) {
        uint256 tokenId = noaContract.getTotalSupply();
        require(tokenId <= _maxTokenId, "Invalid TokenId");
        _;
    }
    modifier isValidValue () {
        require(msg.value > 0, "Invalid Value");
        _;
    }

    constructor(address _withdrawAddress) Ownable(msg.sender) {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(ADMIN, msg.sender);
        withdrawAddress = _withdrawAddress;
    }

    // Setter
    function setNoaContract(address _value) external onlyRole(ADMIN) {
        noaContract = INinjaOtomebyAkezie(_value);
    }
    function setMaxMintAmountPerTerm(uint256 _value) external onlyRole(ADMIN) {
        maxMintAmountPerTerm = _value;
    }
    function setSigner(address _value) external onlyRole(ADMIN) {
        signer = _value;
    }

    // Mint
    function mint(uint256 _month, uint256 _term, address _to, uint256 _maxTokenId, bytes calldata _signature) external payable
        isValidSignature(_month, _term, _to, _maxTokenId, _signature)
        withinMaxMintAmountPerTerm(_term, msg.sender)
        isValidTokenId(_maxTokenId)
        isValidValue()
    {
        uint256 tokenId = noaContract.getTotalSupply();
        noaContract.mint(_to, tokenId);
        mintedAmountPerTerm[_term][msg.sender]++;
        mintedAmountPerMonth[_month][msg.sender]++;
        emit Minted(_month, _term, tokenId, msg.sender, _to, msg.value);
    }
    function piementMint(uint256 _month, uint256 _term, address _to, uint256 _maxTokenId, bytes calldata _signature) external payable
        isValidSignaturePiement(_month, _term, _to, _maxTokenId, _signature)
        withinMaxMintAmountPerTerm(_term, _to)
        isValidTokenId(_maxTokenId)
        isValidValue()
    {
        uint256 tokenId = noaContract.getTotalSupply();
        noaContract.mint(_to, tokenId);
        mintedAmountPerTerm[_term][_to]++;
        mintedAmountPerMonth[_month][_to]++;
        emit PiementMinted(_month, _term, tokenId, _to, msg.value);
    }

    function withdraw() public onlyRole(ADMIN) {
        (bool os, ) = payable(withdrawAddress).call{value: address(this).balance}("");
        require(os);
    }
}
INinjaOtomebyAkezie.sol 8 lines
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface INinjaOtomebyAkezie {
    function ownerOf(uint256 _tokenId) external view returns (address);
    function getTotalSupply() external view returns (uint256);
    function mint(address _address, uint256 _tokenId) external;
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
AccessControl.sol 209 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}
IAccessControl.sol 98 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}
ECDSA.sol 174 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError, bytes32) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}
ERC165.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @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);
}

Read Contract

ADMIN 0x2a0acc6a → bytes32
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
getRoleAdmin 0x248a9ca3 → bytes32
hasRole 0x91d14854 → bool
maxMintAmountPerTerm 0xb46b8861 → uint256
mintedAmountPerMonth 0x0e4fff9b → uint256
mintedAmountPerTerm 0x0ba38408 → uint256
noaContract 0x616c59a7 → address
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
withdrawAddress 0x1581b600 → address

Write Contract 11 functions

These functions modify contract state and require a wallet transaction to execute.

grantRole 0x2f2ff15d
bytes32 role
address account
mint 0x13f8ffc7
uint256 _month
uint256 _term
address _to
uint256 _maxTokenId
bytes _signature
piementMint 0x88f00f5f
uint256 _month
uint256 _term
address _to
uint256 _maxTokenId
bytes _signature
renounceOwnership 0x715018a6
No parameters
renounceRole 0x36568abe
bytes32 role
address callerConfirmation
revokeRole 0xd547741f
bytes32 role
address account
setMaxMintAmountPerTerm 0x243f7c49
uint256 _value
setNoaContract 0x711bba63
address _value
setSigner 0x6c19e783
address _value
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters

Recent Transactions

No transactions found for this address