Contract Address Details

0xBe1Dae034BCaf8784d85cB75F6f6f80c6D9bD8B5

Token
Note-50112-5 (Note-50112-5)
Creator
0xa6f969–3cd0d8 at 0xbd1fe1–daa54c
Balance
0 CSB
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
81611380
Minimal Proxy Contract for 0x24aaccd73ae036db1bb9cd279d41bd2675dec737.
EIP-1167 - minimal bytecode implementation that delegates all calls to a known address
Contract name:
MintNFT




Optimization enabled
true
Compiler version
v0.8.16+commit.07a7930e




Optimization runs
200
Verified at
2023-03-15T09:30:34.449100Z

contracts/MintNFT.sol

// SPDX-License-Identifier: MIT
// slither-disable-start naming-convention
pragma solidity 0.8.16;

import {NFTBase} from "./base/NFTBase.sol";
import {IMintNFT} from "./interfaces/IMintNFT.sol";
import {IWeb3Entry} from "./interfaces/IWeb3Entry.sol";
import {ErrCallerNotWeb3Entry, ErrNotCharacterOwner} from "./libraries/Error.sol";
import {Events} from "./libraries/Events.sol";
import {ERC721Enumerable} from "./base/ERC721Enumerable.sol";
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol";
import {IERC165} from "@openzeppelin/contracts/interfaces/IERC165.sol";
import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import {
    IERC721Enumerable
} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

contract MintNFT is NFTBase, IMintNFT, ERC2981, Initializable {
    uint256 internal _characterId;
    uint256 internal _noteId;
    address internal _web3Entry;
    uint256 internal _tokenCounter;
    mapping(uint256 => address) internal _originalReceiver;

    modifier onlyWeb3Entry() {
        if (msg.sender != _web3Entry) revert ErrCallerNotWeb3Entry();
        _;
    }

    modifier onlyOwner() {
        if (msg.sender != IERC721(_web3Entry).ownerOf(_characterId)) revert ErrNotCharacterOwner();
        _;
    }

    /// @inheritdoc IMintNFT
    function initialize(
        uint256 characterId_,
        uint256 noteId_,
        address web3Entry_,
        string calldata name_,
        string calldata symbol_
    ) external override initializer {
        super._initialize(name_, symbol_);
        _characterId = characterId_;
        _noteId = noteId_;
        _web3Entry = web3Entry_;

        emit Events.MintNFTInitialized(characterId_, noteId_, block.timestamp);
    }

    /// @inheritdoc IMintNFT
    function mint(address to) external override onlyWeb3Entry returns (uint256 tokenId) {
        unchecked {
            tokenId = ++_tokenCounter;
        }
        _originalReceiver[tokenId] = to;
        _mint(to, tokenId);
    }

    /// @inheritdoc IMintNFT
    function setTokenRoyalty(
        uint256 tokenId,
        address recipient,
        uint96 fraction
    ) external override onlyOwner {
        _setTokenRoyalty(tokenId, recipient, fraction);
    }

    /// @inheritdoc IMintNFT
    function setDefaultRoyalty(address recipient, uint96 fraction) external override onlyOwner {
        _setDefaultRoyalty(recipient, fraction);
    }

    /// @inheritdoc IMintNFT
    function deleteDefaultRoyalty() external override onlyOwner {
        _deleteDefaultRoyalty();
    }

    /// @inheritdoc IMintNFT
    function originalReceiver(uint256 tokenId) external view override returns (address) {
        return _originalReceiver[tokenId];
    }

    /// @inheritdoc IMintNFT
    function getSourceNotePointer()
        external
        view
        override
        returns (uint256 characterId, uint256 noteId)
    {
        return (_characterId, _noteId);
    }

    /// @inheritdoc IERC165
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ERC2981, ERC721Enumerable) returns (bool) {
        return
            interfaceId == type(IERC721Enumerable).interfaceId ||
            interfaceId == type(IERC2981).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /// @inheritdoc IERC721Enumerable
    function totalSupply() public view override returns (uint256) {
        return _tokenCounter;
    }

    /// @inheritdoc IERC721Metadata
    function tokenURI(uint256 tokenId) public view override returns (string memory uri) {
        if (_exists(tokenId)) {
            uri = IWeb3Entry(_web3Entry).getNote(_characterId, _noteId).contentUri;
        }
    }
}
// slither-disable-end naming-convention
        

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
              

Contract ABI

[{"type":"error","name":"ErrCallerNotWeb3Entry","inputs":[]},{"type":"error","name":"ErrNotCharacterOwner","inputs":[]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deleteDefaultRoyalty","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"}],"name":"getSourceNotePointer","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"uint256","name":"characterId_","internalType":"uint256"},{"type":"uint256","name":"noteId_","internalType":"uint256"},{"type":"address","name":"web3Entry_","internalType":"address"},{"type":"string","name":"name_","internalType":"string"},{"type":"string","name":"symbol_","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}],"name":"mint","inputs":[{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"originalReceiver","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"royaltyInfo","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"},{"type":"uint256","name":"_salePrice","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDefaultRoyalty","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint96","name":"fraction","internalType":"uint96"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenRoyalty","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint96","name":"fraction","internalType":"uint96"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"uri","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]}]
              

Contract Creation Code

Verify & Publish
0x3d602d80600a3d3981f3363d3d373d3d3d363d7324aaccd73ae036db1bb9cd279d41bd2675dec7375af43d82803e903d91602b57fd5bf3

Deployed ByteCode

0x363d3d373d3d3d363d7324aaccd73ae036db1bb9cd279d41bd2675dec7375af43d82803e903d91602b57fd5bf3