ERC-721
Overview
Max Total Supply
7 MOAA
Holders
7
Total Transfers
-
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
MOAA
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 400 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "gwei-slim-nft-contracts/contracts/base/ERC721Base.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {ERC721Delegated} from "gwei-slim-nft-contracts/contracts/base/ERC721Delegated.sol"; import "@0xdievardump/signed-allowances/contracts/SignedAllowance.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "base64-sol/base64.sol"; //Memories of an Autómaton //@creator: nyx // @opusnyx //@author: secondstate // @sec0ndstate // // // ............................................................. // ............................................................. // ............................................................. // ............................................................. // ............................................................. // ............................................................. // ._____.______.......________......________......________..... // |\..._.\.._...\....|\...__..\....|\...__..\....|\...__..\.... // \.\..\\\__\.\..\...\.\..\|\..\...\.\..\|\..\...\.\..\|\..\... // .\.\..\\|__|.\..\...\.\..\\\..\...\.\...__..\...\.\...__..\.. // ..\.\..\....\.\..\...\.\..\\\..\...\.\..\.\..\...\.\..\.\..\. // ...\.\__\....\.\__\...\.\_______\...\.\__\.\__\...\.\__\.\__\ // ....\|__|.....\|__|....\|_______|....\|__|\|__|....\|__|\|__| // ............................................................. // ............................................................. // ............................................................. // ............................................................. // ............................................................. // ............................................................. contract MOAA is ERC721Delegated, SignedAllowance { // uint256 internal _currentPMIndex; uint256 internal _currentMemoriaIndex; uint256 internal _currentAutomatonIndex; uint256 internal _saleState; constructor( address baseFactory, address allowanceSigner_ ) ERC721Delegated( baseFactory, "Memories of an Automaton", "MOAA", ConfigSettings({ royaltyBps: 1000, uriBase: "", uriExtension: "", hasTransferHook: false }) ) { // _currentPMIndex = 0; // 0 is reserved for PuppetMaster - but we do not keep track _currentAutomatonIndex = 1; // 1 is the first token id for Automaton _currentMemoriaIndex = 101; //101 is the first token id for Memoria _saleState = 1; //1 = closed - only admin can mint, 2 = public sale - no checks for WL, 3 = private sale - checks for WL _setAllowancesSigner(allowanceSigner_); } struct UserMinted { bool mintedFirst; bool mintedSecond; } struct ConfigStorage { string puppetMasterUrl; string automatonUrl; string memoriaUrl; uint64 AutomatonPrice; uint64 MemoriaPrice; address operator; } ConfigStorage confStorage; mapping(address => UserMinted) private _userMinted; address private ash = 0x64D91f12Ece7362F91A6f8E7940Cd55F05060b92; address private payout = 0x62799023aD27358DF30516742216DFCa60d427c8; //////////////////////////////////////// /////////////// SETTERS ///////////////// //////////////////////////////////////// /// @notice sets allowance signer, this can be used to revoke all unused allowances already out there /// @param newSigner the new signer function setAllowancesSigner(address newSigner) external onlyOperator { _setAllowancesSigner(newSigner); } function changeSaleState(uint256 newState) external onlyOperator { _saleState = newState; } function setOperator(address newOperator) external onlyOperator { confStorage.operator = newOperator; } function setUrls(string memory _PMUrl, string memory _MemoriaUrl, string memory _AutomatonUrl) external onlyOperator { confStorage.puppetMasterUrl = _PMUrl; confStorage.memoriaUrl = _MemoriaUrl; confStorage.automatonUrl = _AutomatonUrl; } function setPrice(uint64 _AutomatonPrice, uint64 _MemoriaPrice) external onlyOperator { confStorage.AutomatonPrice = _AutomatonPrice; confStorage.MemoriaPrice = _MemoriaPrice; } //////////////////////////////////////// /////////////// GETTERS ///////////////// //////////////////////////////////////// function getSaleState() public view returns (uint256) { return _saleState; } //////////////////////////////////////// /////////////// MODIFIERS ////////////// //////////////////////////////////////// modifier onlyOperator() { require(msg.sender == ERC721Delegated._owner() || msg.sender == confStorage.operator, 'Not Authorized'); _; } //////////////////////////////////////// /////////////// MINTING ///////////////// //////////////////////////////////////// function adminMint(address to, uint256 _selectedToken,uint256 tokenId) public onlyOperator { require(_selectedToken == 1 || _selectedToken == 2 || _selectedToken == 0, "Selector must be 1 Automaton 2 for memoria, 0 for PM"); if (_selectedToken == 0 && tokenId == 0) { tokenId = tokenId; } else if (_selectedToken == 1 && tokenId == 0) { tokenId = _currentAutomatonIndex; while(_exists(tokenId)) { unchecked { tokenId++; } } require(_currentAutomatonIndex < 101, "Exceeds max supply of Automaton."); _currentAutomatonIndex = tokenId; } else if (_selectedToken == 2 && tokenId == 0) { tokenId = _currentMemoriaIndex; while(_exists(tokenId)) { unchecked { tokenId++; } } require(_currentMemoriaIndex < 401, "Exceeds max supply of Memoria."); _currentMemoriaIndex = tokenId; } _mint(to, tokenId); } /// @notice This function allows `nonce` mint per allowance. /// @param _selectedToken the tokenId to mint /// @param nonce the nonce, which is also the number of mint allowed for this signature /// @param signature the signature by the allowance wallet function publicPurchase(uint256 _selectedToken,uint256 nonce, bytes memory signature) external { require(_selectedToken == 1 || _selectedToken == 2, "Selector must be 1 Automaton or 2 for Memoria"); uint256 nonceTier = nonce >> 128; UserMinted storage alreadyMinted = _userMinted[msg.sender]; require(_saleState == 2 || _saleState == 3, "Sale is not open to public/private purchases."); uint256 tokenId; if (_selectedToken == 1) { require(_currentAutomatonIndex < 101, "Exceeds max supply of Automaton."); require(IERC20(ash).transferFrom(msg.sender, payout, confStorage.AutomatonPrice * 10 ** 18), "$ASH transfer failed"); if (_saleState == 3) { // check for private sale first validateSignature(msg.sender, nonce, signature); require (nonceTier == 1 || nonceTier == 3, "Nonce tier must be 1 or 3"); // 1 for Automaton only, 3 for Automaton and Memoria require(alreadyMinted.mintedFirst == false, "Already minted Automaton allowance."); alreadyMinted.mintedFirst = true; } tokenId = _currentAutomatonIndex; while(_exists(tokenId)) { unchecked { tokenId++; } } _currentAutomatonIndex = tokenId; } else if (_selectedToken == 2) { require(_currentMemoriaIndex < 401, "Exceeds max supply of Memoria."); require(IERC20(ash).transferFrom(msg.sender, payout, confStorage.MemoriaPrice * 10 ** 18), "$ASH transfer failed"); if (_saleState == 3) { // check for private sale first require (nonceTier == 2 || nonceTier == 3, "Nonce tier must be 2 or 3"); // 2 for Memoria only, 3 for Automaton and Memoria require(alreadyMinted.mintedSecond == false, "Already minted Memoria allowance."); alreadyMinted.mintedSecond = true; } tokenId = _currentMemoriaIndex; while(_exists(tokenId)) { unchecked { tokenId++; } } _currentMemoriaIndex = tokenId; } _mint(msg.sender, tokenId); } function tokenURI(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "Unknown token"); string memory MemoriaUrl = string(abi.encodePacked(confStorage.memoriaUrl, Strings.toHexString(uint256(uint160((ERC721Base(address(this)).ownerOf(tokenId)))), 20))); string memory AutomatonUrl = string(abi.encodePacked(confStorage.automatonUrl, Strings.toHexString(uint256(uint160((ERC721Base(address(this)).ownerOf(tokenId)))), 20))); string memory PMUrl = string(abi.encodePacked(confStorage.puppetMasterUrl, Strings.toHexString(uint256(uint160((ERC721Base(address(this)).ownerOf(tokenId)))), 20))); string memory automatonImage = string(abi.encodePacked("https://arweave.net/-5BT4N6nFxExBM-QkrXk44aoxPmUxARFDs5joJcml2s")); string memory memoriaImage = string(abi.encodePacked("https://arweave.net/yHDh1K0sE0STZqmMesomaD1p7mkd4_CrWrwTrKsjIME")); string memory json; if(tokenId == 0) { json = string( abi.encodePacked( '{"name": "Puppet Master #0/0",', '"description": "2501",', '"created_by": "nyx x secondstate",', '"image": "', automatonImage, '",' '"image_url": "', automatonImage, '",', '"animation_url": "', PMUrl, '",', '"attributes":[', '{"trait_type":"Archillect","value":"TV"},{"trait_type":"Artist","value":"Nyx"},{"trait_type":"Artist","value":"secondstate"}', "]}" ) ); // tokenId must be between the 1 and 100 range } else if (tokenId > 0 && tokenId < 101) { json = string( abi.encodePacked( '{"name": "Aut\xC3\xB3maton #', Strings.toString(tokenId), '/100",', '"description": "Awake but dreaming...",', '"created_by": "nyx x secondstate",', '"image": "', automatonImage, '",' '"image_url": "', automatonImage, '",', '"animation_url": "', AutomatonUrl, '",', '"attributes":[', '{"trait_type":"Artist","value":"Nyx"},{"trait_type":"Artist","value":"secondstate"},{"trait_type":"Extrinsic","value":"DannyWithThreeBrains"}', "]}" ) );// tokenId must be between the 101 and 400 range } else if (tokenId > 100 && tokenId < 401) { json = string( abi.encodePacked( '{"name": "Memoria #', Strings.toString(tokenId - 100), '/300",', '"description": "She whispered...",', '"created_by": "nyx x secondstate",', '"image": "', memoriaImage, '",' '"image_url": "', memoriaImage, '",', '"animation_url": "', MemoriaUrl, '",', '"attributes":[', '{"trait_type":"Artist","value":"Nyx"},{"trait_type":"Artist","value":"secondstate"},{"trait_type":"Intrinsic","value":"DannyWithThreeBrains"}', "]}" ) ); } return string(abi.encodePacked('data:application/json;base64,', Base64.encode(bytes(json)))); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides functions for encoding/decoding base64 library Base64 { string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000" hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000" hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000" hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE_ENCODE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for {} lt(dataPtr, endPtr) {} { // read 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // write 4 characters mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F)))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } function decode(string memory _data) internal pure returns (bytes memory) { bytes memory data = bytes(_data); if (data.length == 0) return new bytes(0); require(data.length % 4 == 0, "invalid base64 decoder input"); // load the table into memory bytes memory table = TABLE_DECODE; // every 4 characters represent 3 bytes uint256 decodedLen = (data.length / 4) * 3; // add some extra buffer at the end required for the writing bytes memory result = new bytes(decodedLen + 32); assembly { // padding with '=' let lastBytes := mload(add(data, mload(data))) if eq(and(lastBytes, 0xFF), 0x3d) { decodedLen := sub(decodedLen, 1) if eq(and(lastBytes, 0xFFFF), 0x3d3d) { decodedLen := sub(decodedLen, 1) } } // set the actual output length mstore(result, decodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 4 characters at a time for {} lt(dataPtr, endPtr) {} { // read 4 characters dataPtr := add(dataPtr, 4) let input := mload(dataPtr) // write 3 bytes let output := add( add( shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)), shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))), add( shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)), and(mload(add(tablePtr, and( input , 0xFF))), 0xFF) ) ) mstore(resultPtr, shl(232, output)) resultPtr := add(resultPtr, 3) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; /// @title SignedAllowance /// @author Simon Fremaux (@dievardump) contract SignedAllowance { using ECDSA for bytes32; // list of already used allowances mapping(bytes32 => bool) public usedAllowances; // address used to sign the allowances address private _allowancesSigner; /// @notice Helper to know allowancesSigner address /// @return the allowance signer address function allowancesSigner() public view virtual returns (address) { return _allowancesSigner; } /// @notice Helper that creates the message that signer needs to sign to allow a mint /// this is usually also used when creating the allowances, to ensure "message" /// is the same /// @param account the account to allow /// @param nonce the nonce /// @return the message to sign function createMessage(address account, uint256 nonce) public view returns (bytes32) { return keccak256(abi.encode(account, nonce, address(this))); } /// @notice Helper that creates a list of messages that signer needs to sign to allow mintings /// @param accounts the accounts to allow /// @param nonces the corresponding nonces /// @return messages the messages to sign function createMessages(address[] memory accounts, uint256[] memory nonces) external view returns (bytes32[] memory messages) { require(accounts.length == nonces.length, '!LENGTH_MISMATCH!'); messages = new bytes32[](accounts.length); for (uint256 i; i < accounts.length; i++) { messages[i] = createMessage(accounts[i], nonces[i]); } } /// @notice This function verifies that the current request is valid /// @dev It ensures that _allowancesSigner signed a message containing (account, nonce, address(this)) /// and that this message was not already used /// @param account the account the allowance is associated to /// @param nonce the nonce associated to this allowance /// @param signature the signature by the allowance signer wallet /// @return the message to mark as used function validateSignature( address account, uint256 nonce, bytes memory signature ) public view returns (bytes32) { return _validateSignature(account, nonce, signature, allowancesSigner()); } /// @dev It ensures that signer signed a message containing (account, nonce, address(this)) /// and that this message was not already used /// @param account the account the allowance is associated to /// @param nonce the nonce associated to this allowance /// @param signature the signature by the allowance signer wallet /// @param signer the signer /// @return the message to mark as used function _validateSignature( address account, uint256 nonce, bytes memory signature, address signer ) internal view returns (bytes32) { bytes32 message = createMessage(account, nonce) .toEthSignedMessageHash(); // verifies that the sha3(account, nonce, address(this)) has been signed by signer require(message.recover(signature) == signer, '!INVALID_SIGNATURE!'); // verifies that the allowances was not already used require(usedAllowances[message] == false, '!ALREADY_USED!'); return message; } /// @notice internal function that verifies an allowance and marks it as used /// this function throws if signature is wrong or this nonce for this user has already been used /// @param account the account the allowance is associated to /// @param nonce the nonce /// @param signature the signature by the allowance wallet function _useAllowance( address account, uint256 nonce, bytes memory signature ) internal { bytes32 message = validateSignature(account, nonce, signature); usedAllowances[message] = true; } /// @notice Allows to change the allowance signer. This can be used to revoke any signed allowance not already used /// @param newSigner the new signer address function _setAllowancesSigner(address newSigner) internal { _allowancesSigner = newSigner; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.9; import {StorageSlotUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol"; import {IBaseERC721Interface, ConfigSettings} from "./ERC721Base.sol"; contract ERC721Delegated { uint256[100000] gap; bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; // Reference to base NFT implementation function implementation() public view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } function _initImplementation(address _nftImplementation) private { StorageSlotUpgradeable .getAddressSlot(_IMPLEMENTATION_SLOT) .value = _nftImplementation; } /// Constructor that sets up the constructor( address _nftImplementation, string memory name, string memory symbol, ConfigSettings memory settings ) { /// Removed for gas saving reasons, the check below implictly accomplishes this // require( // _nftImplementation.supportsInterface( // type(IBaseERC721Interface).interfaceId // ) // ); _initImplementation(_nftImplementation); (bool success, ) = _nftImplementation.delegatecall( abi.encodeWithSignature( "initialize(address,string,string,(uint16,string,string,bool))", msg.sender, name, symbol, settings ) ); require(success); } /// OnlyOwner implemntation that proxies to base ownable contract for info modifier onlyOwner() { require(msg.sender == base().__owner(), "Not owner"); _; } /// Getter to return the base implementation contract to call methods from /// Don't expose base contract to parent due to need to call private internal base functions function base() private view returns (IBaseERC721Interface) { return IBaseERC721Interface(address(this)); } // helpers to mimic Openzeppelin internal functions /// Getter for the contract owner /// @return address owner address function _owner() internal view returns (address) { return base().__owner(); } /// Internal burn function, only accessible from within contract /// @param id nft id to burn function _burn(uint256 id) internal { base().__burn(id); } /// Internal mint function, only accessible from within contract /// @param to address to mint NFT to /// @param id nft id to mint function _mint(address to, uint256 id) internal { base().__mint(to, id); } /// Internal exists function to determine if fn exists /// @param id nft id to check if exists function _exists(uint256 id) internal view returns (bool) { return base().__exists(id); } /// Internal getter for tokenURI /// @param tokenId id of token to get tokenURI for function _tokenURI(uint256 tokenId) internal view returns (string memory) { return base().__tokenURI(tokenId); } /// is approved for all getter underlying getter /// @param owner to check /// @param operator to check function _isApprovedForAll(address owner, address operator) internal view returns (bool) { return base().__isApprovedForAll(owner, operator); } /// Internal getter for approved or owner for a given operator /// @param operator address of operator to check /// @param id id of nft to check for function _isApprovedOrOwner(address operator, uint256 id) internal view returns (bool) { return base().__isApprovedOrOwner(operator, id); } /// Sets the base URI of the contract. Allowed only by parent contract /// @param newUri new uri base (http://URI) followed by number string of nft followed by extension string /// @param newExtension optional uri extension function _setBaseURI(string memory newUri, string memory newExtension) internal { base().__setBaseURI(newUri, newExtension); } /** * @dev Delegates the current call to nftImplementation. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { address impl = implementation(); assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external virtual { _fallback(); } /** * @dev No base NFT functions receive any value */ receive() external payable { revert(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.9; import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import {IERC2981Upgradeable, IERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {StringsUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import {CountersUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import {IBaseERC721Interface} from "./IBaseERC721Interface.sol"; struct ConfigSettings { uint16 royaltyBps; string uriBase; string uriExtension; bool hasTransferHook; } /** This smart contract adds features and allows for a ownership only by another smart contract as fallback behavior while also implementing all normal ERC721 functions as expected */ contract ERC721Base is ERC721Upgradeable, IBaseERC721Interface, IERC2981Upgradeable, OwnableUpgradeable { using CountersUpgradeable for CountersUpgradeable.Counter; // Minted counter for totalSupply() CountersUpgradeable.Counter private mintedCounter; modifier onlyInternal() { require(msg.sender == address(this), "Only internal"); _; } /// on-chain record of when this contract was deployed uint256 public immutable deployedBlock; ConfigSettings public advancedConfig; /// Constructor called once when the base contract is deployed constructor() { // Can be used to verify contract implementation is correct at address deployedBlock = block.number; } /// Initializer that's called when a new child nft is setup /// @param newOwner Owner for the new derived nft /// @param _name name of NFT contract /// @param _symbol symbol of NFT contract /// @param settings configuration settings for uri, royalty, and hooks features function initialize( address newOwner, string memory _name, string memory _symbol, ConfigSettings memory settings ) public initializer { __ERC721_init(_name, _symbol); __Ownable_init(); advancedConfig = settings; transferOwnership(newOwner); } /// Getter to expose appoval status to root contract function isApprovedForAll(address _owner, address operator) public view override returns (bool) { return ERC721Upgradeable.isApprovedForAll(_owner, operator) || operator == address(this); } /// internal getter for approval by all /// When isApprovedForAll is overridden, this can be used to call original impl function __isApprovedForAll(address _owner, address operator) public view override returns (bool) { return isApprovedForAll(_owner, operator); } /// Hook that when enabled manually calls _beforeTokenTransfer on function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override { if (advancedConfig.hasTransferHook) { (bool success, ) = address(this).delegatecall( abi.encodeWithSignature( "_beforeTokenTransfer(address,address,uint256)", from, to, tokenId ) ); // Raise error again from result if error exists assembly { switch success // delegatecall returns 0 on error. case 0 { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } } } /// Internal-only function to update the base uri function __setBaseURI(string memory uriBase, string memory uriExtension) public override onlyInternal { advancedConfig.uriBase = uriBase; advancedConfig.uriExtension = uriExtension; } /// @dev returns the number of minted tokens /// uses some extra gas but makes etherscan and users happy so :shrug: /// partial erc721enumerable implemntation function totalSupply() public view returns (uint256) { return mintedCounter.current(); } /** Internal-only @param to address to send the newly minted NFT to @dev This mints one edition to the given address by an allowed minter on the edition instance. */ function __mint(address to, uint256 tokenId) external override onlyInternal { _mint(to, tokenId); mintedCounter.increment(); } /** @param tokenId Token ID to burn User burn function for token id */ function burn(uint256 tokenId) public { require(_isApprovedOrOwner(_msgSender(), tokenId), "Not allowed"); _burn(tokenId); mintedCounter.decrement(); } /// Internal only function __burn(uint256 tokenId) public onlyInternal { _burn(tokenId); mintedCounter.decrement(); } /** Simple override for owner interface. */ function owner() public view override(OwnableUpgradeable) returns (address) { return super.owner(); } /// internal alias for overrides function __owner() public view override(IBaseERC721Interface) returns (address) { return owner(); } /// Get royalty information for token /// ignored token id to get royalty info. able to override and set per-token royalties /// @param _salePrice sales price for token to determine royalty split function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { // If ownership is revoked, don't set royalties. if (owner() == address(0x0)) { return (owner(), 0); } return (owner(), (_salePrice * advancedConfig.royaltyBps) / 10_000); } /// Default simple token-uri implementation. works for ipfs folders too /// @param tokenId token id ot get uri for /// @return default uri getter functionality function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "No token"); return string( abi.encodePacked( advancedConfig.uriBase, StringsUpgradeable.toString(tokenId), advancedConfig.uriExtension ) ); } /// internal base override function __tokenURI(uint256 tokenId) public view onlyInternal returns (string memory) { return tokenURI(tokenId); } /// Exposing token exists check for base contract function __exists(uint256 tokenId) external view override returns (bool) { return _exists(tokenId); } /// Getter for approved or owner function __isApprovedOrOwner(address spender, uint256 tokenId) external view override onlyInternal returns (bool) { return _isApprovedOrOwner(spender, tokenId); } /// IERC165 getter /// @param interfaceId interfaceId bytes4 to check support for function supportsInterface(bytes4 interfaceId) public view override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) { return type(IERC2981Upgradeable).interfaceId == interfaceId || type(IBaseERC721Interface).interfaceId == interfaceId || ERC721Upgradeable.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.9; /// Additional features and functions assigned to the /// Base721 contract for hooks and overrides interface IBaseERC721Interface { /* Exposing common NFT internal functionality for base contract overrides To save gas and make API cleaner this is only for new functionality not exposed in the core ERC721 contract */ /// Mint an NFT. Allowed to mint by owner, approval or by the parent contract /// @param tokenId id to burn function __burn(uint256 tokenId) external; /// Mint an NFT. Allowed only by the parent contract /// @param to address to mint to /// @param tokenId token id to mint function __mint(address to, uint256 tokenId) external; /// Set the base URI of the contract. Allowed only by parent contract /// @param base base uri /// @param extension extension function __setBaseURI(string memory base, string memory extension) external; /* Exposes common internal read features for public use */ /// Token exists /// @param tokenId token id to see if it exists function __exists(uint256 tokenId) external view returns (bool); /// Simple approval for operation check on token for address /// @param spender address spending/changing token /// @param tokenId tokenID to change / operate on function __isApprovedOrOwner(address spender, uint256 tokenId) external view returns (bool); function __isApprovedForAll(address owner, address operator) external view returns (bool); function __tokenURI(uint256 tokenId) external view returns (string memory); function __owner() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library CountersUpgradeable { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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. * * By default, the owner account will be the one that deploys the contract. 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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @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. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @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, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode 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 {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] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ 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. 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 if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode 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 {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); 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] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); 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. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // 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); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // 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); } return (signer, RecoverError.NoError); } /** * @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) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = _setInitializedVersion(1); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { bool isTopLevelCall = _setInitializedVersion(version); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(version); } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { _setInitializedVersion(type(uint8).max); } function _setInitializedVersion(uint8 version) private returns (bool) { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level // of initializers, because in other contexts the contract may have been reentered. if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else { require(_initialized < version, "Initializable: contract is already initialized"); _initialized = version; return true; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * 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); }
// 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 IERC165Upgradeable { /** * @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); }
{ "optimizer": { "enabled": true, "runs": 400 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"baseFactory","type":"address"},{"internalType":"address","name":"allowanceSigner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"_selectedToken","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allowancesSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newState","type":"uint256"}],"name":"changeSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"createMessage","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"nonces","type":"uint256[]"}],"name":"createMessages","outputs":[{"internalType":"bytes32[]","name":"messages","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSaleState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_selectedToken","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"publicPurchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"setAllowancesSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_AutomatonPrice","type":"uint64"},{"internalType":"uint64","name":"_MemoriaPrice","type":"uint64"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_PMUrl","type":"string"},{"internalType":"string","name":"_MemoriaUrl","type":"string"},{"internalType":"string","name":"_AutomatonUrl","type":"string"}],"name":"setUrls","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"usedAllowances","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"validateSignature","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052620186ab80546001600160a01b03199081167364d91f12ece7362f91a6f8e7940cd55f05060b9217909155620186ac80549091167362799023ad27358df30516742216dfca60d427c81790553480156200005d57600080fd5b50604051620030ec380380620030ec833981016040819052620000809162000294565b816040518060400160405280601881526020017f4d656d6f72696573206f6620616e204175746f6d61746f6e0000000000000000815250604051806040016040528060048152602001634d4f414160e01b81525060405180608001604052806103e861ffff168152602001604051806020016040528060008152508152602001604051806020016040528060008152508152602001600015158152506200012d846200021960201b60201c565b6000846001600160a01b0316338585856040516024016200015294939291906200032d565b60408051601f198184030181529181526020820180516001600160e01b031663b1a78e3f60e01b17905251620001899190620003cc565b600060405180830381855af49150503d8060008114620001c6576040519150601f19603f3d011682016040523d82523d6000602084013e620001cb565b606091505b5050905080620001da57600080fd5b50506001620186a38190556065620186a255620186a4555050620186a180546001600160a01b0319166001600160a01b038416179055505050620003ea565b80620002537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6200027460201b620014271760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b90565b80516001600160a01b03811681146200028f57600080fd5b919050565b60008060408385031215620002a857600080fd5b620002b38362000277565b9150620002c36020840162000277565b90509250929050565b60005b83811015620002e9578181015183820152602001620002cf565b83811115620002f9576000848401525b50505050565b6000815180845262000319816020860160208601620002cc565b601f01601f19169290920160200192915050565b6001600160a01b03851681526080602082018190526000906200035390830186620002ff565b8281036040840152620003678186620002ff565b9050828103606084015261ffff8451168152602084015160806020830152620003946080830182620002ff565b905060408501518282036040840152620003af8282620002ff565b915050606085015115156060830152809250505095945050505050565b60008251620003e0818460208701620002cc565b9190910192915050565b612cf280620003fa6000396000f3fe6080604052600436106100eb5760003560e01c806376eb71481161008a578063b3ab15fb11610059578063b3ab15fb146102d2578063c87b56dd146102f2578063eae7d2d01461031f578063feff19991461033f576100f5565b806376eb71481461025257806380fdab2a146102725780638838b5c314610292578063890621da146102b2576100f5565b80632073447d116100c65780632073447d1461019357806325bdb2a8146101b35780635c60da1b146101d45780636c4a412c14610225576100f5565b80624a84cb1461010c5780630743dd7d1461012c578063195e87081461014c576100f5565b366100f557600080fd5b34801561010157600080fd5b5061010a61039d565b005b34801561011857600080fd5b5061010a610127366004611f0d565b6103fb565b34801561013857600080fd5b5061010a610147366004611f5f565b610637565b34801561015857600080fd5b5061017e610167366004611f92565b620186a06020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561019f57600080fd5b5061010a6101ae366004611fab565b6106e9565b3480156101bf57600080fd5b50620186a4545b60405190815260200161018a565b3480156101e057600080fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b03165b6040516001600160a01b03909116815260200161018a565b34801561023157600080fd5b5061024561024036600461209e565b61077c565b60405161018a9190612160565b34801561025e57600080fd5b5061010a61026d366004612214565b6108d1565b34801561027e57600080fd5b5061010a61028d36600461229c565b610988565b34801561029e57600080fd5b50620186a1546001600160a01b031661020d565b3480156102be57600080fd5b506101c66102cd3660046122e2565b610f94565b3480156102de57600080fd5b5061010a6102ed366004611fab565b610fbd565b3480156102fe57600080fd5b5061031261030d366004611f92565b611051565b60405161018a9190612351565b34801561032b57600080fd5b5061010a61033a366004611f92565b6113b0565b34801561034b57600080fd5b506101c661035a366004612384565b604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b60006103d07f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b90503660008037600080366000845af43d6000803e8080156103f1573d6000f35b3d6000fd5b505050565b61040361142a565b6001600160a01b0316336001600160a01b0316148061042e5750620186a9546001600160a01b031633145b6104705760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b60448201526064015b60405180910390fd5b816001148061047f5750816002145b80610488575081155b6104fa5760405162461bcd60e51b815260206004820152603460248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e2032206660448201527f6f72206d656d6f7269612c203020666f7220504d0000000000000000000000006064820152608401610467565b81158015610506575080155b156105105761062d565b81600114801561051e575080155b156105a05750620186a3545b610533816114a2565b156105405760010161052a565b6065620186a354106105945760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e6044820152606401610467565b620186a381905561062d565b8160021480156105ae575080155b1561062d5750620186a2545b6105c3816114a2565b156105d0576001016105ba565b610191620186a254106106255760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e00006044820152606401610467565b620186a28190555b6103f6838261151a565b61063f61142a565b6001600160a01b0316336001600160a01b0316148061066a5750620186a9546001600160a01b031633145b6106a75760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a8805467ffffffffffffffff92831668010000000000000000026fffffffffffffffffffffffffffffffff199091169290931691909117919091179055565b6106f161142a565b6001600160a01b0316336001600160a01b0316148061071c5750620186a9546001600160a01b031633145b6107595760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a180546001600160a01b0319166001600160a01b03831617905550565b50565b606081518351146107cf5760405162461bcd60e51b815260206004820152601160248201527f214c454e4754485f4d49534d41544348210000000000000000000000000000006044820152606401610467565b825167ffffffffffffffff8111156107e9576107e9611fc8565b604051908082528060200260200182016040528015610812578160200160208202803683370190505b50905060005b83518110156108ca5761089b848281518110610836576108366123b0565b6020026020010151848381518110610850576108506123b0565b6020026020010151604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b8282815181106108ad576108ad6123b0565b6020908102919091010152806108c2816123dc565b915050610818565b5092915050565b6108d961142a565b6001600160a01b0316336001600160a01b031614806109045750620186a9546001600160a01b031633145b6109415760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b825161095690620186a5906020860190611e5f565b50815161096c90620186a7906020850190611e5f565b50805161098290620186a6906020840190611e5f565b50505050565b82600114806109975750826002145b6109f95760405162461bcd60e51b815260206004820152602d60248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e206f722060448201526c3220666f72204d656d6f72696160981b6064820152608401610467565b336000908152620186aa60205260409020620186a454608084901c919060021480610a285750620186a4546003145b610a8a5760405162461bcd60e51b815260206004820152602d60248201527f53616c65206973206e6f74206f70656e20746f207075626c69632f707269766160448201526c3a3290383ab931b430b9b2b99760991b6064820152608401610467565b60008560011415610d06576065620186a35410610ae95760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e6044820152606401610467565b620186ab54620186ac54620186a8546001600160a01b03928316926323b872dd923392911690610b2b9067ffffffffffffffff16670de0b6b3a76400006123f7565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015267ffffffffffffffff166044820152606401602060405180830381600087803b158015610b8457600080fd5b505af1158015610b98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbc9190612427565b610bff5760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b6044820152606401610467565b620186a45460031415610cdd57610c17338686610f94565b508260011480610c275750826003145b610c735760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652031206f722033000000000000006044820152606401610467565b815460ff1615610cd15760405162461bcd60e51b815260206004820152602360248201527f416c7265616479206d696e746564204175746f6d61746f6e20616c6c6f77616e60448201526231b29760e91b6064820152608401610467565b815460ff191660011782555b50620186a3545b610ced816114a2565b15610cfa57600101610ce4565b620186a3819055610f82565b8560021415610f8257610191620186a25410610d645760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e00006044820152606401610467565b620186ab54620186ac54620186a8546001600160a01b03928316926323b872dd923392911690610db29068010000000000000000900467ffffffffffffffff16670de0b6b3a76400006123f7565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015267ffffffffffffffff166044820152606401602060405180830381600087803b158015610e0b57600080fd5b505af1158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e439190612427565b610e865760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b6044820152606401610467565b620186a45460031415610f5d578260021480610ea25750826003145b610eee5760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652032206f722033000000000000006044820152606401610467565b8154610100900460ff1615610f4f5760405162461bcd60e51b815260206004820152602160248201527f416c7265616479206d696e746564204d656d6f72696120616c6c6f77616e63656044820152601760f91b6064820152608401610467565b815461ff0019166101001782555b50620186a2545b610f6d816114a2565b15610f7a57600101610f64565b620186a28190555b610f8c338261151a565b505050505050565b6000610fb5848484610fb0620186a1546001600160a01b031690565b61157b565b949350505050565b610fc561142a565b6001600160a01b0316336001600160a01b03161480610ff05750620186a9546001600160a01b031633145b61102d5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a980546001600160a01b0319166001600160a01b0392909216919091179055565b606061105c826114a2565b6110985760405162461bcd60e51b815260206004820152600d60248201526c2ab735b737bbb7103a37b5b2b760991b6044820152606401610467565b6040516331a9108f60e11b815260048101839052600090620186a790611124903090636352211e906024015b60206040518083038186803b1580156110dc57600080fd5b505afa1580156110f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111149190612449565b6001600160a01b031660146116e3565b6040516020016111359291906124bd565b60408051808303601f19018152908290526331a9108f60e11b8252600482018590529150600090620186a690611175903090636352211e906024016110c4565b6040516020016111869291906124bd565b60408051808303601f19018152908290526331a9108f60e11b8252600482018690529150600090620186a5906111c6903090636352211e906024016110c4565b6040516020016111d79291906124bd565b60405160208183030381529060405290506000604051602001611243907f68747470733a2f2f617277656176652e6e65742f2d354254344e366e4678457881527f424d2d516b72586b3434616f78506d55784152464473356a6f4a636d6c3273006020820152603f0190565b604051602081830303815290604052905060006040516020016112af907f68747470733a2f2f617277656176652e6e65742f79484468314b30734530535481527f5a716d4d65736f6d61443170376d6b64345f437257727754724b736a494d45006020820152603f0190565b6040516020818303038152906040529050606087600014156112f6578283856040516020016112e09392919061255b565b604051602081830303815290604052905061137b565b6000881180156113065750606588105b1561132a5761131488611886565b8384876040516020016112e09493929190612751565b60648811801561133b575061019188105b1561137b5761135361134e60648a612996565b611886565b82838860405160200161136994939291906129ad565b60405160208183030381529060405290505b61138481611984565b6040516020016113949190612b95565b6040516020818303038152906040529650505050505050919050565b6113b861142a565b6001600160a01b0316336001600160a01b031614806113e35750620186a9546001600160a01b031633145b6114205760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a455565b90565b6000306001600160a01b03166313effa0f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561146557600080fd5b505afa158015611479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149d9190612449565b905090565b604051638553c3e960e01b8152600481018290526000903090638553c3e99060240160206040518083038186803b1580156114dc57600080fd5b505afa1580156114f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115149190612427565b92915050565b30604051633dc8ded760e01b81526001600160a01b038481166004830152602482018490529190911690633dc8ded790604401600060405180830381600087803b15801561156757600080fd5b505af1158015610f8c573d6000803e3d6000fd5b60008061161c6115c98787604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90506001600160a01b0383166116328286611aea565b6001600160a01b0316146116885760405162461bcd60e51b815260206004820152601360248201527f21494e56414c49445f5349474e415455524521000000000000000000000000006044820152606401610467565b6000818152620186a0602052604090205460ff16156116da5760405162461bcd60e51b815260206004820152600e60248201526d21414c52454144595f555345442160901b6044820152606401610467565b95945050505050565b606060006116f2836002612bda565b6116fd906002612bf9565b67ffffffffffffffff81111561171557611715611fc8565b6040519080825280601f01601f19166020018201604052801561173f576020820181803683370190505b509050600360fc1b8160008151811061175a5761175a6123b0565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611789576117896123b0565b60200101906001600160f81b031916908160001a90535060006117ad846002612bda565b6117b8906001612bf9565b90505b6001811115611830576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106117ec576117ec6123b0565b1a60f81b828281518110611802576118026123b0565b60200101906001600160f81b031916908160001a90535060049490941c9361182981612c11565b90506117bb565b50831561187f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610467565b9392505050565b6060816118aa5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156118d457806118be816123dc565b91506118cd9050600a83612c3e565b91506118ae565b60008167ffffffffffffffff8111156118ef576118ef611fc8565b6040519080825280601f01601f191660200182016040528015611919576020820181803683370190505b5090505b8415610fb55761192e600183612996565b915061193b600a86612c52565b611946906030612bf9565b60f81b81838151811061195b5761195b6123b0565b60200101906001600160f81b031916908160001a90535061197d600a86612c3e565b945061191d565b60608151600014156119a457505060408051602081019091526000815290565b6000604051806060016040528060408152602001612c7d60409139905060006003845160026119d39190612bf9565b6119dd9190612c3e565b6119e8906004612bda565b905060006119f7826020612bf9565b67ffffffffffffffff811115611a0f57611a0f611fc8565b6040519080825280601f01601f191660200182016040528015611a39576020820181803683370190505b509050818152600183018586518101602084015b81831015611aa5576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101611a4d565b600389510660018114611abf5760028114611ad057611adc565b613d3d60f01b600119830152611adc565b603d60f81b6000198301525b509398975050505050505050565b6000806000611af98585611b0e565b91509150611b0681611b7e565b509392505050565b600080825160411415611b455760208301516040840151606085015160001a611b3987828585611d39565b94509450505050611b77565b825160401415611b6f5760208301516040840151611b64868383611e26565b935093505050611b77565b506000905060025b9250929050565b6000816004811115611b9257611b92612c66565b1415611b9b5750565b6001816004811115611baf57611baf612c66565b1415611bfd5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610467565b6002816004811115611c1157611c11612c66565b1415611c5f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610467565b6003816004811115611c7357611c73612c66565b1415611ccc5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610467565b6004816004811115611ce057611ce0612c66565b14156107795760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610467565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611d705750600090506003611e1d565b8460ff16601b14158015611d8857508460ff16601c14155b15611d995750600090506004611e1d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611ded573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611e1657600060019250925050611e1d565b9150600090505b94509492505050565b6000806001600160ff1b03831681611e4360ff86901c601b612bf9565b9050611e5187828885611d39565b935093505050935093915050565b828054611e6b90612466565b90600052602060002090601f016020900481019282611e8d5760008555611ed3565b82601f10611ea657805160ff1916838001178555611ed3565b82800160010185558215611ed3579182015b82811115611ed3578251825591602001919060010190611eb8565b50611edf929150611ee3565b5090565b5b80821115611edf5760008155600101611ee4565b6001600160a01b038116811461077957600080fd5b600080600060608486031215611f2257600080fd5b8335611f2d81611ef8565b95602085013595506040909401359392505050565b803567ffffffffffffffff81168114611f5a57600080fd5b919050565b60008060408385031215611f7257600080fd5b611f7b83611f42565b9150611f8960208401611f42565b90509250929050565b600060208284031215611fa457600080fd5b5035919050565b600060208284031215611fbd57600080fd5b813561187f81611ef8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561200757612007611fc8565b604052919050565b600067ffffffffffffffff82111561202957612029611fc8565b5060051b60200190565b600082601f83011261204457600080fd5b813560206120596120548361200f565b611fde565b82815260059290921b8401810191818101908684111561207857600080fd5b8286015b84811015612093578035835291830191830161207c565b509695505050505050565b600080604083850312156120b157600080fd5b823567ffffffffffffffff808211156120c957600080fd5b818501915085601f8301126120dd57600080fd5b813560206120ed6120548361200f565b82815260059290921b8401810191818101908984111561210c57600080fd5b948201945b8386101561213357853561212481611ef8565b82529482019490820190612111565b9650508601359250508082111561214957600080fd5b5061215685828601612033565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156121985783518352928401929184019160010161217c565b50909695505050505050565b600082601f8301126121b557600080fd5b813567ffffffffffffffff8111156121cf576121cf611fc8565b6121e2601f8201601f1916602001611fde565b8181528460208386010111156121f757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561222957600080fd5b833567ffffffffffffffff8082111561224157600080fd5b61224d878388016121a4565b9450602086013591508082111561226357600080fd5b61226f878388016121a4565b9350604086013591508082111561228557600080fd5b50612292868287016121a4565b9150509250925092565b6000806000606084860312156122b157600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156122d657600080fd5b612292868287016121a4565b6000806000606084860312156122f757600080fd5b833561230281611ef8565b925060208401359150604084013567ffffffffffffffff8111156122d657600080fd5b60005b83811015612340578181015183820152602001612328565b838111156109825750506000910152565b6020815260008251806020840152612370816040850160208701612325565b601f01601f19169190910160400192915050565b6000806040838503121561239757600080fd5b82356123a281611ef8565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156123f0576123f06123c6565b5060010190565b600067ffffffffffffffff8083168185168183048111821515161561241e5761241e6123c6565b02949350505050565b60006020828403121561243957600080fd5b8151801515811461187f57600080fd5b60006020828403121561245b57600080fd5b815161187f81611ef8565b600181811c9082168061247a57607f821691505b6020821081141561249b57634e487b7160e01b600052602260045260246000fd5b50919050565b600081516124b3818560208601612325565b9290920192915050565b600080845481600182811c9150808316806124d957607f831692505b60208084108214156124f957634e487b7160e01b86526022600452602486fd5b81801561250d576001811461251e5761254b565b60ff1986168952848901965061254b565b60008b81526020902060005b868110156125435781548b82015290850190830161252a565b505084890196505b5050505050506116da81856124a1565b7f7b226e616d65223a2022507570706574204d61737465722023302f30222c000081527f226465736372697074696f6e223a202232353031222c00000000000000000000601e8201527f22637265617465645f6279223a20226e79782078207365636f6e647374617465603482015261088b60f21b6054820152600060568201691134b6b0b3b2911d101160b11b815285516125fe81600a840160208a01612325565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161262f81601a840160208901612325565b61088b60f21b601a92909101918201819052711130b734b6b0ba34b7b72fbab936111d101160711b601c830152845161266f81602e850160208901612325565b602e92019182015261274761273961269e603084016d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a2241726368696c6c656374222c2276616c7581527f65223a225456227d2c7b2274726169745f74797065223a22417274697374222c60208201527f2276616c7565223a224e7978227d2c7b2274726169745f74797065223a22417260408201527f74697374222c2276616c7565223a227365636f6e647374617465227d000000006060820152607c0190565b615d7d60f01b815260020190565b9695505050505050565b7f7b226e616d65223a2022417574c3b36d61746f6e202300000000000000000000815260008551612789816016850160208a01612325565b650bcc4c0c088b60d21b6016918401918201527f226465736372697074696f6e223a20224177616b652062757420647265616d69601c820152661b99cb8b8b888b60ca1b603c82015261280d604382017f22637265617465645f6279223a20226e79782078207365636f6e647374617465815261088b60f21b602082015260220190565b691134b6b0b3b2911d101160b11b8152865190915061283381600a840160208a01612325565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161286481601a840160208901612325565b61298a6127396128d96128bf6128b16128ab61288d601a888a010161088b60f21b815260020190565b711130b734b6b0ba34b7b72fbab936111d101160711b815260120190565b8a6124a1565b61088b60f21b815260020190565b6d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a2245787472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b98975050505050505050565b6000828210156129a8576129a86123c6565b500390565b7f7b226e616d65223a20224d656d6f7269612023000000000000000000000000008152600085516129e5816013850160208a01612325565b650bcccc0c088b60d21b6013918401918201527f226465736372697074696f6e223a2022536865207768697370657265642e2e2e601982015261088b60f21b6039820152612a64603b82017f22637265617465645f6279223a20226e79782078207365636f6e647374617465815261088b60f21b602082015260220190565b691134b6b0b3b2911d101160b11b81528651909150612a8a81600a840160208a01612325565b6f11161134b6b0b3b2afbab936111d101160811b600a92909101918201528451612abb81601a840160208901612325565b61298a612739612ae46128bf6128b16128ab61288d601a888a010161088b60f21b815260020190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a22496e7472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251612bcd81601d850160208701612325565b91909101601d0192915050565b6000816000190483118215151615612bf457612bf46123c6565b500290565b60008219821115612c0c57612c0c6123c6565b500190565b600081612c2057612c206123c6565b506000190190565b634e487b7160e01b600052601260045260246000fd5b600082612c4d57612c4d612c28565b500490565b600082612c6157612c61612c28565b500690565b634e487b7160e01b600052602160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220464d98ad6e985fa5003e07b5988774e133f62ffdbd4cf83deaa8aae5a14a818e64736f6c6343000809003300000000000000000000000043955024b1985e2b933a59021500ae5f55b040910000000000000000000000009243638f8329a4ba2ecc76022945f21753eb7198
Deployed Bytecode
0x6080604052600436106100eb5760003560e01c806376eb71481161008a578063b3ab15fb11610059578063b3ab15fb146102d2578063c87b56dd146102f2578063eae7d2d01461031f578063feff19991461033f576100f5565b806376eb71481461025257806380fdab2a146102725780638838b5c314610292578063890621da146102b2576100f5565b80632073447d116100c65780632073447d1461019357806325bdb2a8146101b35780635c60da1b146101d45780636c4a412c14610225576100f5565b80624a84cb1461010c5780630743dd7d1461012c578063195e87081461014c576100f5565b366100f557600080fd5b34801561010157600080fd5b5061010a61039d565b005b34801561011857600080fd5b5061010a610127366004611f0d565b6103fb565b34801561013857600080fd5b5061010a610147366004611f5f565b610637565b34801561015857600080fd5b5061017e610167366004611f92565b620186a06020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561019f57600080fd5b5061010a6101ae366004611fab565b6106e9565b3480156101bf57600080fd5b50620186a4545b60405190815260200161018a565b3480156101e057600080fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b03165b6040516001600160a01b03909116815260200161018a565b34801561023157600080fd5b5061024561024036600461209e565b61077c565b60405161018a9190612160565b34801561025e57600080fd5b5061010a61026d366004612214565b6108d1565b34801561027e57600080fd5b5061010a61028d36600461229c565b610988565b34801561029e57600080fd5b50620186a1546001600160a01b031661020d565b3480156102be57600080fd5b506101c66102cd3660046122e2565b610f94565b3480156102de57600080fd5b5061010a6102ed366004611fab565b610fbd565b3480156102fe57600080fd5b5061031261030d366004611f92565b611051565b60405161018a9190612351565b34801561032b57600080fd5b5061010a61033a366004611f92565b6113b0565b34801561034b57600080fd5b506101c661035a366004612384565b604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b60006103d07f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b90503660008037600080366000845af43d6000803e8080156103f1573d6000f35b3d6000fd5b505050565b61040361142a565b6001600160a01b0316336001600160a01b0316148061042e5750620186a9546001600160a01b031633145b6104705760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b60448201526064015b60405180910390fd5b816001148061047f5750816002145b80610488575081155b6104fa5760405162461bcd60e51b815260206004820152603460248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e2032206660448201527f6f72206d656d6f7269612c203020666f7220504d0000000000000000000000006064820152608401610467565b81158015610506575080155b156105105761062d565b81600114801561051e575080155b156105a05750620186a3545b610533816114a2565b156105405760010161052a565b6065620186a354106105945760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e6044820152606401610467565b620186a381905561062d565b8160021480156105ae575080155b1561062d5750620186a2545b6105c3816114a2565b156105d0576001016105ba565b610191620186a254106106255760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e00006044820152606401610467565b620186a28190555b6103f6838261151a565b61063f61142a565b6001600160a01b0316336001600160a01b0316148061066a5750620186a9546001600160a01b031633145b6106a75760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a8805467ffffffffffffffff92831668010000000000000000026fffffffffffffffffffffffffffffffff199091169290931691909117919091179055565b6106f161142a565b6001600160a01b0316336001600160a01b0316148061071c5750620186a9546001600160a01b031633145b6107595760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a180546001600160a01b0319166001600160a01b03831617905550565b50565b606081518351146107cf5760405162461bcd60e51b815260206004820152601160248201527f214c454e4754485f4d49534d41544348210000000000000000000000000000006044820152606401610467565b825167ffffffffffffffff8111156107e9576107e9611fc8565b604051908082528060200260200182016040528015610812578160200160208202803683370190505b50905060005b83518110156108ca5761089b848281518110610836576108366123b0565b6020026020010151848381518110610850576108506123b0565b6020026020010151604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b8282815181106108ad576108ad6123b0565b6020908102919091010152806108c2816123dc565b915050610818565b5092915050565b6108d961142a565b6001600160a01b0316336001600160a01b031614806109045750620186a9546001600160a01b031633145b6109415760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b825161095690620186a5906020860190611e5f565b50815161096c90620186a7906020850190611e5f565b50805161098290620186a6906020840190611e5f565b50505050565b82600114806109975750826002145b6109f95760405162461bcd60e51b815260206004820152602d60248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e206f722060448201526c3220666f72204d656d6f72696160981b6064820152608401610467565b336000908152620186aa60205260409020620186a454608084901c919060021480610a285750620186a4546003145b610a8a5760405162461bcd60e51b815260206004820152602d60248201527f53616c65206973206e6f74206f70656e20746f207075626c69632f707269766160448201526c3a3290383ab931b430b9b2b99760991b6064820152608401610467565b60008560011415610d06576065620186a35410610ae95760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e6044820152606401610467565b620186ab54620186ac54620186a8546001600160a01b03928316926323b872dd923392911690610b2b9067ffffffffffffffff16670de0b6b3a76400006123f7565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015267ffffffffffffffff166044820152606401602060405180830381600087803b158015610b8457600080fd5b505af1158015610b98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbc9190612427565b610bff5760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b6044820152606401610467565b620186a45460031415610cdd57610c17338686610f94565b508260011480610c275750826003145b610c735760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652031206f722033000000000000006044820152606401610467565b815460ff1615610cd15760405162461bcd60e51b815260206004820152602360248201527f416c7265616479206d696e746564204175746f6d61746f6e20616c6c6f77616e60448201526231b29760e91b6064820152608401610467565b815460ff191660011782555b50620186a3545b610ced816114a2565b15610cfa57600101610ce4565b620186a3819055610f82565b8560021415610f8257610191620186a25410610d645760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e00006044820152606401610467565b620186ab54620186ac54620186a8546001600160a01b03928316926323b872dd923392911690610db29068010000000000000000900467ffffffffffffffff16670de0b6b3a76400006123f7565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015267ffffffffffffffff166044820152606401602060405180830381600087803b158015610e0b57600080fd5b505af1158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e439190612427565b610e865760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b6044820152606401610467565b620186a45460031415610f5d578260021480610ea25750826003145b610eee5760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652032206f722033000000000000006044820152606401610467565b8154610100900460ff1615610f4f5760405162461bcd60e51b815260206004820152602160248201527f416c7265616479206d696e746564204d656d6f72696120616c6c6f77616e63656044820152601760f91b6064820152608401610467565b815461ff0019166101001782555b50620186a2545b610f6d816114a2565b15610f7a57600101610f64565b620186a28190555b610f8c338261151a565b505050505050565b6000610fb5848484610fb0620186a1546001600160a01b031690565b61157b565b949350505050565b610fc561142a565b6001600160a01b0316336001600160a01b03161480610ff05750620186a9546001600160a01b031633145b61102d5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a980546001600160a01b0319166001600160a01b0392909216919091179055565b606061105c826114a2565b6110985760405162461bcd60e51b815260206004820152600d60248201526c2ab735b737bbb7103a37b5b2b760991b6044820152606401610467565b6040516331a9108f60e11b815260048101839052600090620186a790611124903090636352211e906024015b60206040518083038186803b1580156110dc57600080fd5b505afa1580156110f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111149190612449565b6001600160a01b031660146116e3565b6040516020016111359291906124bd565b60408051808303601f19018152908290526331a9108f60e11b8252600482018590529150600090620186a690611175903090636352211e906024016110c4565b6040516020016111869291906124bd565b60408051808303601f19018152908290526331a9108f60e11b8252600482018690529150600090620186a5906111c6903090636352211e906024016110c4565b6040516020016111d79291906124bd565b60405160208183030381529060405290506000604051602001611243907f68747470733a2f2f617277656176652e6e65742f2d354254344e366e4678457881527f424d2d516b72586b3434616f78506d55784152464473356a6f4a636d6c3273006020820152603f0190565b604051602081830303815290604052905060006040516020016112af907f68747470733a2f2f617277656176652e6e65742f79484468314b30734530535481527f5a716d4d65736f6d61443170376d6b64345f437257727754724b736a494d45006020820152603f0190565b6040516020818303038152906040529050606087600014156112f6578283856040516020016112e09392919061255b565b604051602081830303815290604052905061137b565b6000881180156113065750606588105b1561132a5761131488611886565b8384876040516020016112e09493929190612751565b60648811801561133b575061019188105b1561137b5761135361134e60648a612996565b611886565b82838860405160200161136994939291906129ad565b60405160208183030381529060405290505b61138481611984565b6040516020016113949190612b95565b6040516020818303038152906040529650505050505050919050565b6113b861142a565b6001600160a01b0316336001600160a01b031614806113e35750620186a9546001600160a01b031633145b6114205760405162461bcd60e51b815260206004820152600e60248201526d139bdd08105d5d1a1bdc9a5e995960921b6044820152606401610467565b620186a455565b90565b6000306001600160a01b03166313effa0f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561146557600080fd5b505afa158015611479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149d9190612449565b905090565b604051638553c3e960e01b8152600481018290526000903090638553c3e99060240160206040518083038186803b1580156114dc57600080fd5b505afa1580156114f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115149190612427565b92915050565b30604051633dc8ded760e01b81526001600160a01b038481166004830152602482018490529190911690633dc8ded790604401600060405180830381600087803b15801561156757600080fd5b505af1158015610f8c573d6000803e3d6000fd5b60008061161c6115c98787604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90506001600160a01b0383166116328286611aea565b6001600160a01b0316146116885760405162461bcd60e51b815260206004820152601360248201527f21494e56414c49445f5349474e415455524521000000000000000000000000006044820152606401610467565b6000818152620186a0602052604090205460ff16156116da5760405162461bcd60e51b815260206004820152600e60248201526d21414c52454144595f555345442160901b6044820152606401610467565b95945050505050565b606060006116f2836002612bda565b6116fd906002612bf9565b67ffffffffffffffff81111561171557611715611fc8565b6040519080825280601f01601f19166020018201604052801561173f576020820181803683370190505b509050600360fc1b8160008151811061175a5761175a6123b0565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611789576117896123b0565b60200101906001600160f81b031916908160001a90535060006117ad846002612bda565b6117b8906001612bf9565b90505b6001811115611830576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106117ec576117ec6123b0565b1a60f81b828281518110611802576118026123b0565b60200101906001600160f81b031916908160001a90535060049490941c9361182981612c11565b90506117bb565b50831561187f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610467565b9392505050565b6060816118aa5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156118d457806118be816123dc565b91506118cd9050600a83612c3e565b91506118ae565b60008167ffffffffffffffff8111156118ef576118ef611fc8565b6040519080825280601f01601f191660200182016040528015611919576020820181803683370190505b5090505b8415610fb55761192e600183612996565b915061193b600a86612c52565b611946906030612bf9565b60f81b81838151811061195b5761195b6123b0565b60200101906001600160f81b031916908160001a90535061197d600a86612c3e565b945061191d565b60608151600014156119a457505060408051602081019091526000815290565b6000604051806060016040528060408152602001612c7d60409139905060006003845160026119d39190612bf9565b6119dd9190612c3e565b6119e8906004612bda565b905060006119f7826020612bf9565b67ffffffffffffffff811115611a0f57611a0f611fc8565b6040519080825280601f01601f191660200182016040528015611a39576020820181803683370190505b509050818152600183018586518101602084015b81831015611aa5576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101611a4d565b600389510660018114611abf5760028114611ad057611adc565b613d3d60f01b600119830152611adc565b603d60f81b6000198301525b509398975050505050505050565b6000806000611af98585611b0e565b91509150611b0681611b7e565b509392505050565b600080825160411415611b455760208301516040840151606085015160001a611b3987828585611d39565b94509450505050611b77565b825160401415611b6f5760208301516040840151611b64868383611e26565b935093505050611b77565b506000905060025b9250929050565b6000816004811115611b9257611b92612c66565b1415611b9b5750565b6001816004811115611baf57611baf612c66565b1415611bfd5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610467565b6002816004811115611c1157611c11612c66565b1415611c5f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610467565b6003816004811115611c7357611c73612c66565b1415611ccc5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610467565b6004816004811115611ce057611ce0612c66565b14156107795760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610467565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611d705750600090506003611e1d565b8460ff16601b14158015611d8857508460ff16601c14155b15611d995750600090506004611e1d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611ded573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611e1657600060019250925050611e1d565b9150600090505b94509492505050565b6000806001600160ff1b03831681611e4360ff86901c601b612bf9565b9050611e5187828885611d39565b935093505050935093915050565b828054611e6b90612466565b90600052602060002090601f016020900481019282611e8d5760008555611ed3565b82601f10611ea657805160ff1916838001178555611ed3565b82800160010185558215611ed3579182015b82811115611ed3578251825591602001919060010190611eb8565b50611edf929150611ee3565b5090565b5b80821115611edf5760008155600101611ee4565b6001600160a01b038116811461077957600080fd5b600080600060608486031215611f2257600080fd5b8335611f2d81611ef8565b95602085013595506040909401359392505050565b803567ffffffffffffffff81168114611f5a57600080fd5b919050565b60008060408385031215611f7257600080fd5b611f7b83611f42565b9150611f8960208401611f42565b90509250929050565b600060208284031215611fa457600080fd5b5035919050565b600060208284031215611fbd57600080fd5b813561187f81611ef8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561200757612007611fc8565b604052919050565b600067ffffffffffffffff82111561202957612029611fc8565b5060051b60200190565b600082601f83011261204457600080fd5b813560206120596120548361200f565b611fde565b82815260059290921b8401810191818101908684111561207857600080fd5b8286015b84811015612093578035835291830191830161207c565b509695505050505050565b600080604083850312156120b157600080fd5b823567ffffffffffffffff808211156120c957600080fd5b818501915085601f8301126120dd57600080fd5b813560206120ed6120548361200f565b82815260059290921b8401810191818101908984111561210c57600080fd5b948201945b8386101561213357853561212481611ef8565b82529482019490820190612111565b9650508601359250508082111561214957600080fd5b5061215685828601612033565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156121985783518352928401929184019160010161217c565b50909695505050505050565b600082601f8301126121b557600080fd5b813567ffffffffffffffff8111156121cf576121cf611fc8565b6121e2601f8201601f1916602001611fde565b8181528460208386010111156121f757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561222957600080fd5b833567ffffffffffffffff8082111561224157600080fd5b61224d878388016121a4565b9450602086013591508082111561226357600080fd5b61226f878388016121a4565b9350604086013591508082111561228557600080fd5b50612292868287016121a4565b9150509250925092565b6000806000606084860312156122b157600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156122d657600080fd5b612292868287016121a4565b6000806000606084860312156122f757600080fd5b833561230281611ef8565b925060208401359150604084013567ffffffffffffffff8111156122d657600080fd5b60005b83811015612340578181015183820152602001612328565b838111156109825750506000910152565b6020815260008251806020840152612370816040850160208701612325565b601f01601f19169190910160400192915050565b6000806040838503121561239757600080fd5b82356123a281611ef8565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156123f0576123f06123c6565b5060010190565b600067ffffffffffffffff8083168185168183048111821515161561241e5761241e6123c6565b02949350505050565b60006020828403121561243957600080fd5b8151801515811461187f57600080fd5b60006020828403121561245b57600080fd5b815161187f81611ef8565b600181811c9082168061247a57607f821691505b6020821081141561249b57634e487b7160e01b600052602260045260246000fd5b50919050565b600081516124b3818560208601612325565b9290920192915050565b600080845481600182811c9150808316806124d957607f831692505b60208084108214156124f957634e487b7160e01b86526022600452602486fd5b81801561250d576001811461251e5761254b565b60ff1986168952848901965061254b565b60008b81526020902060005b868110156125435781548b82015290850190830161252a565b505084890196505b5050505050506116da81856124a1565b7f7b226e616d65223a2022507570706574204d61737465722023302f30222c000081527f226465736372697074696f6e223a202232353031222c00000000000000000000601e8201527f22637265617465645f6279223a20226e79782078207365636f6e647374617465603482015261088b60f21b6054820152600060568201691134b6b0b3b2911d101160b11b815285516125fe81600a840160208a01612325565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161262f81601a840160208901612325565b61088b60f21b601a92909101918201819052711130b734b6b0ba34b7b72fbab936111d101160711b601c830152845161266f81602e850160208901612325565b602e92019182015261274761273961269e603084016d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a2241726368696c6c656374222c2276616c7581527f65223a225456227d2c7b2274726169745f74797065223a22417274697374222c60208201527f2276616c7565223a224e7978227d2c7b2274726169745f74797065223a22417260408201527f74697374222c2276616c7565223a227365636f6e647374617465227d000000006060820152607c0190565b615d7d60f01b815260020190565b9695505050505050565b7f7b226e616d65223a2022417574c3b36d61746f6e202300000000000000000000815260008551612789816016850160208a01612325565b650bcc4c0c088b60d21b6016918401918201527f226465736372697074696f6e223a20224177616b652062757420647265616d69601c820152661b99cb8b8b888b60ca1b603c82015261280d604382017f22637265617465645f6279223a20226e79782078207365636f6e647374617465815261088b60f21b602082015260220190565b691134b6b0b3b2911d101160b11b8152865190915061283381600a840160208a01612325565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161286481601a840160208901612325565b61298a6127396128d96128bf6128b16128ab61288d601a888a010161088b60f21b815260020190565b711130b734b6b0ba34b7b72fbab936111d101160711b815260120190565b8a6124a1565b61088b60f21b815260020190565b6d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a2245787472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b98975050505050505050565b6000828210156129a8576129a86123c6565b500390565b7f7b226e616d65223a20224d656d6f7269612023000000000000000000000000008152600085516129e5816013850160208a01612325565b650bcccc0c088b60d21b6013918401918201527f226465736372697074696f6e223a2022536865207768697370657265642e2e2e601982015261088b60f21b6039820152612a64603b82017f22637265617465645f6279223a20226e79782078207365636f6e647374617465815261088b60f21b602082015260220190565b691134b6b0b3b2911d101160b11b81528651909150612a8a81600a840160208a01612325565b6f11161134b6b0b3b2afbab936111d101160811b600a92909101918201528451612abb81601a840160208901612325565b61298a612739612ae46128bf6128b16128ab61288d601a888a010161088b60f21b815260020190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a22496e7472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251612bcd81601d850160208701612325565b91909101601d0192915050565b6000816000190483118215151615612bf457612bf46123c6565b500290565b60008219821115612c0c57612c0c6123c6565b500190565b600081612c2057612c206123c6565b506000190190565b634e487b7160e01b600052601260045260246000fd5b600082612c4d57612c4d612c28565b500490565b600082612c6157612c61612c28565b500690565b634e487b7160e01b600052602160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220464d98ad6e985fa5003e07b5988774e133f62ffdbd4cf83deaa8aae5a14a818e64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000043955024b1985e2b933a59021500ae5f55b040910000000000000000000000009243638f8329a4ba2ecc76022945f21753eb7198
-----Decoded View---------------
Arg [0] : baseFactory (address): 0x43955024b1985E2b933A59021500aE5f55b04091
Arg [1] : allowanceSigner_ (address): 0x9243638F8329A4bA2Ecc76022945F21753eB7198
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000043955024b1985e2b933a59021500ae5f55b04091
Arg [1] : 0000000000000000000000009243638f8329a4ba2ecc76022945f21753eb7198
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.