Source Code
Overview
TokenID
9827
Transfers
-
45 ( -2.17%)
Market
Onchain Market Cap
-
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
| # | Exchange | Pair | Price | 24H Volume | % Volume |
|---|
Contract Name:
DelMundo
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
// ERC721-C imports for creator token functionality with transfer security
import {ERC721C} from "erc721c/erc721c/ERC721C.sol";
import {ERC721OpenZeppelin} from "erc721c/token/erc721/ERC721OpenZeppelin.sol";
import {OwnableBasic} from "erc721c/access/OwnableBasic.sol";
/**
* @title Official Del Mundo NFT contract.
* @author [email protected]
* @notice The DelMundo is an ERC721-C NFT with whitelist functionality using Merkle proofs and a voucher system to
* handle concurrency and variable pricing on mint (including free for whitelist).
* The metadata and images are stored on IPFS like all good NFTs.
* Includes a whitelist-only period where only addresses in the Merkle tree can mint.
* ERC721-C provides marketplace enforcement for creator royalties.
*/
contract DelMundo is OwnableBasic, ERC721C, EIP712, AccessControl, ERC2981 {
event DelMundo__AdminAdded(address indexed newAdmin);
event DelMundo__AdminRevoked(address indexed oldAdmin);
event DelMundo__ContractURIUpdated(string uri);
event DelMundo__MaxPerWalletUpdated(uint256 amount);
event DelMundo__Minted(uint256 indexed tokenId, address ownerAddress);
event DelMundo__RoyaltyUpdated(address indexed recipient, uint96 value);
event DelMundo__ResellEnabled();
event DelMundo__WhitelistMerkleRootUpdated(bytes32 indexed newRoot);
event DelMundo__WhitelistPeriodUpdated(uint256 startTime, uint256 endTime);
event DelMundo__Revealed(string newBaseURI);
event DelMundo__BaseURIUpdated(string newBaseURI);
event DelMundo__Finalised();
error DelMundo__AlreadyMinted();
error DelMundo__IncorrectSignature();
error DelMundo__InsufficientFunds();
error DelMundo__NotRay(address caller);
error DelMundo__SoldOut();
error DelMundo__TooMany();
error DelMundo__CannotMoveYet();
error DelMundo__NotWhitelisted();
error DelMundo__WhitelistPeriodNotActive();
error DelMundo__AlreadyRevealed();
error DelMundo__InvalidBatchSize();
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
// Signing constants
string public constant SIGNING_DOMAIN = "DelMundo-Voucher";
string public constant SIGNING_VERSION = "1";
bytes32 public constant VOUCHER_TYPEHASH = keccak256("NFTVoucher(uint256 tokenId,uint256 price)");
address payable public immutable TREASURY;
uint256 constant public MAX_SUPPLY = 10_000;
uint256 public constant MAX_PER_WALLET = 1;
// Resell control
bool public canResell = false;
// Whitelist functionality
bytes32 public whitelistMerkleRoot;
uint256 public whitelistStartTime;
uint256 public whitelistEndTime;
// ERC7572 metadata
string private _contractURI;
// Reveal functionality
string private _preRevealURI;
string private _baseTokenURI;
bool public revealed = false;
bool finalised = false;
// Mapping to flag minted tokens
mapping(uint256 => bool) public s_isTokenMinted;
// Track total supply (since we're not using ERC721Enumerable)
uint256 private _totalSupply;
// Del Mundo redeeming voucher. Contains the id, price and the signature of a minter.
struct NFTVoucher {
uint256 tokenId;
uint256 price;
bytes signature;
}
constructor(address _admin, address _minter, address _treasury, string memory _preRevealBaseURI)
ERC721OpenZeppelin("TheDelMundos", "DELMUNDOS")
EIP712(SIGNING_DOMAIN, SIGNING_VERSION) {
// Transfer ownership to the admin for ERC721C
if (_admin != msg.sender) {
_transferOwnership(_admin);
}
_grantRole(MINTER_ROLE, _minter);
_grantRole(ADMIN_ROLE, _admin);
TREASURY = payable(_treasury);
_preRevealURI = _preRevealBaseURI;
}
modifier onlyRay() {
if (!hasRole(ADMIN_ROLE, msg.sender)) {
revert DelMundo__NotRay(msg.sender);
}
_;
}
//////////////// ADMIN FUNCTIONS ////////////////
function addAdmin(address newAdmin) external onlyRay {
emit DelMundo__AdminAdded(newAdmin);
_grantRole(ADMIN_ROLE, newAdmin);
}
function revokeAdmin(address oldAdmin) external onlyRay {
require(msg.sender != oldAdmin, "Can't revoke yourself");
emit DelMundo__AdminRevoked(oldAdmin);
_revokeRole(ADMIN_ROLE, oldAdmin);
}
function setDefaultRoyalties(address recipient, uint96 value) external onlyRay {
emit DelMundo__RoyaltyUpdated(recipient, value);
_setDefaultRoyalty(recipient, value);
}
function setContractURI(string memory newURI) public onlyRay {
emit DelMundo__ContractURIUpdated(newURI);
_contractURI = newURI;
}
function enableResell() external onlyRay {
emit DelMundo__ResellEnabled();
canResell = true;
}
/**
* @notice Reveal the NFTs by setting the base URI
* @param newBaseURI The new base URI for revealed metadata
*/
function reveal(string calldata newBaseURI) external onlyRay {
if (revealed) {
revert DelMundo__AlreadyRevealed();
}
_baseTokenURI = newBaseURI;
revealed = true;
emit DelMundo__Revealed(newBaseURI);
}
/**
* @notice Update baseuri to fix if not finalised and reveal isn't correct. Will not be called if all is well and we finalise.
* @param newBaseURI The new base URI for revealed metadata
*/
function updateBaseURI(string calldata newBaseURI) external onlyRay {
if (finalised) {
revert DelMundo__AlreadyRevealed();
}
_baseTokenURI = newBaseURI;
emit DelMundo__BaseURIUpdated(newBaseURI);
}
/**
* @notice Prevent any more changes: lock down metadata of DelMundos
*/
function finalise() external onlyRay {
if (!finalised) {
emit DelMundo__Finalised();
finalised = true;
}
}
//////////////// WHITELIST ADMIN FUNCTIONS ////////////////
/**
* @notice Set the Merkle root for the whitelist
* @param _merkleRoot The new Merkle root hash
*/
function setWhitelistMerkleRoot(bytes32 _merkleRoot) external onlyRay {
whitelistMerkleRoot = _merkleRoot;
emit DelMundo__WhitelistMerkleRootUpdated(_merkleRoot);
}
/**
* @notice Set the whitelist period start and end times
* @param _startTime Unix timestamp for whitelist start
* @param _endTime Unix timestamp for whitelist end
*/
function setWhitelistPeriod(uint256 _startTime, uint256 _endTime) external onlyRay {
require(_startTime < _endTime, "Invalid time range");
whitelistStartTime = _startTime;
whitelistEndTime = _endTime;
emit DelMundo__WhitelistPeriodUpdated(_startTime, _endTime);
}
//////////////// VIEW FUNCTIONS ////////////////
/**
* @notice Verify if an address is whitelisted using Merkle proof
* @param account The address to verify
* @param merkleProof The Merkle proof for the address
* @return bool True if the address is whitelisted
*/
function isWhitelisted(address account, bytes32[] calldata merkleProof) public view returns (bool) {
bytes32 leaf = keccak256(abi.encodePacked(account));
return MerkleProof.verify(merkleProof, whitelistMerkleRoot, leaf);
}
/**
* @notice Check if whitelist period is currently active
* @return bool True if whitelist period is active
*/
function isWhitelistPeriodActive() public view returns (bool) {
return block.timestamp >= whitelistStartTime && block.timestamp <= whitelistEndTime;
}
/**
* @notice Returns the total number of tokens minted
* @return uint256 The total supply
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
_requireMinted(tokenId);
string memory baseURI = _baseURI();
if (bytes(baseURI).length == 0) {
return "";
}
if (revealed) {
return string(abi.encodePacked(baseURI, _toString(tokenId), ".json"));
} else {
return baseURI;
}
}
/**
* @dev Override _baseURI to return pre-reveal or post-reveal URI
*/
function _baseURI() internal view override returns (string memory) {
if (revealed) {
return _baseTokenURI;
} else {
return _preRevealURI;
}
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure returns (string memory) {
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);
}
//////////////// ERC712 FUNCTIONS ////////////////
/// @notice Returns the domain separator for EIP712 signatures
function DOMAIN_SEPARATOR() external view returns (bytes32) {
return _domainSeparatorV4();
}
/// @notice Returns a hash of the given NFTVoucher, prepared using EIP712 typed data hashing rules.
/// @param voucher An NFTVoucher to hash.
function _hash(NFTVoucher calldata voucher) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
VOUCHER_TYPEHASH,
voucher.tokenId,
voucher.price
)));
}
/// @notice Verifies the signature for a given NFTVoucher, returning the address of the signer.
/// @dev Will revert if the signature is invalid. Does not verify that the signer is authorized to mint NFTs.
/// @param voucher An NFTVoucher describing an un-minted NFT.
function _verify(NFTVoucher calldata voucher) internal view returns (address) {
bytes32 digest = _hash(voucher);
return ECDSA.recover(digest, voucher.signature);
}
//////////////// MINTING FUNCTIONS ////////////////
/**
* @notice Standard redeem function for minting with merkle proof whitelist verification
* @param voucher NFTVoucher struct containing tokenId, price and signature
* @param merkleProof Merkle proof for whitelist verification (empty array if not whitelist period)
* @dev During whitelist period, merkle proof is verified on-chain
* After whitelist period, merkle proof is ignored and anyone can mint
*/
function redeem(NFTVoucher calldata voucher, bytes32[] calldata merkleProof)
external
payable
returns (uint256)
{
if (block.timestamp < whitelistStartTime) {
revert DelMundo__WhitelistPeriodNotActive();
}
// During whitelist period, verify merkle proof on-chain
if (isWhitelistPeriodActive()) {
// Verify the caller is whitelisted
if (!isWhitelisted(msg.sender, merkleProof)) {
revert DelMundo__NotWhitelisted();
}
// Check max per wallet during whitelist period
uint256 totalOwned = balanceOf(msg.sender);
if (totalOwned >= MAX_PER_WALLET) {
revert DelMundo__TooMany();
}
}
return _mintWithVoucher(voucher);
}
/**
* @notice Internal function to handle voucher-based minting logic
* @param voucher NFTVoucher struct containing tokenId, price and signature
*/
function _mintWithVoucher(NFTVoucher calldata voucher) internal returns (uint256) {
// make sure signature is valid and get the address of the signer
address signer = _verify(voucher);
// make sure that the signer is authorized to mint NFTs
if (!hasRole(MINTER_ROLE, signer)) {
revert DelMundo__IncorrectSignature();
}
if (s_isTokenMinted[voucher.tokenId]) {
revert DelMundo__AlreadyMinted();
}
// make sure that the redeemer is paying enough to cover the price
if (msg.value < voucher.price) {
revert DelMundo__InsufficientFunds();
}
s_isTokenMinted[voucher.tokenId] = true;
emit DelMundo__Minted(voucher.tokenId, msg.sender);
// Mint directly to the buyer (msg.sender)
_mint(msg.sender, voucher.tokenId);
// Transfer all ETH to treasury (safer than transferring exact price)
// This prevents ETH from being locked if user overpays or if there are rounding errors
if (address(this).balance > 0) {
TREASURY.transfer(address(this).balance);
}
return voucher.tokenId;
}
function safeMint(address to, uint256 tokenId)
external onlyRay
{
if (s_isTokenMinted[tokenId]) {
revert DelMundo__AlreadyMinted();
}
uint256 supply = totalSupply();
if (supply >= MAX_SUPPLY) {
revert DelMundo__SoldOut();
}
s_isTokenMinted[tokenId] = true;
emit DelMundo__Minted(tokenId, to);
_safeMint(to, tokenId);
}
/**
* @notice Batch mint multiple NFTs to a single address (admin only)
* @param to The address to mint NFTs to
* @param tokenIds Array of token IDs to mint
* @dev Optimized for gas efficiency with unchecked arithmetic and single supply check
*/
function batchMint(address to, uint256[] calldata tokenIds)
external onlyRay
{
uint256 batchSize = tokenIds.length;
if (batchSize == 0) {
revert DelMundo__InvalidBatchSize();
}
// Single supply check for entire batch
uint256 supply = totalSupply();
if (supply + batchSize > MAX_SUPPLY) {
revert DelMundo__SoldOut();
}
// Process all mints
for (uint256 i = 0; i < batchSize; ) {
uint256 tokenId = tokenIds[i];
if (s_isTokenMinted[tokenId]) {
revert DelMundo__AlreadyMinted();
}
s_isTokenMinted[tokenId] = true;
emit DelMundo__Minted(tokenId, to);
_safeMint(to, tokenId);
unchecked { ++i; }
}
}
// @dev this override prevents DelMundos from being resold or transferred until the canResell flag is set to true, which is a one time event only (cannot be revoked).
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId,
uint256 batchSize
) internal virtual override {
if (!canResell && from != address(0)) {
// if the canresell hasn't been enabled, then only allow transfers from redeeming/minting processes, as these are part of the redeeming process itself.
if (!hasRole(MINTER_ROLE, from)) {
revert DelMundo__CannotMoveYet();
}
}
super._beforeTokenTransfer(from, to, tokenId, batchSize);
}
/**
* @dev Hook that is called after any token transfer. Used to track total supply.
*/
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override {
super._afterTokenTransfer(from, to, firstTokenId, batchSize);
// Update total supply
if (from == address(0)) {
// Minting
_totalSupply += batchSize;
} else if (to == address(0)) {
// Burning
_totalSupply -= batchSize;
}
}
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721C, ERC2981, AccessControl)
returns (bool)
{
return
super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 // Deprecated in v4.8
}
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");
}
}
/**
* @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) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @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 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.8.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../utils/AutomaticValidatorTransferApproval.sol";
import "../utils/CreatorTokenBase.sol";
import "../token/erc721/ERC721OpenZeppelin.sol";
import "../interfaces/ITransferValidatorSetTokenType.sol";
import {TOKEN_TYPE_ERC721} from "@limitbreak/permit-c/Constants.sol";
/**
* @title ERC721C
* @author Limit Break, Inc.
* @notice Extends OpenZeppelin's ERC721 implementation with Creator Token functionality, which
* allows the contract owner to update the transfer validation logic by managing a security policy in
* an external transfer validation security policy registry. See {CreatorTokenTransferValidator}.
*/
abstract contract ERC721C is ERC721OpenZeppelin, CreatorTokenBase, AutomaticValidatorTransferApproval {
/**
* @notice Overrides behavior of isApprovedFor all such that if an operator is not explicitly approved
* for all, the contract owner can optionally auto-approve the 721-C transfer validator for transfers.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool isApproved) {
isApproved = super.isApprovedForAll(owner, operator);
if (!isApproved) {
if (autoApproveTransfersFromValidator) {
isApproved = operator == address(getTransferValidator());
}
}
}
/**
* @notice Indicates whether the contract implements the specified interface.
* @dev Overrides supportsInterface in ERC165.
* @param interfaceId The interface id
* @return true if the contract implements the specified interface, false otherwise
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return
interfaceId == type(ICreatorToken).interfaceId ||
interfaceId == type(ICreatorTokenLegacy).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @notice Returns the function selector for the transfer validator's validation function to be called
* @notice for transaction simulation.
*/
function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) {
functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256)"));
isViewFunction = true;
}
/// @dev Ties the open-zeppelin _beforeTokenTransfer hook to more granular transfer validation logic
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize) internal virtual override {
for (uint256 i = 0; i < batchSize;) {
_validateBeforeTransfer(from, to, firstTokenId + i);
unchecked {
++i;
}
}
}
/// @dev Ties the open-zeppelin _afterTokenTransfer hook to more granular transfer validation logic
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize) internal virtual override {
for (uint256 i = 0; i < batchSize;) {
_validateAfterTransfer(from, to, firstTokenId + i);
unchecked {
++i;
}
}
}
function _tokenType() internal pure override returns(uint16) {
return uint16(TOKEN_TYPE_ERC721);
}
}
/**
* @title ERC721CInitializable
* @author Limit Break, Inc.
* @notice Initializable implementation of ERC721C to allow for EIP-1167 proxy clones.
*/
abstract contract ERC721CInitializable is ERC721OpenZeppelinInitializable, CreatorTokenBase, AutomaticValidatorTransferApproval {
function initializeERC721(string memory name_, string memory symbol_) public override {
super.initializeERC721(name_, symbol_);
_emitDefaultTransferValidator();
_registerTokenType(getTransferValidator());
}
/**
* @notice Overrides behavior of isApprovedFor all such that if an operator is not explicitly approved
* for all, the contract owner can optionally auto-approve the 721-C transfer validator for transfers.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool isApproved) {
isApproved = super.isApprovedForAll(owner, operator);
if (!isApproved) {
if (autoApproveTransfersFromValidator) {
isApproved = operator == address(getTransferValidator());
}
}
}
/**
* @notice Indicates whether the contract implements the specified interface.
* @dev Overrides supportsInterface in ERC165.
* @param interfaceId The interface id
* @return true if the contract implements the specified interface, false otherwise
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return
interfaceId == type(ICreatorToken).interfaceId ||
interfaceId == type(ICreatorTokenLegacy).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @notice Returns the function selector for the transfer validator's validation function to be called
* @notice for transaction simulation.
*/
function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) {
functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256)"));
isViewFunction = true;
}
/// @dev Ties the open-zeppelin _beforeTokenTransfer hook to more granular transfer validation logic
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize) internal virtual override {
for (uint256 i = 0; i < batchSize;) {
_validateBeforeTransfer(from, to, firstTokenId + i);
unchecked {
++i;
}
}
}
/// @dev Ties the open-zeppelin _afterTokenTransfer hook to more granular transfer validation logic
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize) internal virtual override {
for (uint256 i = 0; i < batchSize;) {
_validateAfterTransfer(from, to, firstTokenId + i);
unchecked {
++i;
}
}
}
function _tokenType() internal pure override returns(uint16) {
return uint16(TOKEN_TYPE_ERC721);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../../access/OwnablePermissions.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
abstract contract ERC721OpenZeppelinBase is ERC721 {
// Token name
string internal _contractName;
// Token symbol
string internal _contractSymbol;
function name() public view virtual override returns (string memory) {
return _contractName;
}
function symbol() public view virtual override returns (string memory) {
return _contractSymbol;
}
function _setNameAndSymbol(string memory name_, string memory symbol_) internal {
_contractName = name_;
_contractSymbol = symbol_;
}
}
abstract contract ERC721OpenZeppelin is ERC721OpenZeppelinBase {
constructor(string memory name_, string memory symbol_) ERC721("", "") {
_setNameAndSymbol(name_, symbol_);
}
}
abstract contract ERC721OpenZeppelinInitializable is OwnablePermissions, ERC721OpenZeppelinBase {
error ERC721OpenZeppelinInitializable__AlreadyInitializedERC721();
/// @notice Specifies whether or not the contract is initialized
bool private _erc721Initialized;
/// @dev Initializes parameters of ERC721 tokens.
/// These cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
function initializeERC721(string memory name_, string memory symbol_) public virtual {
_requireCallerIsContractOwner();
if(_erc721Initialized) {
revert ERC721OpenZeppelinInitializable__AlreadyInitializedERC721();
}
_erc721Initialized = true;
_setNameAndSymbol(name_, symbol_);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./OwnablePermissions.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
abstract contract OwnableBasic is OwnablePermissions, Ownable {
function _requireCallerIsContractOwner() internal view virtual override {
_checkOwner();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// 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 (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.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 IERC2981 is IERC165 {
/**
* @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
pragma solidity ^0.8.4;
import "../access/OwnablePermissions.sol";
/**
* @title AutomaticValidatorTransferApproval
* @author Limit Break, Inc.
* @notice Base contract mix-in that provides boilerplate code giving the contract owner the
* option to automatically approve a 721-C transfer validator implementation for transfers.
*/
abstract contract AutomaticValidatorTransferApproval is OwnablePermissions {
/// @dev Emitted when the automatic approval flag is modified by the creator.
event AutomaticApprovalOfTransferValidatorSet(bool autoApproved);
/// @dev If true, the collection's transfer validator is automatically approved to transfer holder's tokens.
bool public autoApproveTransfersFromValidator;
/**
* @notice Sets if the transfer validator is automatically approved as an operator for all token owners.
*
* @dev Throws when the caller is not the contract owner.
*
* @param autoApprove If true, the collection's transfer validator will be automatically approved to
* transfer holder's tokens.
*/
function setAutomaticApprovalOfTransfersFromValidator(bool autoApprove) external {
_requireCallerIsContractOwner();
autoApproveTransfersFromValidator = autoApprove;
emit AutomaticApprovalOfTransferValidatorSet(autoApprove);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../access/OwnablePermissions.sol";
import "../interfaces/ICreatorToken.sol";
import "../interfaces/ICreatorTokenLegacy.sol";
import "../interfaces/ITransferValidator.sol";
import "./TransferValidation.sol";
import "../interfaces/ITransferValidatorSetTokenType.sol";
/**
* @title CreatorTokenBase
* @author Limit Break, Inc.
* @notice CreatorTokenBaseV3 is an abstract contract that provides basic functionality for managing token
* transfer policies through an implementation of ICreatorTokenTransferValidator/ICreatorTokenTransferValidatorV2/ICreatorTokenTransferValidatorV3.
* This contract is intended to be used as a base for creator-specific token contracts, enabling customizable transfer
* restrictions and security policies.
*
* <h4>Features:</h4>
* <ul>Ownable: This contract can have an owner who can set and update the transfer validator.</ul>
* <ul>TransferValidation: Implements the basic token transfer validation interface.</ul>
*
* <h4>Benefits:</h4>
* <ul>Provides a flexible and modular way to implement custom token transfer restrictions and security policies.</ul>
* <ul>Allows creators to enforce policies such as account and codehash blacklists, whitelists, and graylists.</ul>
* <ul>Can be easily integrated into other token contracts as a base contract.</ul>
*
* <h4>Intended Usage:</h4>
* <ul>Use as a base contract for creator token implementations that require advanced transfer restrictions and
* security policies.</ul>
* <ul>Set and update the ICreatorTokenTransferValidator implementation contract to enforce desired policies for the
* creator token.</ul>
*
* <h4>Compatibility:</h4>
* <ul>Backward and Forward Compatible - V1/V2/V3 Creator Token Base will work with V1/V2/V3 Transfer Validators.</ul>
*/
abstract contract CreatorTokenBase is OwnablePermissions, TransferValidation, ICreatorToken {
/// @dev Thrown when setting a transfer validator address that has no deployed code.
error CreatorTokenBase__InvalidTransferValidatorContract();
/// @dev The default transfer validator that will be used if no transfer validator has been set by the creator.
address public constant DEFAULT_TRANSFER_VALIDATOR = address(0x721C008fdff27BF06E7E123956E2Fe03B63342e3);
/// @dev Used to determine if the default transfer validator is applied.
/// @dev Set to true when the creator sets a transfer validator address.
bool private isValidatorInitialized;
/// @dev Address of the transfer validator to apply to transactions.
address private transferValidator;
constructor() {
_emitDefaultTransferValidator();
_registerTokenType(DEFAULT_TRANSFER_VALIDATOR);
}
/**
* @notice Sets the transfer validator for the token contract.
*
* @dev Throws when provided validator contract is not the zero address and does not have code.
* @dev Throws when the caller is not the contract owner.
*
* @dev <h4>Postconditions:</h4>
* 1. The transferValidator address is updated.
* 2. The `TransferValidatorUpdated` event is emitted.
*
* @param transferValidator_ The address of the transfer validator contract.
*/
function setTransferValidator(address transferValidator_) public {
_requireCallerIsContractOwner();
bool isValidTransferValidator = transferValidator_.code.length > 0;
if(transferValidator_ != address(0) && !isValidTransferValidator) {
revert CreatorTokenBase__InvalidTransferValidatorContract();
}
emit TransferValidatorUpdated(address(getTransferValidator()), transferValidator_);
isValidatorInitialized = true;
transferValidator = transferValidator_;
_registerTokenType(transferValidator_);
}
/**
* @notice Returns the transfer validator contract address for this token contract.
*/
function getTransferValidator() public view override returns (address validator) {
validator = transferValidator;
if (validator == address(0)) {
if (!isValidatorInitialized) {
validator = DEFAULT_TRANSFER_VALIDATOR;
}
}
}
/**
* @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
* Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
* and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
*
* @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the
* transfer validator is expected to pre-validate the transfer.
*
* @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
* set to a non-zero address.
*
* @param caller The address of the caller.
* @param from The address of the sender.
* @param to The address of the receiver.
* @param tokenId The token id being transferred.
*/
function _preValidateTransfer(
address caller,
address from,
address to,
uint256 tokenId,
uint256 /*value*/) internal virtual override {
address validator = getTransferValidator();
if (validator != address(0)) {
if (msg.sender == validator) {
return;
}
ITransferValidator(validator).validateTransfer(caller, from, to, tokenId);
}
}
/**
* @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
* Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
* and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
*
* @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the
* transfer validator is expected to pre-validate the transfer.
*
* @dev Used for ERC20 and ERC1155 token transfers which have an amount value to validate in the transfer validator.
* @dev The `tokenId` for ERC20 tokens should be set to `0`.
*
* @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
* set to a non-zero address.
*
* @param caller The address of the caller.
* @param from The address of the sender.
* @param to The address of the receiver.
* @param tokenId The token id being transferred.
* @param amount The amount of token being transferred.
*/
function _preValidateTransfer(
address caller,
address from,
address to,
uint256 tokenId,
uint256 amount,
uint256 /*value*/) internal virtual override {
address validator = getTransferValidator();
if (validator != address(0)) {
if (msg.sender == validator) {
return;
}
ITransferValidator(validator).validateTransfer(caller, from, to, tokenId, amount);
}
}
function _tokenType() internal virtual pure returns(uint16);
function _registerTokenType(address validator) internal {
if (validator != address(0)) {
uint256 validatorCodeSize;
assembly {
validatorCodeSize := extcodesize(validator)
}
if(validatorCodeSize > 0) {
try ITransferValidatorSetTokenType(validator).setTokenTypeOfCollection(address(this), _tokenType()) {
} catch { }
}
}
}
/**
* @dev Used during contract deployment for constructable and cloneable creator tokens
* @dev to emit the `TransferValidatorUpdated` event signaling the validator for the contract
* @dev is the default transfer validator.
*/
function _emitDefaultTransferValidator() internal {
emit TransferValidatorUpdated(address(0), DEFAULT_TRANSFER_VALIDATOR);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ITransferValidatorSetTokenType {
function setTokenTypeOfCollection(address collection, uint16 tokenType) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @dev Constant bytes32 value of 0x000...000
bytes32 constant ZERO_BYTES32 = bytes32(0);
/// @dev Constant value of 0
uint256 constant ZERO = 0;
/// @dev Constant value of 1
uint256 constant ONE = 1;
/// @dev Constant value representing an open order in storage
uint8 constant ORDER_STATE_OPEN = 0;
/// @dev Constant value representing a filled order in storage
uint8 constant ORDER_STATE_FILLED = 1;
/// @dev Constant value representing a cancelled order in storage
uint8 constant ORDER_STATE_CANCELLED = 2;
/// @dev Constant value representing the ERC721 token type for signatures and transfer hooks
uint256 constant TOKEN_TYPE_ERC721 = 721;
/// @dev Constant value representing the ERC1155 token type for signatures and transfer hooks
uint256 constant TOKEN_TYPE_ERC1155 = 1155;
/// @dev Constant value representing the ERC20 token type for signatures and transfer hooks
uint256 constant TOKEN_TYPE_ERC20 = 20;
/// @dev Constant value to mask the upper bits of a signature that uses a packed `vs` value to extract `s`
bytes32 constant UPPER_BIT_MASK = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
/// @dev EIP-712 typehash used for validating signature based stored approvals
bytes32 constant UPDATE_APPROVAL_TYPEHASH =
keccak256("UpdateApprovalBySignature(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 approvalExpiration,uint256 sigDeadline,uint256 masterNonce)");
/// @dev EIP-712 typehash used for validating a single use permit without additional data
bytes32 constant SINGLE_USE_PERMIT_TYPEHASH =
keccak256("PermitTransferFrom(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 expiration,uint256 masterNonce)");
/// @dev EIP-712 typehash used for validating a single use permit with additional data
string constant SINGLE_USE_PERMIT_TRANSFER_ADVANCED_TYPEHASH_STUB =
"PermitTransferFromWithAdditionalData(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 expiration,uint256 masterNonce,";
/// @dev EIP-712 typehash used for validating an order permit that updates storage as it fills
string constant PERMIT_ORDER_ADVANCED_TYPEHASH_STUB =
"PermitOrderWithAdditionalData(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 salt,address operator,uint256 expiration,uint256 masterNonce,";
/// @dev Pausable flag for stored approval transfers of ERC721 assets
uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC721 = 1 << 0;
/// @dev Pausable flag for stored approval transfers of ERC1155 assets
uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC1155 = 1 << 1;
/// @dev Pausable flag for stored approval transfers of ERC20 assets
uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC20 = 1 << 2;
/// @dev Pausable flag for single use permit transfers of ERC721 assets
uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC721 = 1 << 3;
/// @dev Pausable flag for single use permit transfers of ERC1155 assets
uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC1155 = 1 << 4;
/// @dev Pausable flag for single use permit transfers of ERC20 assets
uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC20 = 1 << 5;
/// @dev Pausable flag for order fill transfers of ERC1155 assets
uint256 constant PAUSABLE_ORDER_TRANSFER_FROM_ERC1155 = 1 << 6;
/// @dev Pausable flag for order fill transfers of ERC20 assets
uint256 constant PAUSABLE_ORDER_TRANSFER_FROM_ERC20 = 1 << 7;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Context.sol";
abstract contract OwnablePermissions is Context {
function _requireCallerIsContractOwner() internal view virtual;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.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 ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings 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.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: address zero is not a valid owner");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
require(owner != address(0), "ERC721: invalid token ID");
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) {
_requireMinted(tokenId);
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 = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not token owner or approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
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: caller is not token owner or 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: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @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 _ownerOf(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) {
address owner = ERC721.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, 1);
// Check that tokenId was not minted by `_beforeTokenTransfer` hook
require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
// Will not overflow unless all 2**256 token ids are minted to the same owner.
// Given that tokens are minted one by one, it is impossible in practice that
// this ever happens. Might change if we allow batch minting.
// The ERC fails to describe this case.
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId, 1);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
// Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
owner = ERC721.ownerOf(tokenId);
// Clear approvals
delete _tokenApprovals[tokenId];
unchecked {
// Cannot overflow, as that would require more tokens to be burned/transferred
// out than the owner initially received through minting and transferring in.
_balances[owner] -= 1;
}
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId, 1);
}
/**
* @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(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId, 1);
// Check that tokenId was not transferred by `_beforeTokenTransfer` hook
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
// Clear approvals from the previous owner
delete _tokenApprovals[tokenId];
unchecked {
// `_balances[from]` cannot overflow for the same reason as described in `_burn`:
// `from`'s balance is the number of token held, which is at least one before the current
// transfer.
// `_balances[to]` could overflow in the conditions described in `_mint`. That would require
// all 2**256 token ids to be minted, which in practice is impossible.
_balances[from] -= 1;
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {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 Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
* - When `from` is zero, the tokens will be minted for `to`.
* - When `to` is zero, ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
* - When `from` is zero, the tokens were minted for `to`.
* - When `to` is zero, ``from``'s tokens were burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual {}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
* being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
* that `ownerOf(tokenId)` is `a`.
*/
// solhint-disable-next-line func-name-mixedcase
function __unsafe_increaseBalance(address account, uint256 amount) internal {
_balances[account] += amount;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* 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 Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ICreatorToken {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function setTransferValidator(address validator) external;
function getTransferValidationFunction() external view returns (bytes4 functionSignature, bool isViewFunction);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ICreatorTokenLegacy {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function setTransferValidator(address validator) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ITransferValidator {
function applyCollectionTransferPolicy(address caller, address from, address to) external view;
function validateTransfer(address caller, address from, address to) external view;
function validateTransfer(address caller, address from, address to, uint256 tokenId) external view;
function validateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount) external;
function beforeAuthorizedTransfer(address operator, address token, uint256 tokenId) external;
function afterAuthorizedTransfer(address token, uint256 tokenId) external;
function beforeAuthorizedTransfer(address operator, address token) external;
function afterAuthorizedTransfer(address token) external;
function beforeAuthorizedTransfer(address token, uint256 tokenId) external;
function beforeAuthorizedTransferWithAmount(address token, uint256 tokenId, uint256 amount) external;
function afterAuthorizedTransferWithAmount(address token, uint256 tokenId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @title TransferValidation
* @author Limit Break, Inc.
* @notice A mix-in that can be combined with ERC-721 contracts to provide more granular hooks.
* Openzeppelin's ERC721 contract only provides hooks for before and after transfer. This allows
* developers to validate or customize transfers within the context of a mint, a burn, or a transfer.
*/
abstract contract TransferValidation is Context {
/// @dev Thrown when the from and to address are both the zero address.
error ShouldNotMintToBurnAddress();
/*************************************************************************/
/* Transfers Without Amounts */
/*************************************************************************/
/// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
function _validateBeforeTransfer(address from, address to, uint256 tokenId) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_preValidateMint(_msgSender(), to, tokenId, msg.value);
} else if(toZeroAddress) {
_preValidateBurn(_msgSender(), from, tokenId, msg.value);
} else {
_preValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
}
}
/// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
function _validateAfterTransfer(address from, address to, uint256 tokenId) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_postValidateMint(_msgSender(), to, tokenId, msg.value);
} else if(toZeroAddress) {
_postValidateBurn(_msgSender(), from, tokenId, msg.value);
} else {
_postValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
}
}
/// @dev Optional validation hook that fires before a mint
function _preValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a mint
function _postValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a burn
function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a burn
function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a transfer
function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a transfer
function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}
/*************************************************************************/
/* Transfers With Amounts */
/*************************************************************************/
/// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
function _validateBeforeTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_preValidateMint(_msgSender(), to, tokenId, amount, msg.value);
} else if(toZeroAddress) {
_preValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
} else {
_preValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
}
}
/// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
function _validateAfterTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_postValidateMint(_msgSender(), to, tokenId, amount, msg.value);
} else if(toZeroAddress) {
_postValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
} else {
_postValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
}
}
/// @dev Optional validation hook that fires before a mint
function _preValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a mint
function _postValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a burn
function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a burn
function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a transfer
function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a transfer
function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// 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 IERC721Receiver {
/**
* @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 v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @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.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"erc721c/=lib/creator-token-standards/src/",
"forge-std/=lib/forge-std/src/",
"@limitbreak/permit-c/=lib/creator-token-standards/lib/PermitC/src/",
"@opensea/tstorish/=lib/creator-token-standards/lib/tstorish/src/",
"erc721a/=lib/creator-token-standards/lib/ERC721A/",
"murky/=lib/creator-token-standards/lib/murky/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"@rari-capital/solmate/=lib/creator-token-standards/lib/PermitC/lib/solmate/",
"ERC721A/=lib/creator-token-standards/lib/ERC721A/contracts/",
"PermitC/=lib/creator-token-standards/lib/PermitC/",
"creator-token-standards/=lib/creator-token-standards/",
"erc4626-tests/=lib/creator-token-standards/lib/PermitC/lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-metering/=lib/creator-token-standards/lib/PermitC/lib/forge-gas-metering/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin/=lib/creator-token-standards/lib/PermitC/lib/openzeppelin-contracts/contracts/",
"solady/=lib/creator-token-standards/lib/PermitC/lib/forge-gas-metering/lib/solady/",
"solmate/=lib/creator-token-standards/lib/PermitC/lib/solmate/src/",
"tstorish/=lib/creator-token-standards/lib/tstorish/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_minter","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"string","name":"_preRevealBaseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CreatorTokenBase__InvalidTransferValidatorContract","type":"error"},{"inputs":[],"name":"DelMundo__AlreadyMinted","type":"error"},{"inputs":[],"name":"DelMundo__AlreadyRevealed","type":"error"},{"inputs":[],"name":"DelMundo__CannotMoveYet","type":"error"},{"inputs":[],"name":"DelMundo__IncorrectSignature","type":"error"},{"inputs":[],"name":"DelMundo__InsufficientFunds","type":"error"},{"inputs":[],"name":"DelMundo__InvalidBatchSize","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"DelMundo__NotRay","type":"error"},{"inputs":[],"name":"DelMundo__NotWhitelisted","type":"error"},{"inputs":[],"name":"DelMundo__SoldOut","type":"error"},{"inputs":[],"name":"DelMundo__TooMany","type":"error"},{"inputs":[],"name":"DelMundo__WhitelistPeriodNotActive","type":"error"},{"inputs":[],"name":"ShouldNotMintToBurnAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"autoApproved","type":"bool"}],"name":"AutomaticApprovalOfTransferValidatorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"}],"name":"DelMundo__AdminAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAdmin","type":"address"}],"name":"DelMundo__AdminRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newBaseURI","type":"string"}],"name":"DelMundo__BaseURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"DelMundo__ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"DelMundo__Finalised","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DelMundo__MaxPerWalletUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"ownerAddress","type":"address"}],"name":"DelMundo__Minted","type":"event"},{"anonymous":false,"inputs":[],"name":"DelMundo__ResellEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newBaseURI","type":"string"}],"name":"DelMundo__Revealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint96","name":"value","type":"uint96"}],"name":"DelMundo__RoyaltyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"DelMundo__WhitelistMerkleRootUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"DelMundo__WhitelistPeriodUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldValidator","type":"address"},{"indexed":false,"internalType":"address","name":"newValidator","type":"address"}],"name":"TransferValidatorUpdated","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_TRANSFER_VALIDATOR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PER_WALLET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIGNING_DOMAIN","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIGNING_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREASURY","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOUCHER_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"autoApproveTransfersFromValidator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"canResell","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableResell","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finalise","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransferValidationFunction","outputs":[{"internalType":"bytes4","name":"functionSignature","type":"bytes4"},{"internalType":"bool","name":"isViewFunction","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransferValidator","outputs":[{"internalType":"address","name":"validator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"isApproved","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isWhitelistPeriodActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct DelMundo.NFTVoucher","name":"voucher","type":"tuple"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oldAdmin","type":"address"}],"name":"revokeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"s_isTokenMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"autoApprove","type":"bool"}],"name":"setAutomaticApprovalOfTransfersFromValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint96","name":"value","type":"uint96"}],"name":"setDefaultRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transferValidator_","type":"address"}],"name":"setTransferValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setWhitelistMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_endTime","type":"uint256"}],"name":"setWhitelistPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"updateBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whitelistEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
610160604052600d805460ff191690556014805461ffff1916905534801562000026575f80fd5b506040516200445438038062004454833981016040819052620000499162000482565b604080518082018252601081526f2232b626bab7323796ab37bab1b432b960811b6020808301919091528251808401845260018152603160f81b8183015283518085018552600c81526b54686544656c4d756e646f7360a01b8184015284518086018652600981526844454c4d554e444f5360b81b81850152855180850187525f80825287519586019097528685529495929491939092620000ec838262000610565b506001620000fb828262000610565b5050506200011082826200027360201b60201c565b506200011e90503362000295565b62000128620002e6565b6200014773721c008fdff27bf06e7e123956e2fe03b63342e362000334565b815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c05261012052505050506001600160a01b0384163314620001f457620001f48462000295565b620002207f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a684620003b0565b6200024c7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177585620003b0565b6001600160a01b03821661014052601262000268828262000610565b5050505050620006dc565b600662000281838262000610565b50600762000290828262000610565b505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b604080515f815273721c008fdff27bf06e7e123956e2fe03b63342e360208201527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a1565b6001600160a01b03811615620003ad57803b8015620003ab576040805163fb2de5d760e01b81523060048201526102d1602482015290516001600160a01b0384169163fb2de5d7916044808301925f92919082900301818387803b1580156200039b575f80fd5b505af19250505080156200029057505b505b50565b5f828152600a602090815260408083206001600160a01b038516845290915290205460ff16620003ab575f828152600a602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200040e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b80516001600160a01b038116811462000469575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f805f806080858703121562000496575f80fd5b620004a18562000452565b93506020620004b281870162000452565b9350620004c26040870162000452565b60608701519093506001600160401b0380821115620004df575f80fd5b818801915088601f830112620004f3575f80fd5b8151818111156200050857620005086200046e565b604051601f8201601f19908116603f011681019083821181831017156200053357620005336200046e565b816040528281528b868487010111156200054b575f80fd5b5f93505b828410156200056e57848401860151818501870152928501926200054f565b5f86848301015280965050505050505092959194509250565b600181811c908216806200059c57607f821691505b602082108103620005bb57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200029057805f5260205f20601f840160051c81016020851015620005e85750805b601f840160051c820191505b8181101562000609575f8155600101620005f4565b5050505050565b81516001600160401b038111156200062c576200062c6200046e565b62000644816200063d845462000587565b84620005c1565b602080601f8311600181146200067a575f8415620006625750858301515b5f19600386901b1c1916600185901b178555620006d4565b5f85815260208120601f198616915b82811015620006aa5788860151825594840194600190910190840162000689565b5085821015620006c857878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b60805160a05160c05160e051610100516101205161014051613d1f620007355f395f8181610577015261223501525f61208201525f6120d101525f6120ac01525f61200501525f61202f01525f6120590152613d1f5ff3fe608060405260043610610392575f3560e01c8063715018a6116101de578063a9fc664e11610108578063d53913931161009d578063e985e9c51161006d578063e985e9c514610abe578063ebdfd72214610add578063f0f2c03614610af2578063f2fde38b14610b11575f80fd5b8063d539139314610a1d578063d547741f14610a50578063e3faad9414610a6f578063e8a3d48514610aaa575f80fd5b8063c270e84c116100d8578063c270e84c1461099f578063c4dbf6ef146109b3578063c87b56dd146109df578063cd02771a146109fe575f80fd5b8063a9fc664e1461092d578063aa98e0c61461094c578063b88d4fde14610961578063bd32fb6614610980575f80fd5b806394739e871161017e578063a14481941161014e578063a1448194146108c8578063a217fddf146108e7578063a22cb465146108fa578063a439926314610919575f80fd5b806394739e871461084e57806395d89b4114610881578063997dad2d146108955780639e05d240146108a9575f80fd5b806391d14854116101b957806391d14854146107dc5780639292caaf146107fb578063931688cb14610810578063938e3d7b1461082f575f80fd5b8063715018a61461078b57806375b238fc1461079f5780638da5cb5b146107bf575f80fd5b806332cb6b0c116102bf578063518302271161025f5780636456bbf71161022f5780636456bbf7146107065780636a41274914610734578063704802751461074d57806370a082311461076c575f80fd5b8063518302271461068f5780635a23dd99146106a85780636221d13c146106c75780636352211e146106e7575f80fd5b806336778d3e1161029a57806336778d3e1461061f57806342842e0e146106325780634684d7e9146106515780634c26124714610670575f80fd5b806332cb6b0c146105d75780633644e515146105ec57806336568abe14610600575f80fd5b80630f2cdd6c116103355780632a55205a116103055780632a55205a146105285780632d2c5565146105665780632d345670146105995780632f2ff15d146105b8575f80fd5b80630f2cdd6c146104a557806318160ddd146104c757806323b872dd146104db578063248a9ca3146104fa575f80fd5b8063081812fc11610370578063081812fc1461042a578063095ea7b314610449578063098144d41461046a5780630d705df61461047e575f80fd5b8063014635461461039657806301ffc9a7146103da57806306fdde0314610409575b5f80fd5b3480156103a1575f80fd5b506103bd73721c008fdff27bf06e7e123956e2fe03b63342e381565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103e5575f80fd5b506103f96103f43660046132da565b610b30565b60405190151581526020016103d1565b348015610414575f80fd5b5061041d610b40565b6040516103d19190613342565b348015610435575f80fd5b506103bd610444366004613354565b610bd0565b348015610454575f80fd5b50610468610463366004613386565b610bf5565b005b348015610475575f80fd5b506103bd610d0e565b348015610489575f80fd5b506040805163657711f560e11b815260016020820152016103d1565b3480156104b0575f80fd5b506104b9600181565b6040519081526020016103d1565b3480156104d2575f80fd5b506016546104b9565b3480156104e6575f80fd5b506104686104f53660046133ae565b610d4a565b348015610505575f80fd5b506104b9610514366004613354565b5f908152600a602052604090206001015490565b348015610533575f80fd5b506105476105423660046133e7565b610d7b565b604080516001600160a01b0390931683526020830191909152016103d1565b348015610571575f80fd5b506103bd7f000000000000000000000000000000000000000000000000000000000000000081565b3480156105a4575f80fd5b506104686105b3366004613407565b610e27565b3480156105c3575f80fd5b506104686105d2366004613420565b610efa565b3480156105e2575f80fd5b506104b961271081565b3480156105f7575f80fd5b506104b9610f1e565b34801561060b575f80fd5b5061046861061a366004613420565b610f2c565b6104b961062d36600461348b565b610faa565b34801561063d575f80fd5b5061046861064c3660046133ae565b611043565b34801561065c575f80fd5b5061046861066b3660046134f6565b61105d565b34801561067b575f80fd5b5061046861068a366004613538565b6111ba565b34801561069a575f80fd5b506014546103f99060ff1681565b3480156106b3575f80fd5b506103f96106c23660046134f6565b61126d565b3480156106d2575f80fd5b506009546103f990600160a01b900460ff1681565b3480156106f2575f80fd5b506103bd610701366004613354565b6112f1565b348015610711575f80fd5b506103f9610720366004613354565b60156020525f908152604090205460ff1681565b34801561073f575f80fd5b50600d546103f99060ff1681565b348015610758575f80fd5b50610468610767366004613407565b611350565b348015610777575f80fd5b506104b9610786366004613407565b6113d0565b348015610796575f80fd5b50610468611454565b3480156107aa575f80fd5b506104b95f80516020613cca83398151915281565b3480156107ca575f80fd5b506008546001600160a01b03166103bd565b3480156107e7575f80fd5b506103f96107f6366004613420565b611467565b348015610806575f80fd5b506104b9600f5481565b34801561081b575f80fd5b5061046861082a366004613538565b611491565b34801561083a575f80fd5b5061046861084936600461362b565b61152f565b348015610859575f80fd5b506104b97fd897feb728126d168eaa59ff417ab688edef2205b1037334a43beae294f2fc0681565b34801561088c575f80fd5b5061041d6115a8565b3480156108a0575f80fd5b506103f96115b7565b3480156108b4575f80fd5b506104686108c336600461367f565b6115cf565b3480156108d3575f80fd5b506104686108e2366004613386565b61162f565b3480156108f2575f80fd5b506104b95f81565b348015610905575f80fd5b50610468610914366004613698565b611723565b348015610924575f80fd5b5061046861172e565b348015610938575f80fd5b50610468610947366004613407565b6117ac565b348015610957575f80fd5b506104b9600e5481565b34801561096c575f80fd5b5061046861097b3660046136c0565b611871565b34801561098b575f80fd5b5061046861099a366004613354565b6118a9565b3480156109aa575f80fd5b50610468611911565b3480156109be575f80fd5b5061041d604051806040016040528060018152602001603160f81b81525081565b3480156109ea575f80fd5b5061041d6109f9366004613354565b61197e565b348015610a09575f80fd5b50610468610a18366004613737565b6119f4565b348015610a28575f80fd5b506104b97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b348015610a5b575f80fd5b50610468610a6a366004613420565b611a7b565b348015610a7a575f80fd5b5061041d6040518060400160405280601081526020016f2232b626bab7323796ab37bab1b432b960811b81525081565b348015610ab5575f80fd5b5061041d611a9f565b348015610ac9575f80fd5b506103f9610ad8366004613777565b611aae565b348015610ae8575f80fd5b506104b960105481565b348015610afd575f80fd5b50610468610b0c3660046133e7565b611b11565b348015610b1c575f80fd5b50610468610b2b366004613407565b611bcb565b5f610b3a82611c41565b92915050565b606060068054610b4f9061379f565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7b9061379f565b8015610bc65780601f10610b9d57610100808354040283529160200191610bc6565b820191905f5260205f20905b815481529060010190602001808311610ba957829003601f168201915b5050505050905090565b5f610bda82611c65565b505f908152600460205260409020546001600160a01b031690565b5f610bff826112f1565b9050806001600160a01b0316836001600160a01b031603610c715760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610c8d5750610c8d8133611aae565b610cff5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610c68565b610d098383611cc3565b505050565b6009546001600160a01b031680610d4757600854600160a01b900460ff16610d47575073721c008fdff27bf06e7e123956e2fe03b63342e35b90565b610d543382611d30565b610d705760405162461bcd60e51b8152600401610c68906137d1565b610d09838383611d8d565b5f828152600c602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610def575060408051808201909152600b546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090610e0d906001600160601b031687613832565b610e17919061385d565b91519350909150505b9250929050565b610e3e5f80516020613cca83398151915233611467565b610e5d57604051633542737960e01b8152336004820152602401610c68565b6001600160a01b0381163303610ead5760405162461bcd60e51b815260206004820152601560248201527421b0b713ba103932bb37b5b2903cb7bab939b2b63360591b6044820152606401610c68565b6040516001600160a01b038216907fea8164e5fc0aba0d1b32d0bb0c4fe1a12b46af536f1b43845cef5d06c0fb1cb2905f90a2610ef75f80516020613cca83398151915282611f04565b50565b5f828152600a6020526040902060010154610f1481611f6a565b610d098383611f74565b5f610f27611ff9565b905090565b6001600160a01b0381163314610f9c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c68565b610fa68282611f04565b5050565b5f600f54421015610fce57604051631c594c4b60e11b815260040160405180910390fd5b610fd66115b7565b1561103257610fe633848461126d565b611003576040516359b6540160e11b815260040160405180910390fd5b5f61100d336113d0565b905060018110611030576040516312b60db360e31b815260040160405180910390fd5b505b61103b8461211f565b949350505050565b610d0983838360405180602001604052805f815250611871565b6110745f80516020613cca83398151915233611467565b61109357604051633542737960e01b8152336004820152602401610c68565b805f8190036110b5576040516301d4888d60e51b815260040160405180910390fd5b5f6110bf60165490565b90506127106110ce8383613870565b11156110ed57604051631eb554db60e11b815260040160405180910390fd5b5f5b828110156111b2575f85858381811061110a5761110a613883565b602090810292909201355f81815260159093526040909220549192505060ff161561114857604051638284957b60e01b815260040160405180910390fd5b5f81815260156020908152604091829020805460ff1916600117905590516001600160a01b038916815282917fe01bc9d408afb7ec25f195b5d2463df306cfb166d6e2d37f92d33a3c2e28a73c910160405180910390a26111a98782612282565b506001016110ef565b505050505050565b6111d15f80516020613cca83398151915233611467565b6111f057604051633542737960e01b8152336004820152602401610c68565b60145460ff161561121457604051630eca4c0760e31b815260040160405180910390fd5b60136112218284836138db565b506014805460ff191660011790556040517f1e6f11a8859bececade370c545e4803c8582c7c9e3d1a2e12fde1e002d2ab6b2906112619084908490613995565b60405180910390a15050565b6040516bffffffffffffffffffffffff19606085901b1660208201525f9081906034016040516020818303038152906040528051906020012090506112e88484808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050600e54915084905061229b565b95945050505050565b5f818152600260205260408120546001600160a01b031680610b3a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c68565b6113675f80516020613cca83398151915233611467565b61138657604051633542737960e01b8152336004820152602401610c68565b6040516001600160a01b038216907f336843bc8e0da317ebac6ca5ab1dabe1910eb246507b76bbba81f80130a6dd82905f90a2610ef75f80516020613cca83398151915282611f74565b5f6001600160a01b0382166114395760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610c68565b506001600160a01b03165f9081526003602052604090205490565b61145c6122b0565b6114655f61230a565b565b5f918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6114a85f80516020613cca83398151915233611467565b6114c757604051633542737960e01b8152336004820152602401610c68565b601454610100900460ff16156114f057604051630eca4c0760e31b815260040160405180910390fd5b60136114fd8284836138db565b507fa50c7451292a74e4519c2173c7e5b36b1cd7551b5105eeccbcf9dc17f70b0e218282604051611261929190613995565b6115465f80516020613cca83398151915233611467565b61156557604051633542737960e01b8152336004820152602401610c68565b7f335e671a341f69fc8a9d870b9ca0f8536481cc2f26bc49e8923c2f0956fc614a816040516115949190613342565b60405180910390a16011610fa682826139c3565b606060078054610b4f9061379f565b5f600f544210158015610f2757505060105442111590565b6115d761235b565b60098054821515600160a01b0260ff60a01b199091161790556040517f6787c7f9a80aa0f5ceddab2c54f1f5169c0b88e75dd5e19d5e858a64144c7dbc9061162490831515815260200190565b60405180910390a150565b6116465f80516020613cca83398151915233611467565b61166557604051633542737960e01b8152336004820152602401610c68565b5f8181526015602052604090205460ff161561169457604051638284957b60e01b815260040160405180910390fd5b5f61169e60165490565b905061271081106116c257604051631eb554db60e11b815260040160405180910390fd5b5f82815260156020908152604091829020805460ff1916600117905590516001600160a01b038516815283917fe01bc9d408afb7ec25f195b5d2463df306cfb166d6e2d37f92d33a3c2e28a73c910160405180910390a2610d098383612282565b610fa6338383612363565b6117455f80516020613cca83398151915233611467565b61176457604051633542737960e01b8152336004820152602401610c68565b601454610100900460ff16611465576040517f359697504a0ea3696a2243a7cd0d4263d95174c4d2ca8223957b2b4d87eb2843905f90a16014805461ff001916610100179055565b6117b461235b565b6001600160a01b038116803b151590158015906117cf575080155b156117ed576040516332483afb60e01b815260040160405180910390fd5b7fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac611816610d0e565b604080516001600160a01b03928316815291851660208301520160405180910390a16008805460ff60a01b1916600160a01b179055600980546001600160a01b0384166001600160a01b0319909116179055610fa682612430565b61187b3383611d30565b6118975760405162461bcd60e51b8152600401610c68906137d1565b6118a3848484846124ae565b50505050565b6118c05f80516020613cca83398151915233611467565b6118df57604051633542737960e01b8152336004820152602401610c68565b600e81905560405181907f7568cfc6634fe67754c0dadfecd8323a3ec2a25d9436ece8e4990f9f1d68ce2a905f90a250565b6119285f80516020613cca83398151915233611467565b61194757604051633542737960e01b8152336004820152602401610c68565b6040517f079788567ca845c85bb345d06d90df82d49f210016b93784fdb20e13e2edb3f0905f90a1600d805460ff19166001179055565b606061198982611c65565b5f6119926124e1565b905080515f036119b157505060408051602081019091525f8152919050565b60145460ff1615610b3a57806119c684612509565b6040516020016119d7929190613a7f565b604051602081830303815290604052915050919050565b50919050565b611a0b5f80516020613cca83398151915233611467565b611a2a57604051633542737960e01b8152336004820152602401610c68565b6040516001600160601b03821681526001600160a01b038316907fed4d7d7d4252d9ec00e4718e99c8b4d80142c9789ddbdab3051be73122b1f8649060200160405180910390a2610fa68282612606565b5f828152600a6020526040902060010154611a9581611f6a565b610d098383611f04565b606060118054610b4f9061379f565b6001600160a01b038281165f9081526005602090815260408083209385168352929052205460ff1680610b3a57600954600160a01b900460ff1615610b3a57611af5610d0e565b6001600160a01b0316826001600160a01b031614905092915050565b611b285f80516020613cca83398151915233611467565b611b4757604051633542737960e01b8152336004820152602401610c68565b808210611b8b5760405162461bcd60e51b8152602060048201526012602482015271496e76616c69642074696d652072616e676560701b6044820152606401610c68565b600f829055601081905560408051838152602081018390527f543f06a6c97d09678ea6d3dfe64dbe8ac82be38975004e0d9016ee85126134ca9101611261565b611bd36122b0565b6001600160a01b038116611c385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c68565b610ef78161230a565b5f6001600160e01b0319821663152a902d60e11b1480610b3a5750610b3a82612703565b5f818152600260205260409020546001600160a01b0316610ef75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c68565b5f81815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611cf7826112f1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f80611d3b836112f1565b9050806001600160a01b0316846001600160a01b03161480611d625750611d628185611aae565b8061103b5750836001600160a01b0316611d7b84610bd0565b6001600160a01b031614949350505050565b826001600160a01b0316611da0826112f1565b6001600160a01b031614611dc65760405162461bcd60e51b8152600401610c6890613abd565b6001600160a01b038216611e285760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c68565b611e358383836001612727565b826001600160a01b0316611e48826112f1565b6001600160a01b031614611e6e5760405162461bcd60e51b8152600401610c6890613abd565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610d09838383600161279a565b611f0e8282611467565b15610fa6575f828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610ef781336127fa565b611f7e8282611467565b610fa6575f828152600a602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611fb53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561205157507f000000000000000000000000000000000000000000000000000000000000000046145b1561207b57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b5f8061212a83612853565b90506121567f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a682611467565b61217357604051631943d95360e21b815260040160405180910390fd5b82355f9081526015602052604090205460ff16156121a457604051638284957b60e01b815260040160405180910390fd5b82602001353410156121c9576040516303e4acf960e01b815260040160405180910390fd5b82355f81815260156020908152604091829020805460ff1916600117905590513381527fe01bc9d408afb7ec25f195b5d2463df306cfb166d6e2d37f92d33a3c2e28a73c910160405180910390a26122223384356128b1565b471561227c576040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016904780156108fc02915f818181858888f1935050505015801561227a573d5f803e3d5ffd5b505b50503590565b610fa6828260405180602001604052805f815250612a4f565b5f826122a78584612a81565b14949350505050565b6008546001600160a01b031633146114655760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c68565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6114656122b0565b816001600160a01b0316836001600160a01b0316036123c45760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c68565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03811615610ef757803b8015610fa6576040805163fb2de5d760e01b81523060048201526102d1602482015290516001600160a01b0384169163fb2de5d7916044808301925f92919082900301818387803b158015612494575f80fd5b505af19250505080156124a5575060015b15610fa6575050565b6124b9848484611d8d565b6124c584848484612ac3565b6118a35760405162461bcd60e51b8152600401610c6890613b02565b60145460609060ff16156124fc5760138054610b4f9061379f565b60128054610b4f9061379f565b6060815f0361252f5750506040805180820190915260018152600360fc1b602082015290565b815f5b8115612558578061254281613b54565b91506125519050600a8361385d565b9150612532565b5f8167ffffffffffffffff811115612572576125726135a4565b6040519080825280601f01601f19166020018201604052801561259c576020820181803683370190505b5090505b841561103b576125b1600183613b6c565b91506125be600a86613b7f565b6125c9906030613870565b60f81b8183815181106125de576125de613883565b60200101906001600160f81b03191690815f1a9053506125ff600a8661385d565b94506125a0565b6127106001600160601b03821611156126745760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610c68565b6001600160a01b0382166126ca5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610c68565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600b55565b5f6001600160e01b03198216637965db0b60e01b1480610b3a5750610b3a82612bc0565b600d5460ff1615801561274257506001600160a01b03841615155b1561278e576127717f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a685611467565b61278e5760405163a09874a360e01b815260040160405180910390fd5b6118a384848484612bff565b6127a684848484612c2c565b6001600160a01b0384166127d0578060165f8282546127c59190613870565b909155506118a39050565b6001600160a01b0383166118a3578060165f8282546127ef9190613b6c565b909155505050505050565b6128048282611467565b610fa65761281181612c52565b61281c836020612c64565b60405160200161282d929190613b92565b60408051601f198184030181529082905262461bcd60e51b8252610c6891600401613342565b5f8061285e83612dfa565b90506128aa816128716040860186613c06565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250612e5e92505050565b9392505050565b6001600160a01b0382166129075760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c68565b5f818152600260205260409020546001600160a01b03161561296b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c68565b6129785f83836001612727565b5f818152600260205260409020546001600160a01b0316156129dc5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c68565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610fa65f8383600161279a565b612a5983836128b1565b612a655f848484612ac3565b610d095760405162461bcd60e51b8152600401610c6890613b02565b5f81815b8451811015612abb57612ab182868381518110612aa457612aa4613883565b6020026020010151612e78565b9150600101612a85565b509392505050565b5f6001600160a01b0384163b15612bb557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612b06903390899088908890600401613c49565b6020604051808303815f875af1925050508015612b40575060408051601f3d908101601f19168201909252612b3d91810190613c85565b60015b612b9b573d808015612b6d576040519150601f19603f3d011682016040523d82523d5f602084013e612b72565b606091505b5080515f03612b935760405162461bcd60e51b8152600401610c6890613b02565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061103b565b506001949350505050565b5f6001600160e01b03198216632b435fdb60e21b1480612bf057506001600160e01b0319821663503e914d60e11b145b80610b3a5750610b3a82612ea4565b5f5b81811015612c2557612c1d8585612c188487613870565b612ef3565b600101612c01565b5050505050565b5f5b81811015612c2557612c4a8585612c458487613870565b612f49565b600101612c2e565b6060610b3a6001600160a01b03831660145b60605f612c72836002613832565b612c7d906002613870565b67ffffffffffffffff811115612c9557612c956135a4565b6040519080825280601f01601f191660200182016040528015612cbf576020820181803683370190505b509050600360fc1b815f81518110612cd957612cd9613883565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110612d0757612d07613883565b60200101906001600160f81b03191690815f1a9053505f612d29846002613832565b612d34906001613870565b90505b6001811115612dab576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612d6857612d68613883565b1a60f81b828281518110612d7e57612d7e613883565b60200101906001600160f81b03191690815f1a90535060049490941c93612da481613ca0565b9050612d37565b5083156128aa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c68565b604080517fd897feb728126d168eaa59ff417ab688edef2205b1037334a43beae294f2fc066020828101919091528335928201929092529082013560608201525f90610b3a9060800160405160208183030381529060405280519060200120612f90565b5f805f612e6b8585612fdc565b91509150612abb8161301b565b5f818310612e92575f8281526020849052604090206128aa565b5f8381526020839052604090206128aa565b5f6001600160e01b031982166380ac58cd60e01b1480612ed457506001600160e01b03198216635b5e139f60e01b145b80610b3a57506301ffc9a760e01b6001600160e01b0319831614610b3a565b6001600160a01b038381161590831615818015612f0d5750805b15612f2b57604051635cbd944160e01b815260040160405180910390fd5b8115612f37575b612c25565b80612f3257612c253386868634613164565b6001600160a01b038381161590831615818015612f635750805b15612f8157604051635cbd944160e01b815260040160405180910390fd5b81612f325780612f3257612c25565b5f610b3a612f9c611ff9565b8360405161190160f01b602082015260228101839052604281018290525f9060620160405160208183030381529060405280519060200120905092915050565b5f808251604103613010576020830151604084015160608501515f1a61300487828585613208565b94509450505050610e20565b505f90506002610e20565b5f81600481111561302e5761302e613cb5565b036130365750565b600181600481111561304a5761304a613cb5565b036130975760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c68565b60028160048111156130ab576130ab613cb5565b036130f85760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c68565b600381600481111561310c5761310c613cb5565b03610ef75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610c68565b5f61316d610d0e565b90506001600160a01b038116156111b2576001600160a01b03811633036131945750612c25565b60405163657711f560e11b81526001600160a01b038781166004830152868116602483015285811660448301526064820185905282169063caee23ea906084015f6040518083038186803b1580156131ea575f80fd5b505afa1580156131fc573d5f803e3d5ffd5b50505050505050505050565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561323d57505f905060036132bc565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561328e573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b0381166132b6575f600192509250506132bc565b91505f90505b94509492505050565b6001600160e01b031981168114610ef7575f80fd5b5f602082840312156132ea575f80fd5b81356128aa816132c5565b5f5b8381101561330f5781810151838201526020016132f7565b50505f910152565b5f815180845261332e8160208601602086016132f5565b601f01601f19169290920160200192915050565b602081525f6128aa6020830184613317565b5f60208284031215613364575f80fd5b5035919050565b80356001600160a01b0381168114613381575f80fd5b919050565b5f8060408385031215613397575f80fd5b6133a08361336b565b946020939093013593505050565b5f805f606084860312156133c0575f80fd5b6133c98461336b565b92506133d76020850161336b565b9150604084013590509250925092565b5f80604083850312156133f8575f80fd5b50508035926020909101359150565b5f60208284031215613417575f80fd5b6128aa8261336b565b5f8060408385031215613431575f80fd5b823591506134416020840161336b565b90509250929050565b5f8083601f84011261345a575f80fd5b50813567ffffffffffffffff811115613471575f80fd5b6020830191508360208260051b8501011115610e20575f80fd5b5f805f6040848603121561349d575f80fd5b833567ffffffffffffffff808211156134b4575f80fd5b90850190606082880312156134c7575f80fd5b909350602085013590808211156134dc575f80fd5b506134e98682870161344a565b9497909650939450505050565b5f805f60408486031215613508575f80fd5b6135118461336b565b9250602084013567ffffffffffffffff81111561352c575f80fd5b6134e98682870161344a565b5f8060208385031215613549575f80fd5b823567ffffffffffffffff80821115613560575f80fd5b818501915085601f830112613573575f80fd5b813581811115613581575f80fd5b866020828501011115613592575f80fd5b60209290920196919550909350505050565b634e487b7160e01b5f52604160045260245ffd5b5f67ffffffffffffffff808411156135d2576135d26135a4565b604051601f8501601f19908116603f011681019082821181831017156135fa576135fa6135a4565b81604052809350858152868686011115613612575f80fd5b858560208301375f602087830101525050509392505050565b5f6020828403121561363b575f80fd5b813567ffffffffffffffff811115613651575f80fd5b8201601f81018413613661575f80fd5b61103b848235602084016135b8565b80358015158114613381575f80fd5b5f6020828403121561368f575f80fd5b6128aa82613670565b5f80604083850312156136a9575f80fd5b6136b28361336b565b915061344160208401613670565b5f805f80608085870312156136d3575f80fd5b6136dc8561336b565b93506136ea6020860161336b565b925060408501359150606085013567ffffffffffffffff81111561370c575f80fd5b8501601f8101871361371c575f80fd5b61372b878235602084016135b8565b91505092959194509250565b5f8060408385031215613748575f80fd5b6137518361336b565b915060208301356001600160601b038116811461376c575f80fd5b809150509250929050565b5f8060408385031215613788575f80fd5b6137918361336b565b91506134416020840161336b565b600181811c908216806137b357607f821691505b6020821081036119ee57634e487b7160e01b5f52602260045260245ffd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610b3a57610b3a61381e565b634e487b7160e01b5f52601260045260245ffd5b5f8261386b5761386b613849565b500490565b80820180821115610b3a57610b3a61381e565b634e487b7160e01b5f52603260045260245ffd5b601f821115610d0957805f5260205f20601f840160051c810160208510156138bc5750805b601f840160051c820191505b81811015612c25575f81556001016138c8565b67ffffffffffffffff8311156138f3576138f36135a4565b61390783613901835461379f565b83613897565b5f601f841160018114613938575f85156139215750838201355b5f19600387901b1c1916600186901b178355612c25565b5f83815260208120601f198716915b828110156139675786850135825560209485019460019092019101613947565b5086821015613983575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b815167ffffffffffffffff8111156139dd576139dd6135a4565b6139f1816139eb845461379f565b84613897565b602080601f831160018114613a24575f8415613a0d5750858301515b5f19600386901b1c1916600185901b1785556111b2565b5f85815260208120601f198616915b82811015613a5257888601518255948401946001909101908401613a33565b5085821015613a6f57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f8351613a908184602088016132f5565b835190830190613aa48183602088016132f5565b64173539b7b760d91b9101908152600501949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b5f60018201613b6557613b6561381e565b5060010190565b81810381811115610b3a57610b3a61381e565b5f82613b8d57613b8d613849565b500690565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351613bc98160178501602088016132f5565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613bfa8160288401602088016132f5565b01602801949350505050565b5f808335601e19843603018112613c1b575f80fd5b83018035915067ffffffffffffffff821115613c35575f80fd5b602001915036819003821315610e20575f80fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90613c7b90830184613317565b9695505050505050565b5f60208284031215613c95575f80fd5b81516128aa816132c5565b5f81613cae57613cae61381e565b505f190190565b634e487b7160e01b5f52602160045260245ffdfea49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a26469706673582212202299e60790f0368a60a17036ada0eab401573a364ce52e6d25378df53376b80764736f6c63430008180033000000000000000000000000348f389d3c8b68cdb089e101b2e6838ffff7a20e000000000000000000000000348f389d3c8b68cdb089e101b2e6838ffff7a20e0000000000000000000000000a99f2a3fa638b8915629675273da33fa0155d2600000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569657276703670757277707a35366f37686d776874627667666a6d697768626b6b65706f32713772766836776432746a78356b766d000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405260043610610392575f3560e01c8063715018a6116101de578063a9fc664e11610108578063d53913931161009d578063e985e9c51161006d578063e985e9c514610abe578063ebdfd72214610add578063f0f2c03614610af2578063f2fde38b14610b11575f80fd5b8063d539139314610a1d578063d547741f14610a50578063e3faad9414610a6f578063e8a3d48514610aaa575f80fd5b8063c270e84c116100d8578063c270e84c1461099f578063c4dbf6ef146109b3578063c87b56dd146109df578063cd02771a146109fe575f80fd5b8063a9fc664e1461092d578063aa98e0c61461094c578063b88d4fde14610961578063bd32fb6614610980575f80fd5b806394739e871161017e578063a14481941161014e578063a1448194146108c8578063a217fddf146108e7578063a22cb465146108fa578063a439926314610919575f80fd5b806394739e871461084e57806395d89b4114610881578063997dad2d146108955780639e05d240146108a9575f80fd5b806391d14854116101b957806391d14854146107dc5780639292caaf146107fb578063931688cb14610810578063938e3d7b1461082f575f80fd5b8063715018a61461078b57806375b238fc1461079f5780638da5cb5b146107bf575f80fd5b806332cb6b0c116102bf578063518302271161025f5780636456bbf71161022f5780636456bbf7146107065780636a41274914610734578063704802751461074d57806370a082311461076c575f80fd5b8063518302271461068f5780635a23dd99146106a85780636221d13c146106c75780636352211e146106e7575f80fd5b806336778d3e1161029a57806336778d3e1461061f57806342842e0e146106325780634684d7e9146106515780634c26124714610670575f80fd5b806332cb6b0c146105d75780633644e515146105ec57806336568abe14610600575f80fd5b80630f2cdd6c116103355780632a55205a116103055780632a55205a146105285780632d2c5565146105665780632d345670146105995780632f2ff15d146105b8575f80fd5b80630f2cdd6c146104a557806318160ddd146104c757806323b872dd146104db578063248a9ca3146104fa575f80fd5b8063081812fc11610370578063081812fc1461042a578063095ea7b314610449578063098144d41461046a5780630d705df61461047e575f80fd5b8063014635461461039657806301ffc9a7146103da57806306fdde0314610409575b5f80fd5b3480156103a1575f80fd5b506103bd73721c008fdff27bf06e7e123956e2fe03b63342e381565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103e5575f80fd5b506103f96103f43660046132da565b610b30565b60405190151581526020016103d1565b348015610414575f80fd5b5061041d610b40565b6040516103d19190613342565b348015610435575f80fd5b506103bd610444366004613354565b610bd0565b348015610454575f80fd5b50610468610463366004613386565b610bf5565b005b348015610475575f80fd5b506103bd610d0e565b348015610489575f80fd5b506040805163657711f560e11b815260016020820152016103d1565b3480156104b0575f80fd5b506104b9600181565b6040519081526020016103d1565b3480156104d2575f80fd5b506016546104b9565b3480156104e6575f80fd5b506104686104f53660046133ae565b610d4a565b348015610505575f80fd5b506104b9610514366004613354565b5f908152600a602052604090206001015490565b348015610533575f80fd5b506105476105423660046133e7565b610d7b565b604080516001600160a01b0390931683526020830191909152016103d1565b348015610571575f80fd5b506103bd7f0000000000000000000000000a99f2a3fa638b8915629675273da33fa0155d2681565b3480156105a4575f80fd5b506104686105b3366004613407565b610e27565b3480156105c3575f80fd5b506104686105d2366004613420565b610efa565b3480156105e2575f80fd5b506104b961271081565b3480156105f7575f80fd5b506104b9610f1e565b34801561060b575f80fd5b5061046861061a366004613420565b610f2c565b6104b961062d36600461348b565b610faa565b34801561063d575f80fd5b5061046861064c3660046133ae565b611043565b34801561065c575f80fd5b5061046861066b3660046134f6565b61105d565b34801561067b575f80fd5b5061046861068a366004613538565b6111ba565b34801561069a575f80fd5b506014546103f99060ff1681565b3480156106b3575f80fd5b506103f96106c23660046134f6565b61126d565b3480156106d2575f80fd5b506009546103f990600160a01b900460ff1681565b3480156106f2575f80fd5b506103bd610701366004613354565b6112f1565b348015610711575f80fd5b506103f9610720366004613354565b60156020525f908152604090205460ff1681565b34801561073f575f80fd5b50600d546103f99060ff1681565b348015610758575f80fd5b50610468610767366004613407565b611350565b348015610777575f80fd5b506104b9610786366004613407565b6113d0565b348015610796575f80fd5b50610468611454565b3480156107aa575f80fd5b506104b95f80516020613cca83398151915281565b3480156107ca575f80fd5b506008546001600160a01b03166103bd565b3480156107e7575f80fd5b506103f96107f6366004613420565b611467565b348015610806575f80fd5b506104b9600f5481565b34801561081b575f80fd5b5061046861082a366004613538565b611491565b34801561083a575f80fd5b5061046861084936600461362b565b61152f565b348015610859575f80fd5b506104b97fd897feb728126d168eaa59ff417ab688edef2205b1037334a43beae294f2fc0681565b34801561088c575f80fd5b5061041d6115a8565b3480156108a0575f80fd5b506103f96115b7565b3480156108b4575f80fd5b506104686108c336600461367f565b6115cf565b3480156108d3575f80fd5b506104686108e2366004613386565b61162f565b3480156108f2575f80fd5b506104b95f81565b348015610905575f80fd5b50610468610914366004613698565b611723565b348015610924575f80fd5b5061046861172e565b348015610938575f80fd5b50610468610947366004613407565b6117ac565b348015610957575f80fd5b506104b9600e5481565b34801561096c575f80fd5b5061046861097b3660046136c0565b611871565b34801561098b575f80fd5b5061046861099a366004613354565b6118a9565b3480156109aa575f80fd5b50610468611911565b3480156109be575f80fd5b5061041d604051806040016040528060018152602001603160f81b81525081565b3480156109ea575f80fd5b5061041d6109f9366004613354565b61197e565b348015610a09575f80fd5b50610468610a18366004613737565b6119f4565b348015610a28575f80fd5b506104b97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b348015610a5b575f80fd5b50610468610a6a366004613420565b611a7b565b348015610a7a575f80fd5b5061041d6040518060400160405280601081526020016f2232b626bab7323796ab37bab1b432b960811b81525081565b348015610ab5575f80fd5b5061041d611a9f565b348015610ac9575f80fd5b506103f9610ad8366004613777565b611aae565b348015610ae8575f80fd5b506104b960105481565b348015610afd575f80fd5b50610468610b0c3660046133e7565b611b11565b348015610b1c575f80fd5b50610468610b2b366004613407565b611bcb565b5f610b3a82611c41565b92915050565b606060068054610b4f9061379f565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7b9061379f565b8015610bc65780601f10610b9d57610100808354040283529160200191610bc6565b820191905f5260205f20905b815481529060010190602001808311610ba957829003601f168201915b5050505050905090565b5f610bda82611c65565b505f908152600460205260409020546001600160a01b031690565b5f610bff826112f1565b9050806001600160a01b0316836001600160a01b031603610c715760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610c8d5750610c8d8133611aae565b610cff5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610c68565b610d098383611cc3565b505050565b6009546001600160a01b031680610d4757600854600160a01b900460ff16610d47575073721c008fdff27bf06e7e123956e2fe03b63342e35b90565b610d543382611d30565b610d705760405162461bcd60e51b8152600401610c68906137d1565b610d09838383611d8d565b5f828152600c602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610def575060408051808201909152600b546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090610e0d906001600160601b031687613832565b610e17919061385d565b91519350909150505b9250929050565b610e3e5f80516020613cca83398151915233611467565b610e5d57604051633542737960e01b8152336004820152602401610c68565b6001600160a01b0381163303610ead5760405162461bcd60e51b815260206004820152601560248201527421b0b713ba103932bb37b5b2903cb7bab939b2b63360591b6044820152606401610c68565b6040516001600160a01b038216907fea8164e5fc0aba0d1b32d0bb0c4fe1a12b46af536f1b43845cef5d06c0fb1cb2905f90a2610ef75f80516020613cca83398151915282611f04565b50565b5f828152600a6020526040902060010154610f1481611f6a565b610d098383611f74565b5f610f27611ff9565b905090565b6001600160a01b0381163314610f9c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c68565b610fa68282611f04565b5050565b5f600f54421015610fce57604051631c594c4b60e11b815260040160405180910390fd5b610fd66115b7565b1561103257610fe633848461126d565b611003576040516359b6540160e11b815260040160405180910390fd5b5f61100d336113d0565b905060018110611030576040516312b60db360e31b815260040160405180910390fd5b505b61103b8461211f565b949350505050565b610d0983838360405180602001604052805f815250611871565b6110745f80516020613cca83398151915233611467565b61109357604051633542737960e01b8152336004820152602401610c68565b805f8190036110b5576040516301d4888d60e51b815260040160405180910390fd5b5f6110bf60165490565b90506127106110ce8383613870565b11156110ed57604051631eb554db60e11b815260040160405180910390fd5b5f5b828110156111b2575f85858381811061110a5761110a613883565b602090810292909201355f81815260159093526040909220549192505060ff161561114857604051638284957b60e01b815260040160405180910390fd5b5f81815260156020908152604091829020805460ff1916600117905590516001600160a01b038916815282917fe01bc9d408afb7ec25f195b5d2463df306cfb166d6e2d37f92d33a3c2e28a73c910160405180910390a26111a98782612282565b506001016110ef565b505050505050565b6111d15f80516020613cca83398151915233611467565b6111f057604051633542737960e01b8152336004820152602401610c68565b60145460ff161561121457604051630eca4c0760e31b815260040160405180910390fd5b60136112218284836138db565b506014805460ff191660011790556040517f1e6f11a8859bececade370c545e4803c8582c7c9e3d1a2e12fde1e002d2ab6b2906112619084908490613995565b60405180910390a15050565b6040516bffffffffffffffffffffffff19606085901b1660208201525f9081906034016040516020818303038152906040528051906020012090506112e88484808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050600e54915084905061229b565b95945050505050565b5f818152600260205260408120546001600160a01b031680610b3a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c68565b6113675f80516020613cca83398151915233611467565b61138657604051633542737960e01b8152336004820152602401610c68565b6040516001600160a01b038216907f336843bc8e0da317ebac6ca5ab1dabe1910eb246507b76bbba81f80130a6dd82905f90a2610ef75f80516020613cca83398151915282611f74565b5f6001600160a01b0382166114395760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610c68565b506001600160a01b03165f9081526003602052604090205490565b61145c6122b0565b6114655f61230a565b565b5f918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6114a85f80516020613cca83398151915233611467565b6114c757604051633542737960e01b8152336004820152602401610c68565b601454610100900460ff16156114f057604051630eca4c0760e31b815260040160405180910390fd5b60136114fd8284836138db565b507fa50c7451292a74e4519c2173c7e5b36b1cd7551b5105eeccbcf9dc17f70b0e218282604051611261929190613995565b6115465f80516020613cca83398151915233611467565b61156557604051633542737960e01b8152336004820152602401610c68565b7f335e671a341f69fc8a9d870b9ca0f8536481cc2f26bc49e8923c2f0956fc614a816040516115949190613342565b60405180910390a16011610fa682826139c3565b606060078054610b4f9061379f565b5f600f544210158015610f2757505060105442111590565b6115d761235b565b60098054821515600160a01b0260ff60a01b199091161790556040517f6787c7f9a80aa0f5ceddab2c54f1f5169c0b88e75dd5e19d5e858a64144c7dbc9061162490831515815260200190565b60405180910390a150565b6116465f80516020613cca83398151915233611467565b61166557604051633542737960e01b8152336004820152602401610c68565b5f8181526015602052604090205460ff161561169457604051638284957b60e01b815260040160405180910390fd5b5f61169e60165490565b905061271081106116c257604051631eb554db60e11b815260040160405180910390fd5b5f82815260156020908152604091829020805460ff1916600117905590516001600160a01b038516815283917fe01bc9d408afb7ec25f195b5d2463df306cfb166d6e2d37f92d33a3c2e28a73c910160405180910390a2610d098383612282565b610fa6338383612363565b6117455f80516020613cca83398151915233611467565b61176457604051633542737960e01b8152336004820152602401610c68565b601454610100900460ff16611465576040517f359697504a0ea3696a2243a7cd0d4263d95174c4d2ca8223957b2b4d87eb2843905f90a16014805461ff001916610100179055565b6117b461235b565b6001600160a01b038116803b151590158015906117cf575080155b156117ed576040516332483afb60e01b815260040160405180910390fd5b7fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac611816610d0e565b604080516001600160a01b03928316815291851660208301520160405180910390a16008805460ff60a01b1916600160a01b179055600980546001600160a01b0384166001600160a01b0319909116179055610fa682612430565b61187b3383611d30565b6118975760405162461bcd60e51b8152600401610c68906137d1565b6118a3848484846124ae565b50505050565b6118c05f80516020613cca83398151915233611467565b6118df57604051633542737960e01b8152336004820152602401610c68565b600e81905560405181907f7568cfc6634fe67754c0dadfecd8323a3ec2a25d9436ece8e4990f9f1d68ce2a905f90a250565b6119285f80516020613cca83398151915233611467565b61194757604051633542737960e01b8152336004820152602401610c68565b6040517f079788567ca845c85bb345d06d90df82d49f210016b93784fdb20e13e2edb3f0905f90a1600d805460ff19166001179055565b606061198982611c65565b5f6119926124e1565b905080515f036119b157505060408051602081019091525f8152919050565b60145460ff1615610b3a57806119c684612509565b6040516020016119d7929190613a7f565b604051602081830303815290604052915050919050565b50919050565b611a0b5f80516020613cca83398151915233611467565b611a2a57604051633542737960e01b8152336004820152602401610c68565b6040516001600160601b03821681526001600160a01b038316907fed4d7d7d4252d9ec00e4718e99c8b4d80142c9789ddbdab3051be73122b1f8649060200160405180910390a2610fa68282612606565b5f828152600a6020526040902060010154611a9581611f6a565b610d098383611f04565b606060118054610b4f9061379f565b6001600160a01b038281165f9081526005602090815260408083209385168352929052205460ff1680610b3a57600954600160a01b900460ff1615610b3a57611af5610d0e565b6001600160a01b0316826001600160a01b031614905092915050565b611b285f80516020613cca83398151915233611467565b611b4757604051633542737960e01b8152336004820152602401610c68565b808210611b8b5760405162461bcd60e51b8152602060048201526012602482015271496e76616c69642074696d652072616e676560701b6044820152606401610c68565b600f829055601081905560408051838152602081018390527f543f06a6c97d09678ea6d3dfe64dbe8ac82be38975004e0d9016ee85126134ca9101611261565b611bd36122b0565b6001600160a01b038116611c385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c68565b610ef78161230a565b5f6001600160e01b0319821663152a902d60e11b1480610b3a5750610b3a82612703565b5f818152600260205260409020546001600160a01b0316610ef75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c68565b5f81815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611cf7826112f1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f80611d3b836112f1565b9050806001600160a01b0316846001600160a01b03161480611d625750611d628185611aae565b8061103b5750836001600160a01b0316611d7b84610bd0565b6001600160a01b031614949350505050565b826001600160a01b0316611da0826112f1565b6001600160a01b031614611dc65760405162461bcd60e51b8152600401610c6890613abd565b6001600160a01b038216611e285760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c68565b611e358383836001612727565b826001600160a01b0316611e48826112f1565b6001600160a01b031614611e6e5760405162461bcd60e51b8152600401610c6890613abd565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610d09838383600161279a565b611f0e8282611467565b15610fa6575f828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610ef781336127fa565b611f7e8282611467565b610fa6575f828152600a602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611fb53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f306001600160a01b037f000000000000000000000000313e99d23d6a9ed47af8dccd545c2685f21ec44b1614801561205157507f000000000000000000000000000000000000000000000000000000000000000146145b1561207b57507f62dfaa959b21abf92ab5a7ab627c74e9d4206c2a5dca9cc1bfb7754c8aab507690565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fb5157617e1cafe3ad69a197abf52a066c82f8b2ce4cfa1271bdf09023ca7eac2828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b5f8061212a83612853565b90506121567f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a682611467565b61217357604051631943d95360e21b815260040160405180910390fd5b82355f9081526015602052604090205460ff16156121a457604051638284957b60e01b815260040160405180910390fd5b82602001353410156121c9576040516303e4acf960e01b815260040160405180910390fd5b82355f81815260156020908152604091829020805460ff1916600117905590513381527fe01bc9d408afb7ec25f195b5d2463df306cfb166d6e2d37f92d33a3c2e28a73c910160405180910390a26122223384356128b1565b471561227c576040516001600160a01b037f0000000000000000000000000a99f2a3fa638b8915629675273da33fa0155d2616904780156108fc02915f818181858888f1935050505015801561227a573d5f803e3d5ffd5b505b50503590565b610fa6828260405180602001604052805f815250612a4f565b5f826122a78584612a81565b14949350505050565b6008546001600160a01b031633146114655760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c68565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6114656122b0565b816001600160a01b0316836001600160a01b0316036123c45760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c68565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03811615610ef757803b8015610fa6576040805163fb2de5d760e01b81523060048201526102d1602482015290516001600160a01b0384169163fb2de5d7916044808301925f92919082900301818387803b158015612494575f80fd5b505af19250505080156124a5575060015b15610fa6575050565b6124b9848484611d8d565b6124c584848484612ac3565b6118a35760405162461bcd60e51b8152600401610c6890613b02565b60145460609060ff16156124fc5760138054610b4f9061379f565b60128054610b4f9061379f565b6060815f0361252f5750506040805180820190915260018152600360fc1b602082015290565b815f5b8115612558578061254281613b54565b91506125519050600a8361385d565b9150612532565b5f8167ffffffffffffffff811115612572576125726135a4565b6040519080825280601f01601f19166020018201604052801561259c576020820181803683370190505b5090505b841561103b576125b1600183613b6c565b91506125be600a86613b7f565b6125c9906030613870565b60f81b8183815181106125de576125de613883565b60200101906001600160f81b03191690815f1a9053506125ff600a8661385d565b94506125a0565b6127106001600160601b03821611156126745760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610c68565b6001600160a01b0382166126ca5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610c68565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600b55565b5f6001600160e01b03198216637965db0b60e01b1480610b3a5750610b3a82612bc0565b600d5460ff1615801561274257506001600160a01b03841615155b1561278e576127717f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a685611467565b61278e5760405163a09874a360e01b815260040160405180910390fd5b6118a384848484612bff565b6127a684848484612c2c565b6001600160a01b0384166127d0578060165f8282546127c59190613870565b909155506118a39050565b6001600160a01b0383166118a3578060165f8282546127ef9190613b6c565b909155505050505050565b6128048282611467565b610fa65761281181612c52565b61281c836020612c64565b60405160200161282d929190613b92565b60408051601f198184030181529082905262461bcd60e51b8252610c6891600401613342565b5f8061285e83612dfa565b90506128aa816128716040860186613c06565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250612e5e92505050565b9392505050565b6001600160a01b0382166129075760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c68565b5f818152600260205260409020546001600160a01b03161561296b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c68565b6129785f83836001612727565b5f818152600260205260409020546001600160a01b0316156129dc5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c68565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610fa65f8383600161279a565b612a5983836128b1565b612a655f848484612ac3565b610d095760405162461bcd60e51b8152600401610c6890613b02565b5f81815b8451811015612abb57612ab182868381518110612aa457612aa4613883565b6020026020010151612e78565b9150600101612a85565b509392505050565b5f6001600160a01b0384163b15612bb557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612b06903390899088908890600401613c49565b6020604051808303815f875af1925050508015612b40575060408051601f3d908101601f19168201909252612b3d91810190613c85565b60015b612b9b573d808015612b6d576040519150601f19603f3d011682016040523d82523d5f602084013e612b72565b606091505b5080515f03612b935760405162461bcd60e51b8152600401610c6890613b02565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061103b565b506001949350505050565b5f6001600160e01b03198216632b435fdb60e21b1480612bf057506001600160e01b0319821663503e914d60e11b145b80610b3a5750610b3a82612ea4565b5f5b81811015612c2557612c1d8585612c188487613870565b612ef3565b600101612c01565b5050505050565b5f5b81811015612c2557612c4a8585612c458487613870565b612f49565b600101612c2e565b6060610b3a6001600160a01b03831660145b60605f612c72836002613832565b612c7d906002613870565b67ffffffffffffffff811115612c9557612c956135a4565b6040519080825280601f01601f191660200182016040528015612cbf576020820181803683370190505b509050600360fc1b815f81518110612cd957612cd9613883565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110612d0757612d07613883565b60200101906001600160f81b03191690815f1a9053505f612d29846002613832565b612d34906001613870565b90505b6001811115612dab576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612d6857612d68613883565b1a60f81b828281518110612d7e57612d7e613883565b60200101906001600160f81b03191690815f1a90535060049490941c93612da481613ca0565b9050612d37565b5083156128aa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c68565b604080517fd897feb728126d168eaa59ff417ab688edef2205b1037334a43beae294f2fc066020828101919091528335928201929092529082013560608201525f90610b3a9060800160405160208183030381529060405280519060200120612f90565b5f805f612e6b8585612fdc565b91509150612abb8161301b565b5f818310612e92575f8281526020849052604090206128aa565b5f8381526020839052604090206128aa565b5f6001600160e01b031982166380ac58cd60e01b1480612ed457506001600160e01b03198216635b5e139f60e01b145b80610b3a57506301ffc9a760e01b6001600160e01b0319831614610b3a565b6001600160a01b038381161590831615818015612f0d5750805b15612f2b57604051635cbd944160e01b815260040160405180910390fd5b8115612f37575b612c25565b80612f3257612c253386868634613164565b6001600160a01b038381161590831615818015612f635750805b15612f8157604051635cbd944160e01b815260040160405180910390fd5b81612f325780612f3257612c25565b5f610b3a612f9c611ff9565b8360405161190160f01b602082015260228101839052604281018290525f9060620160405160208183030381529060405280519060200120905092915050565b5f808251604103613010576020830151604084015160608501515f1a61300487828585613208565b94509450505050610e20565b505f90506002610e20565b5f81600481111561302e5761302e613cb5565b036130365750565b600181600481111561304a5761304a613cb5565b036130975760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c68565b60028160048111156130ab576130ab613cb5565b036130f85760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c68565b600381600481111561310c5761310c613cb5565b03610ef75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610c68565b5f61316d610d0e565b90506001600160a01b038116156111b2576001600160a01b03811633036131945750612c25565b60405163657711f560e11b81526001600160a01b038781166004830152868116602483015285811660448301526064820185905282169063caee23ea906084015f6040518083038186803b1580156131ea575f80fd5b505afa1580156131fc573d5f803e3d5ffd5b50505050505050505050565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561323d57505f905060036132bc565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561328e573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b0381166132b6575f600192509250506132bc565b91505f90505b94509492505050565b6001600160e01b031981168114610ef7575f80fd5b5f602082840312156132ea575f80fd5b81356128aa816132c5565b5f5b8381101561330f5781810151838201526020016132f7565b50505f910152565b5f815180845261332e8160208601602086016132f5565b601f01601f19169290920160200192915050565b602081525f6128aa6020830184613317565b5f60208284031215613364575f80fd5b5035919050565b80356001600160a01b0381168114613381575f80fd5b919050565b5f8060408385031215613397575f80fd5b6133a08361336b565b946020939093013593505050565b5f805f606084860312156133c0575f80fd5b6133c98461336b565b92506133d76020850161336b565b9150604084013590509250925092565b5f80604083850312156133f8575f80fd5b50508035926020909101359150565b5f60208284031215613417575f80fd5b6128aa8261336b565b5f8060408385031215613431575f80fd5b823591506134416020840161336b565b90509250929050565b5f8083601f84011261345a575f80fd5b50813567ffffffffffffffff811115613471575f80fd5b6020830191508360208260051b8501011115610e20575f80fd5b5f805f6040848603121561349d575f80fd5b833567ffffffffffffffff808211156134b4575f80fd5b90850190606082880312156134c7575f80fd5b909350602085013590808211156134dc575f80fd5b506134e98682870161344a565b9497909650939450505050565b5f805f60408486031215613508575f80fd5b6135118461336b565b9250602084013567ffffffffffffffff81111561352c575f80fd5b6134e98682870161344a565b5f8060208385031215613549575f80fd5b823567ffffffffffffffff80821115613560575f80fd5b818501915085601f830112613573575f80fd5b813581811115613581575f80fd5b866020828501011115613592575f80fd5b60209290920196919550909350505050565b634e487b7160e01b5f52604160045260245ffd5b5f67ffffffffffffffff808411156135d2576135d26135a4565b604051601f8501601f19908116603f011681019082821181831017156135fa576135fa6135a4565b81604052809350858152868686011115613612575f80fd5b858560208301375f602087830101525050509392505050565b5f6020828403121561363b575f80fd5b813567ffffffffffffffff811115613651575f80fd5b8201601f81018413613661575f80fd5b61103b848235602084016135b8565b80358015158114613381575f80fd5b5f6020828403121561368f575f80fd5b6128aa82613670565b5f80604083850312156136a9575f80fd5b6136b28361336b565b915061344160208401613670565b5f805f80608085870312156136d3575f80fd5b6136dc8561336b565b93506136ea6020860161336b565b925060408501359150606085013567ffffffffffffffff81111561370c575f80fd5b8501601f8101871361371c575f80fd5b61372b878235602084016135b8565b91505092959194509250565b5f8060408385031215613748575f80fd5b6137518361336b565b915060208301356001600160601b038116811461376c575f80fd5b809150509250929050565b5f8060408385031215613788575f80fd5b6137918361336b565b91506134416020840161336b565b600181811c908216806137b357607f821691505b6020821081036119ee57634e487b7160e01b5f52602260045260245ffd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610b3a57610b3a61381e565b634e487b7160e01b5f52601260045260245ffd5b5f8261386b5761386b613849565b500490565b80820180821115610b3a57610b3a61381e565b634e487b7160e01b5f52603260045260245ffd5b601f821115610d0957805f5260205f20601f840160051c810160208510156138bc5750805b601f840160051c820191505b81811015612c25575f81556001016138c8565b67ffffffffffffffff8311156138f3576138f36135a4565b61390783613901835461379f565b83613897565b5f601f841160018114613938575f85156139215750838201355b5f19600387901b1c1916600186901b178355612c25565b5f83815260208120601f198716915b828110156139675786850135825560209485019460019092019101613947565b5086821015613983575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b815167ffffffffffffffff8111156139dd576139dd6135a4565b6139f1816139eb845461379f565b84613897565b602080601f831160018114613a24575f8415613a0d5750858301515b5f19600386901b1c1916600185901b1785556111b2565b5f85815260208120601f198616915b82811015613a5257888601518255948401946001909101908401613a33565b5085821015613a6f57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f8351613a908184602088016132f5565b835190830190613aa48183602088016132f5565b64173539b7b760d91b9101908152600501949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b5f60018201613b6557613b6561381e565b5060010190565b81810381811115610b3a57610b3a61381e565b5f82613b8d57613b8d613849565b500690565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351613bc98160178501602088016132f5565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613bfa8160288401602088016132f5565b01602801949350505050565b5f808335601e19843603018112613c1b575f80fd5b83018035915067ffffffffffffffff821115613c35575f80fd5b602001915036819003821315610e20575f80fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90613c7b90830184613317565b9695505050505050565b5f60208284031215613c95575f80fd5b81516128aa816132c5565b5f81613cae57613cae61381e565b505f190190565b634e487b7160e01b5f52602160045260245ffdfea49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a26469706673582212202299e60790f0368a60a17036ada0eab401573a364ce52e6d25378df53376b80764736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000348f389d3c8b68cdb089e101b2e6838ffff7a20e000000000000000000000000348f389d3c8b68cdb089e101b2e6838ffff7a20e0000000000000000000000000a99f2a3fa638b8915629675273da33fa0155d2600000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569657276703670757277707a35366f37686d776874627667666a6d697768626b6b65706f32713772766836776432746a78356b766d000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _admin (address): 0x348F389d3C8b68cdb089E101b2e6838FfFF7A20E
Arg [1] : _minter (address): 0x348F389d3C8b68cdb089E101b2e6838FfFF7A20E
Arg [2] : _treasury (address): 0x0a99F2A3fa638b8915629675273DA33Fa0155D26
Arg [3] : _preRevealBaseURI (string): ipfs://bafkreiervp6purwpz56o7hmwhtbvgfjmiwhbkkepo2q7rvh6wd2tjx5kvm
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000348f389d3c8b68cdb089e101b2e6838ffff7a20e
Arg [1] : 000000000000000000000000348f389d3c8b68cdb089e101b2e6838ffff7a20e
Arg [2] : 0000000000000000000000000a99f2a3fa638b8915629675273da33fa0155d26
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000042
Arg [5] : 697066733a2f2f6261666b726569657276703670757277707a35366f37686d77
Arg [6] : 6874627667666a6d697768626b6b65706f32713772766836776432746a78356b
Arg [7] : 766d000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ 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.