ETH Price: $3,387.96 (-2.67%)
Gas: 1 Gwei

Token

Chiblings (CHIB)
 

Overview

Max Total Supply

69,860 CHIB

Holders

2,669

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
0.050723291012409851 CHIB

Value
$0.00
0x1ba9c2eaeae7e4bc3ac9578dd6145c4e0d428fb6
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Chiblings

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 4 : Chiblings.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
/*
                                                               111111                                                                   
                                                       111110000000000000111                                                            
                                                11111100000000011111000000000111                                                        
                                            1110000000011111           111000000011                                                     
                                         110000001111                      11100000011                                                  
                                       100000111                               1100000111                                               
                                    11000011                                      1110000111                                            
                                  11000111                                            110000011                                         
                                1100011                                                 11000001                                        
                               100011                                                      1000011                                      
                             100001                                                          10001                                      
                           1000001                                                            10001                                     
                          100011                                                               10001                                    
                         10001                                                                 100001                                   
                    1111100001111                                                              100001                                   
                  10000000000000000111                                   1111111                10001                                   
                 10000111111111100000001                           1111100000000001111           10001                                  
                 100000111      111000001                        110000000011111000000011        10001                                  
                  1100000000010000000011                         10000111        111100001       10001                                  
                     1111000000011111                             11000001111111110000001        10001                                  
                        10001             11111111                  11000000000000000111          10001                                 
                        10001        111000000000000111                111111111111               10001                                 
                        10001      11000000000000000000011                                        10001                                 
                        1000    11000011110001   111110000011                                      1000                                 
                        1000   1000011  10001         1100000011                                   10001                                
                        1000 1000011   10001            1100000011                                 10001                                
                        1000000001      111                110000001                               10001                                
                        00000001                              11100001                             10001                                
                      11000011                                   110001                            10001                                
                     1000001                                       1000                            10001                                
                   1100001                                         0001                            10001                                
                 11000011                                        110001                            10001                                
               11000011                                         100001                             10001                                
              100011                                           100001                              10001                                
            100011                                            100011                                0000                                
         1100001                                            110001                                  1000                                
        1000011                                           1100001                                   10001                               
      1000011                                            1000011                                    10001                               
    100001                                              100011                                      10001                               
  100001                                               10001                                        10001                               
1100011                                               10001                                         10001                               
10001       11111111111111111                     11100001                                          10001                               
1000111111100000000000000000001111             110000011                                            10001                               
1100000000000011111111111111100000011111    1100000111                                              10001                               
   11111100000001111111111111100000000000000000011                                                  10001                               
          1111100000000000000000000000000000011                                                     10001                               
                111100001111111111111                                                               10001                               
                    1000                                                                             0001                               
                    1001                                                                             10001                              
                    1001                                                                             10001                              
                   10001                                                                             10001                              
                   10001                                                                             10001                              
                   10001                                                                              1001                              
                   10001                                                                              1000                              
                   10001                                                                              10001                             
                   1000                                                                               10001                             
                   0001                                                                                0001                             
                  10001                                                                                10001                            
                  10001                                                                                10001                            
                  10001                                                                                10001                            
                  10001                                                                                 0001                            
                  10001                                                                                 1000                            
                  10001                                                                                 10001                           
                  10001                                                                                 10001                           
                  10001                                                                                 10001                           
                  10001                                                                                 10000                           
*/
import {Ownable} from "solady/auth/Ownable.sol";
import {DN404} from "dn404/src/DN404.sol";
import {ITokenURI} from "./ITokenURI.sol";

contract Chiblings is DN404, Ownable {
    error MetadataLocked();

    ITokenURI public metadata;

    bool public metadataLocked;

    constructor(ITokenURI metadata_) {
        metadata = metadata_;
        _initializeOwner(tx.origin);
    }

    /// @dev Returns the name of the token.
    function name() public pure override returns (string memory) {
        return "Chiblings";
    }

    /// @dev Returns the symbol of the token.
    function symbol() public pure override returns (string memory) {
        return "CHIB";
    }

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id`.
    function tokenURI(uint256 id) public view override returns (string memory) {
        return metadata.tokenURI(id);
    }

    /// @dev Initializes the contract with the initial token supply and the owner of the supply.
    function initialize(address mirror) public onlyOwner {
        uint256 initialTokenSupply = 6986 * _unit();
        _initializeDN404(initialTokenSupply, msg.sender, mirror);
        _approve(msg.sender, 0x09350F89e2D7B6e96bA730783c2d76137B045FEF, type(uint256).max);
        _transfer(msg.sender, 0x3473729421387941335901F6CafCce615115D4a7, 350 ether);
        // pullOwner();
        (bool success, ) = mirror.call(abi.encodeWithSelector(0x6cef16e6));
        if (!success) {
            revert LinkMirrorContractFailed();
        }
    }

    /// @dev Sets the token metadata contract.
    function setMetadata(ITokenURI metadata_) public onlyOwner {
        if (metadataLocked) {
            revert MetadataLocked();
        }
        metadata = metadata_;
    }

    /// @dev Sets the token metadata locked.
    function setMetadataLocked() public onlyOwner {
        metadataLocked = true;
    }

    /// @dev 10 CHIB tokens are equal to 1 NFT.
    function _unit() internal pure override returns (uint256) {
        return 10 ** 19;
    }
}

File 2 of 4 : Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Simple single owner authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract Ownable {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The caller is not authorized to call the function.
    error Unauthorized();

    /// @dev The `newOwner` cannot be the zero address.
    error NewOwnerIsZeroAddress();

    /// @dev The `pendingOwner` does not have a valid handover request.
    error NoHandoverRequest();

    /// @dev Cannot double-initialize.
    error AlreadyInitialized();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ownership is transferred from `oldOwner` to `newOwner`.
    /// This event is intentionally kept the same as OpenZeppelin's Ownable to be
    /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
    /// despite it not being as lightweight as a single argument event.
    event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);

    /// @dev An ownership handover to `pendingOwner` has been requested.
    event OwnershipHandoverRequested(address indexed pendingOwner);

    /// @dev The ownership handover to `pendingOwner` has been canceled.
    event OwnershipHandoverCanceled(address indexed pendingOwner);

    /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
    uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
        0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;

    /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
        0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;

    /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
        0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                          STORAGE                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The owner slot is given by:
    /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
    /// It is intentionally chosen to be a high value
    /// to avoid collision with lower slots.
    /// The choice of manual storage layout is to enable compatibility
    /// with both regular and upgradeable contracts.
    bytes32 internal constant _OWNER_SLOT =
        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;

    /// The ownership handover slot of `newOwner` is given by:
    /// ```
    ///     mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
    ///     let handoverSlot := keccak256(0x00, 0x20)
    /// ```
    /// It stores the expiry timestamp of the two-step ownership handover.
    uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     INTERNAL FUNCTIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
    function _guardInitializeOwner() internal pure virtual returns (bool guard) {}

    /// @dev Initializes the owner directly without authorization guard.
    /// This function must be called upon initialization,
    /// regardless of whether the contract is upgradeable or not.
    /// This is to enable generalization to both regular and upgradeable contracts,
    /// and to save gas in case the initial owner is not the caller.
    /// For performance reasons, this function will not check if there
    /// is an existing owner.
    function _initializeOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                if sload(ownerSlot) {
                    mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
                    revert(0x1c, 0x04)
                }
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(_OWNER_SLOT, newOwner)
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        }
    }

    /// @dev Sets the owner directly without authorization guard.
    function _setOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, newOwner)
            }
        }
    }

    /// @dev Throws if the sender is not the owner.
    function _checkOwner() internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // If the caller is not the stored owner, revert.
            if iszero(eq(caller(), sload(_OWNER_SLOT))) {
                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Returns how long a two-step ownership handover is valid for in seconds.
    /// Override to return a different value if needed.
    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
    function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
        return 48 * 3600;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  PUBLIC UPDATE FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Allows the owner to transfer the ownership to `newOwner`.
    function transferOwnership(address newOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(shl(96, newOwner)) {
                mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
                revert(0x1c, 0x04)
            }
        }
        _setOwner(newOwner);
    }

    /// @dev Allows the owner to renounce their ownership.
    function renounceOwnership() public payable virtual onlyOwner {
        _setOwner(address(0));
    }

    /// @dev Request a two-step ownership handover to the caller.
    /// The request will automatically expire in 48 hours (172800 seconds) by default.
    function requestOwnershipHandover() public payable virtual {
        unchecked {
            uint256 expires = block.timestamp + _ownershipHandoverValidFor();
            /// @solidity memory-safe-assembly
            assembly {
                // Compute and set the handover slot to `expires`.
                mstore(0x0c, _HANDOVER_SLOT_SEED)
                mstore(0x00, caller())
                sstore(keccak256(0x0c, 0x20), expires)
                // Emit the {OwnershipHandoverRequested} event.
                log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
            }
        }
    }

    /// @dev Cancels the two-step ownership handover to the caller, if any.
    function cancelOwnershipHandover() public payable virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, caller())
            sstore(keccak256(0x0c, 0x20), 0)
            // Emit the {OwnershipHandoverCanceled} event.
            log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
        }
    }

    /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
    /// Reverts if there is no existing ownership handover requested by `pendingOwner`.
    function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            let handoverSlot := keccak256(0x0c, 0x20)
            // If the handover does not exist, or has expired.
            if gt(timestamp(), sload(handoverSlot)) {
                mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
                revert(0x1c, 0x04)
            }
            // Set the handover slot to 0.
            sstore(handoverSlot, 0)
        }
        _setOwner(pendingOwner);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   PUBLIC READ FUNCTIONS                    */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the owner of the contract.
    function owner() public view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := sload(_OWNER_SLOT)
        }
    }

    /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
    function ownershipHandoverExpiresAt(address pendingOwner)
        public
        view
        virtual
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the handover slot.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            // Load the handover slot.
            result := sload(keccak256(0x0c, 0x20))
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         MODIFIERS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Marks a function as only callable by the owner.
    modifier onlyOwner() virtual {
        _checkOwner();
        _;
    }
}

File 3 of 4 : DN404.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @title DN404
/// @notice DN404 is a hybrid ERC20 and ERC721 implementation that mints
/// and burns NFTs based on an account's ERC20 token balance.
///
/// @author vectorized.eth (@optimizoor)
/// @author Quit (@0xQuit)
/// @author Michael Amadi (@AmadiMichaels)
/// @author cygaar (@0xCygaar)
/// @author Thomas (@0xjustadev)
/// @author Harrison (@PopPunkOnChain)
///
/// @dev Note:
/// - The ERC721 data is stored in this base DN404 contract, however a
///   DN404Mirror contract ***MUST*** be deployed and linked during
///   initialization.
abstract contract DN404 {
    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                           EVENTS                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Emitted when `amount` tokens is transferred from `from` to `to`.
    event Transfer(address indexed from, address indexed to, uint256 amount);

    /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`.
    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /// @dev Emitted when `target` sets their skipNFT flag to `status`.
    event SkipNFTSet(address indexed target, bool status);

    /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`.
    uint256 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`.
    uint256 private constant _APPROVAL_EVENT_SIGNATURE =
        0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925;

    /// @dev `keccak256(bytes("SkipNFTSet(address,bool)"))`.
    uint256 private constant _SKIP_NFT_SET_EVENT_SIGNATURE =
        0xb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d6420393;

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                        CUSTOM ERRORS                       */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Thrown when attempting to double-initialize the contract.
    error DNAlreadyInitialized();

    /// @dev Thrown when attempting to transfer or burn more tokens than sender's balance.
    error InsufficientBalance();

    /// @dev Thrown when a spender attempts to transfer tokens with an insufficient allowance.
    error InsufficientAllowance();

    /// @dev Thrown when minting an amount of tokens that would overflow the max tokens.
    error TotalSupplyOverflow();

    /// @dev The unit cannot be zero.
    error UnitIsZero();

    /// @dev Thrown when the caller for a fallback NFT function is not the mirror contract.
    error SenderNotMirror();

    /// @dev Thrown when attempting to transfer tokens to the zero address.
    error TransferToZeroAddress();

    /// @dev Thrown when the mirror address provided for initialization is the zero address.
    error MirrorAddressIsZero();

    /// @dev Thrown when the link call to the mirror contract reverts.
    error LinkMirrorContractFailed();

    /// @dev Thrown when setting an NFT token approval
    /// and the caller is not the owner or an approved operator.
    error ApprovalCallerNotOwnerNorApproved();

    /// @dev Thrown when transferring an NFT
    /// and the caller is not the owner or an approved operator.
    error TransferCallerNotOwnerNorApproved();

    /// @dev Thrown when transferring an NFT and the from address is not the current owner.
    error TransferFromIncorrectOwner();

    /// @dev Thrown when checking the owner or approved address for a non-existent NFT.
    error TokenDoesNotExist();

    /// @dev The function selector is not recognized.
    error FnSelectorNotRecognized();

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                         CONSTANTS                          */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev The flag to denote that the address data is initialized.
    uint8 internal constant _ADDRESS_DATA_INITIALIZED_FLAG = 1 << 0;

    /// @dev The flag to denote that the address should skip NFTs.
    uint8 internal constant _ADDRESS_DATA_SKIP_NFT_FLAG = 1 << 1;

    /// @dev The flag to denote that the address has overridden the default Permit2 allowance.
    uint8 internal constant _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG = 1 << 2;

    /// @dev The canonical Permit2 address.
    /// For signature-based allowance granting for single transaction ERC20 `transferFrom`.
    /// To enable, override `_givePermit2DefaultInfiniteAllowance()`.
    /// [Github](https://github.com/Uniswap/permit2)
    /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
    address internal constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                          STORAGE                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Struct containing an address's token data and settings.
    struct AddressData {
        // Auxiliary data.
        uint88 aux;
        // Flags for `initialized` and `skipNFT`.
        uint8 flags;
        // The alias for the address. Zero means absence of an alias.
        uint32 addressAlias;
        // The number of NFT tokens.
        uint32 ownedLength;
        // The token balance in wei.
        uint96 balance;
    }

    /// @dev A uint32 map in storage.
    struct Uint32Map {
        uint256 spacer;
    }

    /// @dev A bitmap in storage.
    struct Bitmap {
        uint256 spacer;
    }

    /// @dev A struct to wrap a uint256 in storage.
    struct Uint256Ref {
        uint256 value;
    }

    /// @dev A mapping of an address pair to a Uint256Ref.
    struct AddressPairToUint256RefMap {
        uint256 spacer;
    }

    /// @dev Struct containing the base token contract storage.
    struct DN404Storage {
        // Current number of address aliases assigned.
        uint32 numAliases;
        // Next NFT ID to assign for a mint.
        uint32 nextTokenId;
        // The head of the burned pool.
        uint32 burnedPoolHead;
        // The tail of the burned pool.
        uint32 burnedPoolTail;
        // Total supply of minted NFTs.
        uint32 totalNFTSupply;
        // Total supply of tokens.
        uint96 totalSupply;
        // Address of the NFT mirror contract.
        address mirrorERC721;
        // Mapping of a user alias number to their address.
        mapping(uint32 => address) aliasToAddress;
        // Mapping of user operator approvals for NFTs.
        AddressPairToUint256RefMap operatorApprovals;
        // Mapping of NFT approvals to approved operators.
        mapping(uint256 => address) nftApprovals;
        // Bitmap of whether an non-zero NFT approval may exist.
        Bitmap mayHaveNFTApproval;
        // Bitmap of whether a NFT ID exists. Ignored if `_useExistsLookup()` returns false.
        Bitmap exists;
        // Mapping of user allowances for ERC20 spenders.
        AddressPairToUint256RefMap allowance;
        // Mapping of NFT IDs owned by an address.
        mapping(address => Uint32Map) owned;
        // The pool of burned NFT IDs.
        Uint32Map burnedPool;
        // Even indices: owner aliases. Odd indices: owned indices.
        Uint32Map oo;
        // Mapping of user account AddressData.
        mapping(address => AddressData) addressData;
    }

    /// @dev Returns a storage pointer for DN404Storage.
    function _getDN404Storage() internal pure virtual returns (DN404Storage storage $) {
        /// @solidity memory-safe-assembly
        assembly {
            // `uint72(bytes9(keccak256("DN404_STORAGE")))`.
            $.slot := 0xa20d6e21d0e5255308 // Truncate to 9 bytes to reduce bytecode size.
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                         INITIALIZER                        */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Initializes the DN404 contract with an
    /// `initialTokenSupply`, `initialTokenOwner` and `mirror` NFT contract address.
    function _initializeDN404(
        uint256 initialTokenSupply,
        address initialSupplyOwner,
        address mirror
    ) internal virtual {
        DN404Storage storage $ = _getDN404Storage();

        if ($.nextTokenId != 0) revert DNAlreadyInitialized();

        if (mirror == address(0)) revert MirrorAddressIsZero();

        /// @solidity memory-safe-assembly
        assembly {
            // Make the call to link the mirror contract.
            mstore(0x00, 0x0f4599e5) // `linkMirrorContract(address)`.
            mstore(0x20, caller())
            if iszero(and(eq(mload(0x00), 1), call(gas(), mirror, 0, 0x1c, 0x24, 0x00, 0x20))) {
                mstore(0x00, 0xd125259c) // `LinkMirrorContractFailed()`.
                revert(0x1c, 0x04)
            }
        }

        $.nextTokenId = 1;
        $.mirrorERC721 = mirror;

        if (_unit() == 0) revert UnitIsZero();

        if (initialTokenSupply != 0) {
            if (initialSupplyOwner == address(0)) revert TransferToZeroAddress();
            if (_totalSupplyOverflows(initialTokenSupply)) revert TotalSupplyOverflow();

            $.totalSupply = uint96(initialTokenSupply);
            AddressData storage initialOwnerAddressData = _addressData(initialSupplyOwner);
            initialOwnerAddressData.balance = uint96(initialTokenSupply);

            /// @solidity memory-safe-assembly
            assembly {
                // Emit the {Transfer} event.
                mstore(0x00, initialTokenSupply)
                log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, initialSupplyOwner)))
            }

            _setSkipNFT(initialSupplyOwner, true);
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*               BASE UNIT FUNCTION TO OVERRIDE               */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Amount of token balance that is equal to one NFT.
    function _unit() internal view virtual returns (uint256) {
        return 10 ** 18;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*               METADATA FUNCTIONS TO OVERRIDE               */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the name of the token.
    function name() public view virtual returns (string memory);

    /// @dev Returns the symbol of the token.
    function symbol() public view virtual returns (string memory);

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id`.
    function tokenURI(uint256 id) public view virtual returns (string memory);

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                      ERC20 OPERATIONS                      */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the decimals places of the token. Always 18.
    function decimals() public pure returns (uint8) {
        return 18;
    }

    /// @dev Returns the amount of tokens in existence.
    function totalSupply() public view virtual returns (uint256) {
        return uint256(_getDN404Storage().totalSupply);
    }

    /// @dev Returns the amount of tokens owned by `owner`.
    function balanceOf(address owner) public view virtual returns (uint256) {
        return _getDN404Storage().addressData[owner].balance;
    }

    /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`.
    function allowance(address owner, address spender) public view returns (uint256) {
        if (_givePermit2DefaultInfiniteAllowance() && spender == _PERMIT2) {
            uint8 flags = _getDN404Storage().addressData[owner].flags;
            if (flags & _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG == 0) return type(uint256).max;
        }
        return _ref(_getDN404Storage().allowance, owner, spender).value;
    }

    /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
    ///
    /// Emits a {Approval} event.
    function approve(address spender, uint256 amount) public virtual returns (bool) {
        _approve(msg.sender, spender, amount);
        return true;
    }

    /// @dev Transfer `amount` tokens from the caller to `to`.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Requirements:
    /// - `from` must at least have `amount`.
    ///
    /// Emits a {Transfer} event.
    function transfer(address to, uint256 amount) public virtual returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    /// @dev Transfers `amount` tokens from `from` to `to`.
    ///
    /// Note: Does not update the allowance if it is the maximum uint256 value.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Requirements:
    /// - `from` must at least have `amount`.
    /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`.
    ///
    /// Emits a {Transfer} event.
    function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {
        Uint256Ref storage a = _ref(_getDN404Storage().allowance, from, msg.sender);

        uint256 allowed = _givePermit2DefaultInfiniteAllowance() && msg.sender == _PERMIT2
            && (_getDN404Storage().addressData[from].flags & _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG) == 0
            ? type(uint256).max
            : a.value;

        if (allowed != type(uint256).max) {
            if (amount > allowed) revert InsufficientAllowance();
            unchecked {
                a.value = allowed - amount;
            }
        }
        _transfer(from, to, amount);
        return true;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                          PERMIT2                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Whether Permit2 has infinite allowances by default for all owners.
    /// For signature-based allowance granting for single transaction ERC20 `transferFrom`.
    /// To enable, override this function to return true.
    function _givePermit2DefaultInfiniteAllowance() internal view virtual returns (bool) {
        return false;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                  INTERNAL MINT FUNCTIONS                   */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Mints `amount` tokens to `to`, increasing the total supply.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Emits a {Transfer} event.
    function _mint(address to, uint256 amount) internal virtual {
        if (to == address(0)) revert TransferToZeroAddress();

        AddressData storage toAddressData = _addressData(to);
        DN404Storage storage $ = _getDN404Storage();

        _DNMintTemps memory t;
        unchecked {
            uint256 toBalance = uint256(toAddressData.balance) + amount;
            toAddressData.balance = uint96(toBalance);
            t.toEnd = toBalance / _unit();
        }
        uint256 maxId;
        unchecked {
            uint256 totalSupply_ = uint256($.totalSupply) + amount;
            $.totalSupply = uint96(totalSupply_);
            uint256 overflows = _toUint(_totalSupplyOverflows(totalSupply_));
            if (overflows | _toUint(totalSupply_ < amount) != 0) revert TotalSupplyOverflow();
            maxId = totalSupply_ / _unit();
        }
        unchecked {
            if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) {
                Uint32Map storage toOwned = $.owned[to];
                Uint32Map storage oo = $.oo;
                uint256 toIndex = toAddressData.ownedLength;
                _DNPackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(t.toEnd, toIndex));

                if (packedLogs.logs.length != 0) {
                    _packedLogsSet(packedLogs, to, 0);
                    $.totalNFTSupply += uint32(packedLogs.logs.length);
                    toAddressData.ownedLength = uint32(t.toEnd);
                    t.toAlias = _registerAndResolveAlias(toAddressData, to);
                    uint32 burnedPoolHead = $.burnedPoolHead;
                    uint32 burnedPoolTail = $.burnedPoolTail;
                    uint256 nextTokenId = $.nextTokenId;
                    // Mint loop.
                    do {
                        uint256 id;
                        if (burnedPoolHead != burnedPoolTail) {
                            id = _get($.burnedPool, burnedPoolHead++);
                        } else {
                            id = nextTokenId;
                            while (_get(oo, _ownershipIndex(id)) != 0) {
                                id = _useExistsLookup()
                                    ? _wrapNFTId(_findFirstUnset($.exists, id + 1, maxId + 1), maxId)
                                    : _wrapNFTId(id + 1, maxId);
                            }
                            nextTokenId = _wrapNFTId(id + 1, maxId);
                        }
                        if (_useExistsLookup()) _set($.exists, id, true);
                        _set(toOwned, toIndex, uint32(id));
                        _setOwnerAliasAndOwnedIndex(oo, id, t.toAlias, uint32(toIndex++));
                        _packedLogsAppend(packedLogs, id);
                    } while (toIndex != t.toEnd);

                    $.nextTokenId = uint32(nextTokenId);
                    $.burnedPoolHead = burnedPoolHead;
                    _packedLogsSend(packedLogs, $.mirrorERC721);
                }
            }
        }
        /// @solidity memory-safe-assembly
        assembly {
            // Emit the {Transfer} event.
            mstore(0x00, amount)
            log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, to)))
        }
    }

    /// @dev Mints `amount` tokens to `to`, increasing the total supply.
    /// This variant mints NFT tokens starting from ID `preTotalSupply / _unit() + 1`.
    /// It will skip the burned pool.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Emits a {Transfer} event.
    function _mintNext(address to, uint256 amount) internal virtual {
        if (to == address(0)) revert TransferToZeroAddress();

        AddressData storage toAddressData = _addressData(to);
        DN404Storage storage $ = _getDN404Storage();

        _DNMintTemps memory t;
        unchecked {
            uint256 toBalance = uint256(toAddressData.balance) + amount;
            toAddressData.balance = uint96(toBalance);
            t.toEnd = toBalance / _unit();
        }
        uint256 startId;
        uint256 maxId;
        unchecked {
            uint256 preTotalSupply = uint256($.totalSupply);
            startId = preTotalSupply / _unit() + 1;
            uint256 totalSupply_ = uint256(preTotalSupply) + amount;
            $.totalSupply = uint96(totalSupply_);
            uint256 overflows = _toUint(_totalSupplyOverflows(totalSupply_));
            if (overflows | _toUint(totalSupply_ < amount) != 0) revert TotalSupplyOverflow();
            maxId = totalSupply_ / _unit();
        }
        unchecked {
            if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) {
                Uint32Map storage toOwned = $.owned[to];
                Uint32Map storage oo = $.oo;
                uint256 toIndex = toAddressData.ownedLength;
                _DNPackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(t.toEnd, toIndex));

                if (packedLogs.logs.length != 0) {
                    _packedLogsSet(packedLogs, to, 0);
                    $.totalNFTSupply += uint32(packedLogs.logs.length);
                    toAddressData.ownedLength = uint32(t.toEnd);
                    t.toAlias = _registerAndResolveAlias(toAddressData, to);
                    // Mint loop.
                    do {
                        uint256 id = startId;
                        while (_get(oo, _ownershipIndex(id)) != 0) {
                            id = _useExistsLookup()
                                ? _wrapNFTId(_findFirstUnset($.exists, id + 1, maxId + 1), maxId)
                                : _wrapNFTId(id + 1, maxId);
                        }
                        startId = _wrapNFTId(id + 1, maxId);
                        if (_useExistsLookup()) _set($.exists, id, true);
                        _set(toOwned, toIndex, uint32(id));
                        _setOwnerAliasAndOwnedIndex(oo, id, t.toAlias, uint32(toIndex++));
                        _packedLogsAppend(packedLogs, id);
                    } while (toIndex != t.toEnd);

                    _packedLogsSend(packedLogs, $.mirrorERC721);
                }
            }
        }
        /// @solidity memory-safe-assembly
        assembly {
            // Emit the {Transfer} event.
            mstore(0x00, amount)
            log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, to)))
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                  INTERNAL BURN FUNCTIONS                   */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Burns `amount` tokens from `from`, reducing the total supply.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Emits a {Transfer} event.
    function _burn(address from, uint256 amount) internal virtual {
        AddressData storage fromAddressData = _addressData(from);
        DN404Storage storage $ = _getDN404Storage();

        uint256 fromBalance = fromAddressData.balance;
        if (amount > fromBalance) revert InsufficientBalance();

        unchecked {
            fromAddressData.balance = uint96(fromBalance -= amount);
            uint256 totalSupply_ = uint256($.totalSupply) - amount;
            $.totalSupply = uint96(totalSupply_);

            Uint32Map storage fromOwned = $.owned[from];
            uint256 fromIndex = fromAddressData.ownedLength;
            uint256 numNFTBurns = _zeroFloorSub(fromIndex, fromBalance / _unit());

            if (numNFTBurns != 0) {
                _DNPackedLogs memory packedLogs = _packedLogsMalloc(numNFTBurns);
                _packedLogsSet(packedLogs, from, 1);
                uint256 totalNFTSupply = uint256($.totalNFTSupply) - numNFTBurns;
                $.totalNFTSupply = uint32(totalNFTSupply);
                bool addToBurnedPool = _addToBurnedPool(totalNFTSupply, totalSupply_);

                Uint32Map storage oo = $.oo;
                uint256 fromEnd = fromIndex - numNFTBurns;
                fromAddressData.ownedLength = uint32(fromEnd);
                uint32 burnedPoolTail = $.burnedPoolTail;
                // Burn loop.
                do {
                    uint256 id = _get(fromOwned, --fromIndex);
                    _setOwnerAliasAndOwnedIndex(oo, id, 0, 0);
                    _packedLogsAppend(packedLogs, id);
                    if (_useExistsLookup()) _set($.exists, id, false);
                    if (addToBurnedPool) _set($.burnedPool, burnedPoolTail++, uint32(id));
                    if (_get($.mayHaveNFTApproval, id)) {
                        _set($.mayHaveNFTApproval, id, false);
                        delete $.nftApprovals[id];
                    }
                } while (fromIndex != fromEnd);

                if (addToBurnedPool) $.burnedPoolTail = burnedPoolTail;
                _packedLogsSend(packedLogs, $.mirrorERC721);
            }
        }
        /// @solidity memory-safe-assembly
        assembly {
            // Emit the {Transfer} event.
            mstore(0x00, amount)
            log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0)
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                INTERNAL TRANSFER FUNCTIONS                 */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Moves `amount` of tokens from `from` to `to`.
    ///
    /// Will burn sender NFTs if balance after transfer is less than
    /// the amount required to support the current NFT balance.
    ///
    /// Will mint NFTs to `to` if the recipient's new balance supports
    /// additional NFTs ***AND*** the `to` address's skipNFT flag is
    /// set to false.
    ///
    /// Emits a {Transfer} event.
    function _transfer(address from, address to, uint256 amount) internal virtual {
        if (to == address(0)) revert TransferToZeroAddress();

        AddressData storage fromAddressData = _addressData(from);
        AddressData storage toAddressData = _addressData(to);
        DN404Storage storage $ = _getDN404Storage();

        _DNTransferTemps memory t;
        t.fromOwnedLength = fromAddressData.ownedLength;
        t.toOwnedLength = toAddressData.ownedLength;
        t.totalSupply = $.totalSupply;

        if (amount > (t.fromBalance = fromAddressData.balance)) revert InsufficientBalance();

        unchecked {
            fromAddressData.balance = uint96(t.fromBalance -= amount);
            toAddressData.balance = uint96(t.toBalance = uint256(toAddressData.balance) + amount);

            t.numNFTBurns = _zeroFloorSub(t.fromOwnedLength, t.fromBalance / _unit());

            if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) {
                if (from == to) t.toOwnedLength = t.fromOwnedLength - t.numNFTBurns;
                t.numNFTMints = _zeroFloorSub(t.toBalance / _unit(), t.toOwnedLength);
            }

            t.totalNFTSupply = uint256($.totalNFTSupply) + t.numNFTMints - t.numNFTBurns;
            $.totalNFTSupply = uint32(t.totalNFTSupply);

            Uint32Map storage oo = $.oo;

            if (_toUint(_useDirectTransfersIfPossible()) & _toUint(from != to) != 0) {
                uint256 n = _min(t.fromOwnedLength, _min(t.numNFTBurns, t.numNFTMints));
                if (n != 0) {
                    _DNDirectLogs memory directLogs = _directLogsMalloc(n, from, to);
                    t.numNFTBurns -= n;
                    t.numNFTMints -= n;
                    Uint32Map storage fromOwned = $.owned[from];
                    Uint32Map storage toOwned = $.owned[to];
                    t.toAlias = _registerAndResolveAlias(toAddressData, to);
                    // Direct transfer loop.
                    do {
                        uint256 id = _get(fromOwned, --t.fromOwnedLength);
                        _set(toOwned, t.toOwnedLength, uint32(id));
                        _setOwnerAliasAndOwnedIndex(oo, id, t.toAlias, uint32(t.toOwnedLength++));
                        _directLogsAppend(directLogs, id);
                        if (_get($.mayHaveNFTApproval, id)) {
                            _set($.mayHaveNFTApproval, id, false);
                            delete $.nftApprovals[id];
                        }
                    } while (--n != 0);

                    _directLogsSend(directLogs, $.mirrorERC721);
                    fromAddressData.ownedLength = uint32(t.fromOwnedLength);
                    toAddressData.ownedLength = uint32(t.toOwnedLength);
                }
            }

            _DNPackedLogs memory packedLogs = _packedLogsMalloc(t.numNFTBurns + t.numNFTMints);

            t.burnedPoolTail = $.burnedPoolTail;
            if (t.numNFTBurns != 0) {
                _packedLogsSet(packedLogs, from, 1);
                bool addToBurnedPool = _addToBurnedPool(t.totalNFTSupply, t.totalSupply);
                Uint32Map storage fromOwned = $.owned[from];
                uint256 fromIndex = t.fromOwnedLength;
                fromAddressData.ownedLength = uint32(t.fromEnd = fromIndex - t.numNFTBurns);
                uint32 burnedPoolTail = t.burnedPoolTail;
                // Burn loop.
                do {
                    uint256 id = _get(fromOwned, --fromIndex);
                    _setOwnerAliasAndOwnedIndex(oo, id, 0, 0);
                    _packedLogsAppend(packedLogs, id);
                    if (_useExistsLookup()) _set($.exists, id, false);
                    if (addToBurnedPool) _set($.burnedPool, burnedPoolTail++, uint32(id));
                    if (_get($.mayHaveNFTApproval, id)) {
                        _set($.mayHaveNFTApproval, id, false);
                        delete $.nftApprovals[id];
                    }
                } while (fromIndex != t.fromEnd);

                if (addToBurnedPool) $.burnedPoolTail = (t.burnedPoolTail = burnedPoolTail);
            }

            if (t.numNFTMints != 0) {
                _packedLogsSet(packedLogs, to, 0);
                t.nextTokenId = $.nextTokenId;
                Uint32Map storage toOwned = $.owned[to];
                t.toAlias = _registerAndResolveAlias(toAddressData, to);
                uint256 maxId = t.totalSupply / _unit();
                uint256 toIndex = t.toOwnedLength;
                toAddressData.ownedLength = uint32(t.toEnd = toIndex + t.numNFTMints);
                uint32 burnedPoolHead = $.burnedPoolHead;
                // Mint loop.
                do {
                    uint256 id;
                    if (burnedPoolHead != t.burnedPoolTail) {
                        id = _get($.burnedPool, burnedPoolHead++);
                    } else {
                        id = t.nextTokenId;
                        while (_get(oo, _ownershipIndex(id)) != 0) {
                            id = _useExistsLookup()
                                ? _wrapNFTId(_findFirstUnset($.exists, id + 1, maxId + 1), maxId)
                                : _wrapNFTId(id + 1, maxId);
                        }
                        t.nextTokenId = _wrapNFTId(id + 1, maxId);
                    }
                    if (_useExistsLookup()) _set($.exists, id, true);
                    _set(toOwned, toIndex, uint32(id));
                    _setOwnerAliasAndOwnedIndex(oo, id, t.toAlias, uint32(toIndex++));
                    _packedLogsAppend(packedLogs, id);
                } while (toIndex != t.toEnd);

                $.burnedPoolHead = burnedPoolHead;
                $.nextTokenId = uint32(t.nextTokenId);
            }

            if (packedLogs.logs.length != 0) {
                _packedLogsSend(packedLogs, $.mirrorERC721);
            }
        }
        /// @solidity memory-safe-assembly
        assembly {
            // Emit the {Transfer} event.
            mstore(0x00, amount)
            // forgefmt: disable-next-item
            log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), shr(96, shl(96, to)))
        }
    }

    /// @dev Returns if direct NFT transfers should be used during ERC20 transfers
    /// whenever possible, instead of burning and re-minting.
    function _useDirectTransfersIfPossible() internal view virtual returns (bool) {
        return true;
    }

    /// @dev Returns if burns should be added to the burn pool.
    /// This returns false by default, which means the NFT IDs are re-minted in a cycle.
    function _addToBurnedPool(uint256 totalNFTSupplyAfterBurn, uint256 totalSupplyAfterBurn)
        internal
        view
        virtual
        returns (bool)
    {
        totalNFTSupplyAfterBurn = totalNFTSupplyAfterBurn; // Silence compiler warning.
        totalSupplyAfterBurn = totalSupplyAfterBurn; // Silence compiler warning.
        return false;
    }

    /// @dev Returns whether to use the exists lookup for more efficient
    /// scanning of an empty token ID slot. Highly recommended for collections
    /// with near full load factor `totalNFTSupply * _unit() / totalSupply`.
    /// The trade off is slightly higher initial storage write costs,
    /// which will be quickly amortized away.
    function _useExistsLookup() internal pure virtual returns (bool) {
        return true;
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Call must originate from the mirror contract.
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    ///   `msgSender` must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function _transferFromNFT(address from, address to, uint256 id, address msgSender)
        internal
        virtual
    {
        DN404Storage storage $ = _getDN404Storage();

        if (to == address(0)) revert TransferToZeroAddress();

        Uint32Map storage oo = $.oo;

        if (from != $.aliasToAddress[_get(oo, _ownershipIndex(_restrictNFTId(id)))]) {
            revert TransferFromIncorrectOwner();
        }

        if (msgSender != from) {
            if (_ref($.operatorApprovals, from, msgSender).value == 0) {
                if (msgSender != $.nftApprovals[id]) {
                    revert TransferCallerNotOwnerNorApproved();
                }
            }
        }

        AddressData storage fromAddressData = _addressData(from);
        AddressData storage toAddressData = _addressData(to);

        uint256 unit = _unit();

        unchecked {
            {
                uint256 fromBalance = fromAddressData.balance;
                if (unit > fromBalance) revert InsufficientBalance();
                fromAddressData.balance = uint96(fromBalance - unit);
                toAddressData.balance += uint96(unit);
            }
            mapping(address => Uint32Map) storage owned = $.owned;
            Uint32Map storage fromOwned = owned[from];

            if (_get($.mayHaveNFTApproval, id)) {
                _set($.mayHaveNFTApproval, id, false);
                delete $.nftApprovals[id];
            }

            {
                uint32 updatedId = _get(fromOwned, --fromAddressData.ownedLength);
                uint32 i = _get(oo, _ownedIndex(id));
                _set(fromOwned, i, updatedId);
                _set(oo, _ownedIndex(updatedId), i);
            }
            uint32 n = toAddressData.ownedLength++;
            _set(owned[to], n, uint32(id));
            _setOwnerAliasAndOwnedIndex(oo, id, _registerAndResolveAlias(toAddressData, to), n);
        }

        /// @solidity memory-safe-assembly
        assembly {
            // Emit the {Transfer} event.
            mstore(0x00, unit)
            // forgefmt: disable-next-item
            log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), shr(96, shl(96, to)))
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                 INTERNAL APPROVE FUNCTIONS                 */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`.
    ///
    /// Emits a {Approval} event.
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        if (_givePermit2DefaultInfiniteAllowance() && spender == _PERMIT2) {
            _getDN404Storage().addressData[owner].flags |= _ADDRESS_DATA_OVERRIDE_PERMIT2_FLAG;
        }
        _ref(_getDN404Storage().allowance, owner, spender).value = amount;
        /// @solidity memory-safe-assembly
        assembly {
            // Emit the {Approval} event.
            mstore(0x00, amount)
            // forgefmt: disable-next-item
            log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, shl(96, owner)), shr(96, shl(96, spender)))
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                 DATA HITCHHIKING FUNCTIONS                 */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the auxiliary data for `owner`.
    /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data.
    /// Auxiliary data can be set for any address, even if it does not have any tokens.
    function _getAux(address owner) internal view virtual returns (uint88) {
        return _getDN404Storage().addressData[owner].aux;
    }

    /// @dev Set the auxiliary data for `owner` to `value`.
    /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data.
    /// Auxiliary data can be set for any address, even if it does not have any tokens.
    function _setAux(address owner, uint88 value) internal virtual {
        _getDN404Storage().addressData[owner].aux = value;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     SKIP NFT FUNCTIONS                     */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns true if minting and transferring ERC20s to `owner` will skip minting NFTs.
    /// Returns false otherwise.
    function getSkipNFT(address owner) public view virtual returns (bool) {
        AddressData storage d = _getDN404Storage().addressData[owner];
        if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) return _hasCode(owner);
        return d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0;
    }

    /// @dev Sets the caller's skipNFT flag to `skipNFT`. Returns true.
    ///
    /// Emits a {SkipNFTSet} event.
    function setSkipNFT(bool skipNFT) public virtual returns (bool) {
        _setSkipNFT(msg.sender, skipNFT);
        return true;
    }

    /// @dev Internal function to set account `owner` skipNFT flag to `state`
    ///
    /// Initializes account `owner` AddressData if it is not currently initialized.
    ///
    /// Emits a {SkipNFTSet} event.
    function _setSkipNFT(address owner, bool state) internal virtual {
        AddressData storage d = _addressData(owner);
        if ((d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0) != state) {
            d.flags ^= _ADDRESS_DATA_SKIP_NFT_FLAG;
        }
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, iszero(iszero(state)))
            log2(0x00, 0x20, _SKIP_NFT_SET_EVENT_SIGNATURE, shr(96, shl(96, owner)))
        }
    }

    /// @dev Returns a storage data pointer for account `owner` AddressData
    ///
    /// Initializes account `owner` AddressData if it is not currently initialized.
    function _addressData(address owner) internal virtual returns (AddressData storage d) {
        d = _getDN404Storage().addressData[owner];
        unchecked {
            if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) {
                uint256 skipNFT = (_toUint(_hasCode(owner)) * _ADDRESS_DATA_SKIP_NFT_FLAG);
                d.flags = uint8(skipNFT | _ADDRESS_DATA_INITIALIZED_FLAG);
            }
        }
    }

    /// @dev Returns the `addressAlias` of account `to`.
    ///
    /// Assigns and registers the next alias if `to` alias was not previously registered.
    function _registerAndResolveAlias(AddressData storage toAddressData, address to)
        internal
        virtual
        returns (uint32 addressAlias)
    {
        DN404Storage storage $ = _getDN404Storage();
        addressAlias = toAddressData.addressAlias;
        if (addressAlias == 0) {
            unchecked {
                addressAlias = ++$.numAliases;
            }
            toAddressData.addressAlias = addressAlias;
            $.aliasToAddress[addressAlias] = to;
            if (addressAlias == 0) revert(); // Overflow.
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     MIRROR OPERATIONS                      */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the address of the mirror NFT contract.
    function mirrorERC721() public view virtual returns (address) {
        return _getDN404Storage().mirrorERC721;
    }

    /// @dev Returns the total NFT supply.
    function _totalNFTSupply() internal view virtual returns (uint256) {
        return _getDN404Storage().totalNFTSupply;
    }

    /// @dev Returns `owner` NFT balance.
    function _balanceOfNFT(address owner) internal view virtual returns (uint256) {
        return _getDN404Storage().addressData[owner].ownedLength;
    }

    /// @dev Returns the owner of token `id`.
    /// Returns the zero address instead of reverting if the token does not exist.
    function _ownerAt(uint256 id) internal view virtual returns (address) {
        DN404Storage storage $ = _getDN404Storage();
        return $.aliasToAddress[_get($.oo, _ownershipIndex(_restrictNFTId(id)))];
    }

    /// @dev Returns the owner of token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function _ownerOf(uint256 id) internal view virtual returns (address) {
        if (!_exists(id)) revert TokenDoesNotExist();
        return _ownerAt(id);
    }

    /// @dev Returns if token `id` exists.
    function _exists(uint256 id) internal view virtual returns (bool) {
        return _ownerAt(id) != address(0);
    }

    /// @dev Returns the account approved to manage token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function _getApproved(uint256 id) internal view virtual returns (address) {
        if (!_exists(id)) revert TokenDoesNotExist();
        return _getDN404Storage().nftApprovals[id];
    }

    /// @dev Sets `spender` as the approved account to manage token `id`, using `msgSender`.
    ///
    /// Requirements:
    /// - `msgSender` must be the owner or an approved operator for the token owner.
    function _approveNFT(address spender, uint256 id, address msgSender)
        internal
        virtual
        returns (address owner)
    {
        DN404Storage storage $ = _getDN404Storage();

        owner = $.aliasToAddress[_get($.oo, _ownershipIndex(_restrictNFTId(id)))];

        if (msgSender != owner) {
            if (_ref($.operatorApprovals, owner, msgSender).value == 0) {
                revert ApprovalCallerNotOwnerNorApproved();
            }
        }

        $.nftApprovals[id] = spender;
        _set($.mayHaveNFTApproval, id, spender != address(0));
    }

    /// @dev Approve or remove the `operator` as an operator for `msgSender`,
    /// without authorization checks.
    function _setApprovalForAll(address operator, bool approved, address msgSender)
        internal
        virtual
    {
        _ref(_getDN404Storage().operatorApprovals, msgSender, operator).value = _toUint(approved);
    }

    /// @dev Returns the NFT IDs of `owner` in range `[begin, end)`.
    /// Optimized for smaller bytecode size, as this function is intended for off-chain calling.
    function _ownedIds(address owner, uint256 begin, uint256 end)
        internal
        view
        virtual
        returns (uint256[] memory ids)
    {
        DN404Storage storage $ = _getDN404Storage();
        Uint32Map storage owned = $.owned[owner];
        uint256 n = $.addressData[owner].ownedLength;
        /// @solidity memory-safe-assembly
        assembly {
            n := xor(n, mul(lt(end, n), xor(end, n))) // `min(n, end)`.
            ids := mload(0x40)
            let i := begin
            for {} lt(i, n) { i := add(i, 1) } {
                let s := add(shl(96, owned.slot), shr(3, i)) // Storage slot.
                let id := and(0xffffffff, shr(shl(5, and(i, 7)), sload(s)))
                mstore(add(add(ids, 0x20), shl(5, sub(i, begin))), id) // Append to.
            }
            mstore(ids, sub(i, begin)) // Store the length.
            mstore(0x40, add(add(ids, 0x20), shl(5, sub(i, begin)))) // Allocate memory.
        }
    }

    /// @dev Fallback modifier to dispatch calls from the mirror NFT contract
    /// to internal functions in this contract.
    modifier dn404Fallback() virtual {
        DN404Storage storage $ = _getDN404Storage();

        uint256 fnSelector = _calldataload(0x00) >> 224;

        // `transferFromNFT(address,address,uint256,address)`.
        if (fnSelector == 0xe5eb36c8) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x84) revert();

            address from = address(uint160(_calldataload(0x04)));
            address to = address(uint160(_calldataload(0x24)));
            uint256 id = _calldataload(0x44);
            address msgSender = address(uint160(_calldataload(0x64)));

            _transferFromNFT(from, to, id, msgSender);
            _return(1);
        }
        // `setApprovalForAll(address,bool,address)`.
        if (fnSelector == 0x813500fc) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x64) revert();

            address spender = address(uint160(_calldataload(0x04)));
            bool status = _calldataload(0x24) != 0;
            address msgSender = address(uint160(_calldataload(0x44)));

            _setApprovalForAll(spender, status, msgSender);
            _return(1);
        }
        // `isApprovedForAll(address,address)`.
        if (fnSelector == 0xe985e9c5) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x44) revert();

            address owner = address(uint160(_calldataload(0x04)));
            address operator = address(uint160(_calldataload(0x24)));

            _return(_ref($.operatorApprovals, owner, operator).value);
        }
        // `ownerOf(uint256)`.
        if (fnSelector == 0x6352211e) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x24) revert();

            uint256 id = _calldataload(0x04);

            _return(uint160(_ownerOf(id)));
        }
        // `ownerAt(uint256)`.
        if (fnSelector == 0x24359879) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x24) revert();

            uint256 id = _calldataload(0x04);

            _return(uint160(_ownerAt(id)));
        }
        // `approveNFT(address,uint256,address)`.
        if (fnSelector == 0xd10b6e0c) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x64) revert();

            address spender = address(uint160(_calldataload(0x04)));
            uint256 id = _calldataload(0x24);
            address msgSender = address(uint160(_calldataload(0x44)));

            _return(uint160(_approveNFT(spender, id, msgSender)));
        }
        // `getApproved(uint256)`.
        if (fnSelector == 0x081812fc) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x24) revert();

            uint256 id = _calldataload(0x04);

            _return(uint160(_getApproved(id)));
        }
        // `balanceOfNFT(address)`.
        if (fnSelector == 0xf5b100ea) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x24) revert();

            address owner = address(uint160(_calldataload(0x04)));

            _return(_balanceOfNFT(owner));
        }
        // `totalNFTSupply()`.
        if (fnSelector == 0xe2c79281) {
            if (msg.sender != $.mirrorERC721) revert SenderNotMirror();
            if (msg.data.length < 0x04) revert();

            _return(_totalNFTSupply());
        }
        // `implementsDN404()`.
        if (fnSelector == 0xb7a94eb8) {
            _return(1);
        }
        _;
    }

    /// @dev Fallback function for calls from mirror NFT contract.
    /// Override this if you need to implement your custom
    /// fallback with utilities like Solady's `LibZip.cdFallback()`.
    /// And always remember to always wrap the fallback with `dn404Fallback`.
    fallback() external payable virtual dn404Fallback {
        revert FnSelectorNotRecognized(); // Not mandatory. Just for quality of life.
    }

    /// @dev This is to silence the compiler warning.
    /// Override and remove the revert if you want your contract to receive ETH via receive.
    receive() external payable virtual {
        if (msg.value != 0) revert();
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                 INTERNAL / PRIVATE HELPERS                 */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns `(i - 1) << 1`.
    function _ownershipIndex(uint256 i) internal pure returns (uint256) {
        unchecked {
            return (i - 1) << 1; // Minus 1 as token IDs start from 1.
        }
    }

    /// @dev Returns `((i - 1) << 1) + 1`.
    function _ownedIndex(uint256 i) internal pure returns (uint256) {
        unchecked {
            return ((i - 1) << 1) + 1; // Minus 1 as token IDs start from 1.
        }
    }

    /// @dev Returns the uint32 value at `index` in `map`.
    function _get(Uint32Map storage map, uint256 index) internal view returns (uint32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            let s := add(shl(96, map.slot), shr(3, index)) // Storage slot.
            result := and(0xffffffff, shr(shl(5, and(index, 7)), sload(s)))
        }
    }

    /// @dev Updates the uint32 value at `index` in `map`.
    function _set(Uint32Map storage map, uint256 index, uint32 value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let s := add(shl(96, map.slot), shr(3, index)) // Storage slot.
            let o := shl(5, and(index, 7)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffffffff // Value mask.
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value)))))
        }
    }

    /// @dev Sets the owner alias and the owned index together.
    function _setOwnerAliasAndOwnedIndex(
        Uint32Map storage map,
        uint256 id,
        uint32 ownership,
        uint32 ownedIndex
    ) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let i := sub(id, 1) // Index of the uint64 combined value.
            let s := add(shl(96, map.slot), shr(2, i)) // Storage slot.
            let o := shl(6, and(i, 3)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffffffffffffffff // Value mask.
            let combined := or(shl(32, ownedIndex), and(0xffffffff, ownership))
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), combined)))))
        }
    }

    /// @dev Returns the boolean value of the bit at `index` in `bitmap`.
    function _get(Bitmap storage bitmap, uint256 index) internal view returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let s := add(shl(96, bitmap.slot), shr(8, index)) // Storage slot.
            result := and(1, shr(and(0xff, index), sload(s)))
        }
    }

    /// @dev Updates the bit at `index` in `bitmap` to `value`.
    function _set(Bitmap storage bitmap, uint256 index, bool value) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let s := add(shl(96, bitmap.slot), shr(8, index)) // Storage slot.
            let o := and(0xff, index) // Storage slot offset (bits).
            sstore(s, or(and(sload(s), not(shl(o, 1))), shl(o, iszero(iszero(value)))))
        }
    }

    /// @dev Returns the index of the least significant unset bit in `[begin, end)`.
    /// If no unset bit is found, returns `type(uint256).max`.
    function _findFirstUnset(Bitmap storage bitmap, uint256 begin, uint256 end)
        internal
        view
        returns (uint256 unsetBitIndex)
    {
        /// @solidity memory-safe-assembly
        assembly {
            unsetBitIndex := not(0) // Initialize to `type(uint256).max`.
            let s := shl(96, bitmap.slot) // Storage offset of the bitmap.
            let bucket := add(s, shr(8, begin))
            let negBits := shl(and(0xff, begin), shr(and(0xff, begin), not(sload(bucket))))
            if iszero(negBits) {
                let lastBucket := add(s, shr(8, end))
                for {} 1 {} {
                    bucket := add(bucket, 1)
                    negBits := not(sload(bucket))
                    if or(negBits, gt(bucket, lastBucket)) { break }
                }
                if gt(bucket, lastBucket) {
                    negBits := shr(and(0xff, not(end)), shl(and(0xff, not(end)), negBits))
                }
            }
            if negBits {
                // Find-first-set routine.
                let b := and(negBits, add(not(negBits), 1)) // Isolate the least significant bit.
                let r := shl(7, lt(0xffffffffffffffffffffffffffffffff, b))
                r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, b))))
                r := or(r, shl(5, lt(0xffffffff, shr(r, b))))
                // For the remaining 32 bits, use a De Bruijn lookup.
                // forgefmt: disable-next-item
                r := or(r, byte(and(div(0xd76453e0, shr(r, b)), 0x1f),
                    0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405))
                r := or(shl(8, sub(bucket, s)), r)
                unsetBitIndex := or(r, sub(0, or(iszero(lt(r, end)), lt(r, begin))))
            }
        }
    }

    /// @dev Returns a storage reference to the value at (`a0`, `a1`) in `map`.
    function _ref(AddressPairToUint256RefMap storage map, address a0, address a1)
        internal
        pure
        returns (Uint256Ref storage ref)
    {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x28, a1)
            mstore(0x14, a0)
            mstore(0x00, map.slot)
            ref.slot := keccak256(0x00, 0x48)
            // Clear the part of the free memory pointer that was overwritten.
            mstore(0x28, 0x00)
        }
    }

    /// @dev Wraps the NFT ID.
    function _wrapNFTId(uint256 id, uint256 maxId) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := or(mul(iszero(gt(id, maxId)), id), gt(id, maxId))
        }
    }

    /// @dev Returns `id > type(uint32).max ? 0 : id`.
    function _restrictNFTId(uint256 id) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := mul(id, lt(id, 0x100000000))
        }
    }

    /// @dev Returns whether `amount` is a valid `totalSupply`.
    function _totalSupplyOverflows(uint256 amount) internal view returns (bool) {
        unchecked {
            return _toUint(amount > type(uint96).max)
                | _toUint(amount / _unit() > type(uint32).max - 1) != 0;
        }
    }

    /// @dev Returns `max(0, x - y)`.
    function _zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := mul(gt(x, y), sub(x, y))
        }
    }

    /// @dev Returns `x < y ? x : y`.
    function _min(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            z := xor(x, mul(xor(x, y), lt(y, x)))
        }
    }

    /// @dev Returns `b ? 1 : 0`.
    function _toUint(bool b) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := iszero(iszero(b))
        }
    }

    /// @dev Struct containing direct transfer log data for {Transfer} events to be
    /// emitted by the mirror NFT contract.
    struct _DNDirectLogs {
        uint256 offset;
        address from;
        address to;
        uint256[] logs;
    }

    /// @dev Initiates memory allocation for direct logs with `n` log items.
    function _directLogsMalloc(uint256 n, address from, address to)
        private
        pure
        returns (_DNDirectLogs memory p)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Note that `p` implicitly allocates and advances the free memory pointer by
            // 4 words, which we can safely mutate in `_packedLogsSend`.
            let logs := mload(0x40)
            mstore(logs, n) // Store the length.
            let offset := add(0x20, logs) // Skip the word for `p.logs.length`.
            mstore(0x40, add(offset, shl(5, n))) // Allocate memory.
            mstore(add(0x60, p), logs) // Set `p.logs`.
            mstore(add(0x40, p), to) // Set `p.to`.
            mstore(add(0x20, p), from) // Set `p.from`.
            mstore(p, offset) // Set `p.offset`.
        }
    }

    /// @dev Adds a direct log item to `p` with token `id`.
    function _directLogsAppend(_DNDirectLogs memory p, uint256 id) private pure {
        /// @solidity memory-safe-assembly
        assembly {
            let offset := mload(p)
            mstore(offset, id)
            mstore(p, add(offset, 0x20))
        }
    }

    /// @dev Calls the `mirror` NFT contract to emit {Transfer} events for packed logs `p`.
    function _directLogsSend(_DNDirectLogs memory p, address mirror) private {
        /// @solidity memory-safe-assembly
        assembly {
            let logs := mload(add(p, 0x60))
            let n := add(0x84, shl(5, mload(logs))) // Length of calldata to send.
            let o := sub(logs, 0x80) // Start of calldata to send.
            mstore(o, 0x144027d3) // `logDirectTransfer(address,address,uint256[])`.
            mstore(add(o, 0x20), mload(add(0x20, p)))
            mstore(add(o, 0x40), mload(add(0x40, p)))
            mstore(add(o, 0x60), 0x60) // Offset of `logs` in the calldata to send.
            if iszero(and(eq(mload(o), 1), call(gas(), mirror, 0, add(o, 0x1c), n, o, 0x20))) {
                revert(o, 0x00)
            }
        }
    }

    /// @dev Struct containing packed log data for {Transfer} events to be
    /// emitted by the mirror NFT contract.
    struct _DNPackedLogs {
        uint256 offset;
        uint256 addressAndBit;
        uint256[] logs;
    }

    /// @dev Initiates memory allocation for packed logs with `n` log items.
    function _packedLogsMalloc(uint256 n) private pure returns (_DNPackedLogs memory p) {
        /// @solidity memory-safe-assembly
        assembly {
            // Note that `p` implicitly allocates and advances the free memory pointer by
            // 3 words, which we can safely mutate in `_packedLogsSend`.
            let logs := mload(0x40)
            mstore(logs, n) // Store the length.
            let offset := add(0x20, logs) // Skip the word for `p.logs.length`.
            mstore(0x40, add(offset, shl(5, n))) // Allocate memory.
            mstore(add(0x40, p), logs) // Set `p.logs`.
            mstore(p, offset) // Set `p.offset`.
        }
    }

    /// @dev Set the current address and the burn bit.
    function _packedLogsSet(_DNPackedLogs memory p, address a, uint256 burnBit) private pure {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(add(p, 0x20), or(shl(96, a), burnBit)) // Set `p.addressAndBit`.
        }
    }

    /// @dev Adds a packed log item to `p` with token `id`.
    function _packedLogsAppend(_DNPackedLogs memory p, uint256 id) private pure {
        /// @solidity memory-safe-assembly
        assembly {
            let offset := mload(p)
            mstore(offset, or(mload(add(p, 0x20)), shl(8, id))) // `p.addressAndBit | (id << 8)`.
            mstore(p, add(offset, 0x20))
        }
    }

    /// @dev Calls the `mirror` NFT contract to emit {Transfer} events for packed logs `p`.
    function _packedLogsSend(_DNPackedLogs memory p, address mirror) private {
        /// @solidity memory-safe-assembly
        assembly {
            let logs := mload(add(p, 0x40))
            let o := sub(logs, 0x40) // Start of calldata to send.
            mstore(o, 0x263c69d6) // `logTransfer(uint256[])`.
            mstore(add(o, 0x20), 0x20) // Offset of `logs` in the calldata to send.
            let n := add(0x44, shl(5, mload(logs))) // Length of calldata to send.
            if iszero(and(eq(mload(o), 1), call(gas(), mirror, 0, add(o, 0x1c), n, o, 0x20))) {
                revert(o, 0x00)
            }
        }
    }

    /// @dev Struct of temporary variables for transfers.
    struct _DNTransferTemps {
        uint256 numNFTBurns;
        uint256 numNFTMints;
        uint256 fromBalance;
        uint256 toBalance;
        uint256 fromOwnedLength;
        uint256 toOwnedLength;
        uint256 totalSupply;
        uint256 totalNFTSupply;
        uint256 fromEnd;
        uint256 toEnd;
        uint32 toAlias;
        uint256 nextTokenId;
        uint32 burnedPoolTail;
    }

    /// @dev Struct of temporary variables for mints.
    struct _DNMintTemps {
        uint256 toEnd;
        uint32 toAlias;
    }

    /// @dev Returns if `a` has bytecode of non-zero length.
    function _hasCode(address a) private view returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := extcodesize(a) // Can handle dirty upper bits.
        }
    }

    /// @dev Returns the calldata value at `offset`.
    function _calldataload(uint256 offset) private pure returns (uint256 value) {
        /// @solidity memory-safe-assembly
        assembly {
            value := calldataload(offset)
        }
    }

    /// @dev Executes a return opcode to return `x` and end the current call frame.
    function _return(uint256 x) private pure {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, x)
            return(0x00, 0x20)
        }
    }
}

File 4 of 4 : ITokenURI.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

interface ITokenURI {

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id`.
    function tokenURI(uint256 id) external view returns (string memory);

}

Settings
{
  "remappings": [
    "dn404/=lib/dn404/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "solady/=lib/solady/src/",
    "murky/=lib/dn404/lib/murky/",
    "openzeppelin-contracts/=lib/dn404/lib/murky/lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ITokenURI","name":"metadata_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[],"name":"FnSelectorNotRecognized","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[],"name":"MetadataLocked","type":"error"},{"inputs":[],"name":"MirrorAddressIsZero","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"SenderNotMirror","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TotalSupplyOverflow","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnitIsZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SkipNFTSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"mirror","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"metadata","outputs":[{"internalType":"contract ITokenURI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mirrorERC721","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract ITokenURI","name":"metadata_","type":"address"}],"name":"setMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setMetadataLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"skipNFT","type":"bool"}],"name":"setSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","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":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b50604051620024863803806200248683398101604081905262000034916200009d565b600080546001600160a01b0319166001600160a01b0383161790556200005a3262000061565b50620000cf565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b600060208284031215620000b057600080fd5b81516001600160a01b0381168114620000c857600080fd5b9392505050565b6123a780620000df6000396000f3fe60806040526004361061016a5760003560e01c806369d2ceb1116100d1578063c4d66de81161008a578063f04e283e11610064578063f04e283e14610889578063f2fde38b1461089c578063f3cb8385146108af578063fee81cf4146108cf5761017c565b8063c4d66de81461080a578063c87b56dd1461082a578063dd62ed3e1461084a5761017c565b806369d2ceb11461072d57806370a082311461074e578063715018a61461079c5780638da5cb5b146107a457806395d89b41146107bd578063a9059cbb146107ea5761017c565b80632a6a935d116101235780632a6a935d146106765780632c5a8c1d14610696578063313ce567146106ab578063392f37e9146106c75780634ef41efc146106ff57806354d1f13d146107255761017c565b806306fdde0314610583578063095ea7b3146105c757806318160ddd146105f757806323b872dd1461062e578063256929621461064e578063274e430b146106565761017c565b3661017c57341561017a57600080fd5b005b68a20d6e21d0e525530860003560e01c63e5eb36c88190036101fa5760018201546001600160a01b031633146101c55760405163ce5a776b60e01b815260040160405180910390fd5b60843610156101d357600080fd5b6004356024356044356064356101eb84848484610902565b6101f56001610c7a565b505050505b8063813500fc0361027c5760018201546001600160a01b031633146102325760405163ce5a776b60e01b815260040160405180910390fd5b606436101561024057600080fd5b6004356028818152604435601481905268a20d6e21d0e525530b60009081526048812092526024351515918290556102786001610c7a565b5050505b8063e985e9c5036102f25760018201546001600160a01b031633146102b45760405163ce5a776b60e01b815260040160405180910390fd5b60443610156102c257600080fd5b6024356028818152600435601481905260038501600090815260488120925290549091906102ef90610c7a565b50505b80636352211e036103575760018201546001600160a01b0316331461032a5760405163ce5a776b60e01b815260040160405180910390fd5b602436101561033857600080fd5b60043561035561034782610c84565b6001600160a01b0316610c7a565b505b806324359879036103ae5760018201546001600160a01b0316331461038f5760405163ce5a776b60e01b815260040160405180910390fd5b602436101561039d57600080fd5b6004356103ac61034782610cbb565b505b8063d10b6e0c0361040f5760018201546001600160a01b031633146103e65760405163ce5a776b60e01b815260040160405180910390fd5b60643610156103f457600080fd5b60043560243560443561040b610347848484610d17565b5050505b8063081812fc036104665760018201546001600160a01b031633146104475760405163ce5a776b60e01b815260040160405180910390fd5b602436101561045557600080fd5b60043561046461034782610e0e565b505b8063f5b100ea036104ee5760018201546001600160a01b0316331461049e5760405163ce5a776b60e01b815260040160405180910390fd5b60243610156104ac57600080fd5b6004356104ec6104e7826001600160a01b0316600090815268a20d6e21d0e5255313602052604090205463ffffffff600160801b9091041690565b610c7a565b505b8063e2c79281036105555760018201546001600160a01b031633146105265760405163ce5a776b60e01b815260040160405180910390fd5b600436101561053457600080fd5b68a20d6e21d0e52553085461055590600160801b900463ffffffff16610c7a565b8063b7a94eb80361056a5761056a6001610c7a565b604051631e085ca760e11b815260040160405180910390fd5b34801561058f57600080fd5b50604080518082019091526009815268436869626c696e677360b81b60208201525b6040516105be9190612111565b60405180910390f35b3480156105d357600080fd5b506105e76105e2366004612159565b610e5a565b60405190151581526020016105be565b34801561060357600080fd5b5068a20d6e21d0e525530854600160a01b90046001600160601b03165b6040519081526020016105be565b34801561063a57600080fd5b506105e7610649366004612185565b610e70565b61017a610ede565b34801561066257600080fd5b506105e76106713660046121c6565b610f2e565b34801561068257600080fd5b506105e76106913660046121e3565b610f7d565b3480156106a257600080fd5b5061017a610f91565b3480156106b757600080fd5b50604051601281526020016105be565b3480156106d357600080fd5b506000546106e7906001600160a01b031681565b6040516001600160a01b0390911681526020016105be565b34801561070b57600080fd5b5068a20d6e21d0e5255309546001600160a01b03166106e7565b61017a610fae565b34801561073957600080fd5b506000546105e790600160a01b900460ff1681565b34801561075a57600080fd5b506106206107693660046121c6565b6001600160a01b0316600090815268a20d6e21d0e52553136020526040902054600160a01b90046001600160601b031690565b61017a610fea565b3480156107b057600080fd5b50638b78c6d819546106e7565b3480156107c957600080fd5b5060408051808201909152600481526321a424a160e11b60208201526105b1565b3480156107f657600080fd5b506105e7610805366004612159565b610ffe565b34801561081657600080fd5b5061017a6108253660046121c6565b61100b565b34801561083657600080fd5b506105b1610845366004612205565b61112a565b34801561085657600080fd5b5061062061086536600461221e565b602890815260149190915268a20d6e21d0e525530f60009081526048812091525490565b61017a6108973660046121c6565b61119c565b61017a6108aa3660046121c6565b6111dc565b3480156108bb57600080fd5b5061017a6108ca3660046121c6565b611203565b3480156108db57600080fd5b506106206108ea3660046121c6565b63389a75e1600c908152600091909152602090205490565b68a20d6e21d0e52553086001600160a01b03841661093357604051633a954ecd60e21b815260040160405180910390fd5b600a810160028201600061097c83610958600160201b891089025b6000190160011b90565b60008160031c8360601b0180546007841660051b1c63ffffffff1691505092915050565b63ffffffff1681526020810191909152604001600020546001600160a01b038781169116146109bd5760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b031614610a33576028838152601487905260038301600090815260488120915254600003610a335760008481526004830160205260409020546001600160a01b03848116911614610a3357604051632ce44b5f60e11b815260040160405180910390fd5b6000610a3e87611258565b90506000610a4b87611258565b8254909150678ac7230489e8000090600160a01b90046001600160601b031680821115610a8b57604051631e9acf1760e31b815260040160405180910390fd5b83546001600160601b03918390038216600160a01b9081026001600160a01b0392831617865584548181048416850190931602918116919091178355891660009081526008860160208190526040909120610afd600588018a60609190911b600882901c0154600160ff9092161c1690565b15610b3b576005870160601b60088a901c018054600160ff8c161b191690556000898152600488016020526040902080546001600160a01b03191690555b845463ffffffff60801b198116600160801b9182900463ffffffff90811660001901808216909302919091178755606083901b631fffffff600384901c16015460009260e060059190911b161c1690506000610ba1886000198d01600190811b01610958565b9050610bb4838263ffffffff16846112b2565b610bcf8860001963ffffffff851601600190811b01836112b2565b5050835463ffffffff60801b198116600160801b9182900463ffffffff908116600181019091169092021785556001600160a01b038b166000908152602084905260409020610c1f90828c6112b2565b610c34878b610c2e888f6112df565b84611372565b505050806000528760601b60601c8960601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a3505050505050505050565b8060005260206000f35b6000610c8f826113b7565b610cac5760405163677510db60e11b815260040160405180910390fd5b610cb582610cbb565b92915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a82610cf068a20d6e21d0e5255312610958600160201b8810880261094e565b63ffffffff1681526020810191909152604001600020546001600160a01b03169392505050565b600068a20d6e21d0e525530868a20d6e21d0e525530a82610d4c68a20d6e21d0e5255312610958600160201b8910890261094e565b63ffffffff1681526020810191909152604001600020546001600160a01b03908116925083168214610db2576028838152601483905260038201600090815260488120915254600003610db2576040516367d9dca160e11b815260040160405180910390fd5b6000848152600482016020526040902080546001600160a01b0319166001600160a01b0387169081179091556005820160601b600886901c018054600160ff881690811b1991909116921515901b919091179055509392505050565b6000610e19826113b7565b610e365760405163677510db60e11b815260040160405180910390fd5b50600090815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b6000610e673384846113d4565b50600192915050565b336028908152601484905268a20d6e21d0e525530f6000908152604881209181905281549091906000198114610ec75780841115610ec1576040516313be252b60e01b815260040160405180910390fd5b83810382555b610ed2868686611436565b50600195945050505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6001600160a01b038116600090815268a20d6e21d0e5255313602052604081208054600160581b90046001168203610f6a57823b5b9392505050565b54600160581b9004600216151592915050565b6000610f893383611ca5565b506001919050565b610f99611d23565b6000805460ff60a01b1916600160a01b179055565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b610ff2611d23565b610ffc6000611d3e565b565b6000610e67338484611436565b611013611d23565b6000611029678ac7230489e80000611b4a612257565b9050611036813384611d7c565b611057337309350f89e2d7b6e96ba730783c2d76137b045fef6000196113d4565b61107f33733473729421387941335901f6cafcce615115d4a76812f939c99edab80000611436565b60408051600481526024810182526020810180516001600160e01b03166336778b7360e11b17905290516000916001600160a01b038516916110c1919061227c565b6000604051808303816000865af19150503d80600081146110fe576040519150601f19603f3d011682016040523d82523d6000602084013e611103565b606091505b505090508061112557604051633449496760e21b815260040160405180910390fd5b505050565b60005460405163c87b56dd60e01b8152600481018390526060916001600160a01b03169063c87b56dd90602401600060405180830381865afa158015611174573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cb591908101906122ae565b6111a4611d23565b63389a75e1600c52806000526020600c2080544211156111cc57636f5e88186000526004601cfd5b600090556111d981611d3e565b50565b6111e4611d23565b8060601b6111fa57637448fbae6000526004601cfd5b6111d981611d3e565b61120b611d23565b600054600160a01b900460ff1615611236576040516313ef243160e11b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815268a20d6e21d0e52553136020526040812080549091600160581b90910460011690036112ad57805460ff60581b1916600160581b60ff843b151560020260011716021781555b919050565b8160031c8360601b016007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b8154600160601b900463ffffffff1668a20d6e21d0e5255308600082900361136b57805463ffffffff198116600163ffffffff928316019182169081178355855463ffffffff60601b1916600160601b82021786556000818152600284016020526040812080546001600160a01b0319166001600160a01b038816179055919350900361136b57600080fd5b5092915050565b600183038060021c8560601b016003821660061b9150805467ffffffffffffffff8563ffffffff168560201b178083861c188216851b83188455505050505050505050565b6000806113c383610cbb565b6001600160a01b0316141592915050565b6028828152601484905268a20d6e21d0e525530f600090815260488120915281905560008181526001600160a01b0380841691908516907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590602090a3505050565b6001600160a01b03821661145d57604051633a954ecd60e21b815260040160405180910390fd5b600061146884611258565b9050600061147584611258565b9050600068a20d6e21d0e525530890506114fc604051806101a0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600063ffffffff16815260200160008152602001600063ffffffff1681525090565b835463ffffffff600160801b808304821660808501528554041660a083015282546001600160601b03600160a01b91829004811660c08501529104166040820181905285111561155f57604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905284546001600160601b03918216600160a01b9081026001600160a01b039283161787558554818104841689016060860181905290931602911617835560808101516115dc906115c0678ac7230489e8000090565b8360400151816115d2576115d261235b565b0480821191030290565b81528254600160581b900460021660000361164b57856001600160a01b0316876001600160a01b03160361161857805160808201510360a08201525b611645678ac7230489e800008260600151816116365761163661235b565b048260a0015180821191030290565b60208201525b80516020820151835463ffffffff600160801b80830482169093019390930360e085018190529092160263ffffffff60801b19909116178255600a82016001600160a01b038881169088161415600116156118875760006116cd83608001516116c285600001518660200151808218908211021890565b808218908211021890565b9050801561188557604080516080810182526000808252602080830182815283850183815260608086019081528651888152600589901b81018501885290819052908e9052908e90528101835286518590038752868101805186900390526001600160a01b03808e16835260088901909152838220908c168252929020909190611757888c6112df565b63ffffffff166101408701525b6080860180516000190190819052600381901c606084901b015460009160051b60e0161c63ffffffff1663ffffffff1690506117a5828860a00151836112b2565b6117c486828961014001518a60a0018051809190600101815250611372565b83518181526020018452600881901c6005890160601b015460ff82161c60011615611822576005880160601b600882901c018054600160ff84161b191690556000818152600489016020526040902080546001600160a01b03191690555b5060001984019360000360010161176457600187015461184c9084906001600160a01b0316611f33565b5050506080830151865463ffffffff918216600160801b90810263ffffffff60801b1992831617895560a0860151885493160291161785555b505b600061189c8360200151846000015101611f83565b8454600160601b900463ffffffff16610180850152835190915015611a2f57606089901b6001176020828101919091526001600160a01b038a16600090815260088601909152604081206080850151855181036101008701819052895463ffffffff909116600160801b0263ffffffff60801b199091161789556101808601515b60001991909101600381901c606084901b0154909190600583901b60e0161c63ffffffff1661194f8782600080611372565b8551602080880151600884901b1782520186526006890160601b600882901c018054600160ff84161b19169055841561199c5761199c896009018380600101945063ffffffff16836112b2565b600881901c60058a0160601b015460ff82161c600116156119f0576005890160601b600882901c018054600160ff84161b19169055600081815260048a016020526040902080546001600160a01b03191690555b50866101000151820361191d578315611a2a5763ffffffff81166101808801819052885463ffffffff60601b1916600160601b9091021788555b505050505b602083015115611c3e57606088901b60208201528354600160201b900463ffffffff166101608401526001600160a01b03881660009081526008850160205260409020611a7c868a6112df565b63ffffffff166101408501526000678ac7230489e800008560c0015181611aa557611aa561235b565b60a08701516020880151810161012089018190528a5463ffffffff60801b1916600160801b63ffffffff92831602178b55895493909204935091600160401b9004165b600087610180015163ffffffff168263ffffffff1614611b38576009890160601b631fffffff600384901c160154600183019260e060059190911b161c63ffffffff1663ffffffff169050611b9a565b506101608701515b611b5187600019830160011b610958565b63ffffffff1615611b8657611b7f611b738a6006018360010187600101611fca565b85811180159091021790565b9050611b40565b600181018481118015909102176101608901525b600881901c60068a0160601b018054600160ff84161b8019909116179055611bc38584836112b2565b611bda87828a610140015186806001019750611372565b8551602080880151600884901b178252018652508661012001518203611ae857875461016088015163ffffffff908116600160201b0267ffffffff000000001991909316600160401b02166bffffffffffffffff0000000019909116171787555050505b60408101515115611c62576001840154611c629082906001600160a01b03166120b1565b5050846000528560601b60601c8760601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a350505050505050565b6000611cb083611258565b8054909150600160581b9004600216151582151514611ceb57805460ff600160581b80830482166002189091160260ff60581b199091161781555b8115156000528260601b60601c7fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039360206000a2505050565b638b78c6d819543314610ffc576382b429006000526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b68a20d6e21d0e52553088054600160201b900463ffffffff1615611db357604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b038216611dda576040516339a84a7b60e01b815260040160405180910390fd5b630f4599e560005233602052602060006024601c6000865af160016000511416611e0c5763d125259c6000526004601cfd5b805467ffffffff000000001916600160201b1781556001810180546001600160a01b0384166001600160a01b03199091161790558315611f2d576001600160a01b038316611e6d57604051633a954ecd60e21b815260040160405180910390fd5b6001600160601b03841163fffffffe678ac7230489e800008604111715611ea75760405163e5cfe95760e01b815260040160405180910390fd5b80546001600160a01b0316600160a01b6001600160601b038616021781556000611ed084611258565b80546001600160601b038716600160a01b026001600160a01b0391821617825560008781529192508516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602082a3611f2b846001611ca5565b505b50505050565b6060820151805160051b60840160808203915063144027d38252836020015160208301528360400151604083015260608083015260208282601c85016000875af1600183511416611f2d57600082fd5b611fa760405180606001604052806000815260200160008152602001606081525090565b604051828152806020018360051b81016040528183604001528083525050919050565b6000801990508360601b8360081c81018054198560ff161c8560ff161b8061201f578460081c83015b6001830192508254199150808311821715611ff3578083111561201d5760ff86191691821b90911c905b505b80156120a75782820360081b7e1f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405821960010183166fffffffffffffffffffffffffffffffff811160071b81811c67ffffffffffffffff1060061b1781811c63ffffffff1060051b1790811c63d76453e004601f169190911a171785811015878210176000031793505b5050509392505050565b60408201516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af1600182511416611f2d57600081fd5b60005b838110156121085781810151838201526020016120f0565b50506000910152565b60208152600082518060208401526121308160408501602087016120ed565b601f01601f19169190910160400192915050565b6001600160a01b03811681146111d957600080fd5b6000806040838503121561216c57600080fd5b823561217781612144565b946020939093013593505050565b60008060006060848603121561219a57600080fd5b83356121a581612144565b925060208401356121b581612144565b929592945050506040919091013590565b6000602082840312156121d857600080fd5b8135610f6381612144565b6000602082840312156121f557600080fd5b81358015158114610f6357600080fd5b60006020828403121561221757600080fd5b5035919050565b6000806040838503121561223157600080fd5b823561223c81612144565b9150602083013561224c81612144565b809150509250929050565b8082028115828204841417610cb557634e487b7160e01b600052601160045260246000fd5b6000825161228e8184602087016120ed565b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156122c057600080fd5b815167ffffffffffffffff808211156122d857600080fd5b818401915084601f8301126122ec57600080fd5b8151818111156122fe576122fe612298565b604051601f8201601f19908116603f0116810190838211818310171561232657612326612298565b8160405282815287602084870101111561233f57600080fd5b6123508360208301602088016120ed565b979650505050505050565b634e487b7160e01b600052601260045260246000fdfea26469706673582212206974ec3766851e893741912e154c635ecff18a301f714955f17a564b6698246864736f6c6343000818003300000000000000000000000018570d2f9e33d4c7de8aa289efe3b7f85d6be0b8

Deployed Bytecode

0x60806040526004361061016a5760003560e01c806369d2ceb1116100d1578063c4d66de81161008a578063f04e283e11610064578063f04e283e14610889578063f2fde38b1461089c578063f3cb8385146108af578063fee81cf4146108cf5761017c565b8063c4d66de81461080a578063c87b56dd1461082a578063dd62ed3e1461084a5761017c565b806369d2ceb11461072d57806370a082311461074e578063715018a61461079c5780638da5cb5b146107a457806395d89b41146107bd578063a9059cbb146107ea5761017c565b80632a6a935d116101235780632a6a935d146106765780632c5a8c1d14610696578063313ce567146106ab578063392f37e9146106c75780634ef41efc146106ff57806354d1f13d146107255761017c565b806306fdde0314610583578063095ea7b3146105c757806318160ddd146105f757806323b872dd1461062e578063256929621461064e578063274e430b146106565761017c565b3661017c57341561017a57600080fd5b005b68a20d6e21d0e525530860003560e01c63e5eb36c88190036101fa5760018201546001600160a01b031633146101c55760405163ce5a776b60e01b815260040160405180910390fd5b60843610156101d357600080fd5b6004356024356044356064356101eb84848484610902565b6101f56001610c7a565b505050505b8063813500fc0361027c5760018201546001600160a01b031633146102325760405163ce5a776b60e01b815260040160405180910390fd5b606436101561024057600080fd5b6004356028818152604435601481905268a20d6e21d0e525530b60009081526048812092526024351515918290556102786001610c7a565b5050505b8063e985e9c5036102f25760018201546001600160a01b031633146102b45760405163ce5a776b60e01b815260040160405180910390fd5b60443610156102c257600080fd5b6024356028818152600435601481905260038501600090815260488120925290549091906102ef90610c7a565b50505b80636352211e036103575760018201546001600160a01b0316331461032a5760405163ce5a776b60e01b815260040160405180910390fd5b602436101561033857600080fd5b60043561035561034782610c84565b6001600160a01b0316610c7a565b505b806324359879036103ae5760018201546001600160a01b0316331461038f5760405163ce5a776b60e01b815260040160405180910390fd5b602436101561039d57600080fd5b6004356103ac61034782610cbb565b505b8063d10b6e0c0361040f5760018201546001600160a01b031633146103e65760405163ce5a776b60e01b815260040160405180910390fd5b60643610156103f457600080fd5b60043560243560443561040b610347848484610d17565b5050505b8063081812fc036104665760018201546001600160a01b031633146104475760405163ce5a776b60e01b815260040160405180910390fd5b602436101561045557600080fd5b60043561046461034782610e0e565b505b8063f5b100ea036104ee5760018201546001600160a01b0316331461049e5760405163ce5a776b60e01b815260040160405180910390fd5b60243610156104ac57600080fd5b6004356104ec6104e7826001600160a01b0316600090815268a20d6e21d0e5255313602052604090205463ffffffff600160801b9091041690565b610c7a565b505b8063e2c79281036105555760018201546001600160a01b031633146105265760405163ce5a776b60e01b815260040160405180910390fd5b600436101561053457600080fd5b68a20d6e21d0e52553085461055590600160801b900463ffffffff16610c7a565b8063b7a94eb80361056a5761056a6001610c7a565b604051631e085ca760e11b815260040160405180910390fd5b34801561058f57600080fd5b50604080518082019091526009815268436869626c696e677360b81b60208201525b6040516105be9190612111565b60405180910390f35b3480156105d357600080fd5b506105e76105e2366004612159565b610e5a565b60405190151581526020016105be565b34801561060357600080fd5b5068a20d6e21d0e525530854600160a01b90046001600160601b03165b6040519081526020016105be565b34801561063a57600080fd5b506105e7610649366004612185565b610e70565b61017a610ede565b34801561066257600080fd5b506105e76106713660046121c6565b610f2e565b34801561068257600080fd5b506105e76106913660046121e3565b610f7d565b3480156106a257600080fd5b5061017a610f91565b3480156106b757600080fd5b50604051601281526020016105be565b3480156106d357600080fd5b506000546106e7906001600160a01b031681565b6040516001600160a01b0390911681526020016105be565b34801561070b57600080fd5b5068a20d6e21d0e5255309546001600160a01b03166106e7565b61017a610fae565b34801561073957600080fd5b506000546105e790600160a01b900460ff1681565b34801561075a57600080fd5b506106206107693660046121c6565b6001600160a01b0316600090815268a20d6e21d0e52553136020526040902054600160a01b90046001600160601b031690565b61017a610fea565b3480156107b057600080fd5b50638b78c6d819546106e7565b3480156107c957600080fd5b5060408051808201909152600481526321a424a160e11b60208201526105b1565b3480156107f657600080fd5b506105e7610805366004612159565b610ffe565b34801561081657600080fd5b5061017a6108253660046121c6565b61100b565b34801561083657600080fd5b506105b1610845366004612205565b61112a565b34801561085657600080fd5b5061062061086536600461221e565b602890815260149190915268a20d6e21d0e525530f60009081526048812091525490565b61017a6108973660046121c6565b61119c565b61017a6108aa3660046121c6565b6111dc565b3480156108bb57600080fd5b5061017a6108ca3660046121c6565b611203565b3480156108db57600080fd5b506106206108ea3660046121c6565b63389a75e1600c908152600091909152602090205490565b68a20d6e21d0e52553086001600160a01b03841661093357604051633a954ecd60e21b815260040160405180910390fd5b600a810160028201600061097c83610958600160201b891089025b6000190160011b90565b60008160031c8360601b0180546007841660051b1c63ffffffff1691505092915050565b63ffffffff1681526020810191909152604001600020546001600160a01b038781169116146109bd5760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b031614610a33576028838152601487905260038301600090815260488120915254600003610a335760008481526004830160205260409020546001600160a01b03848116911614610a3357604051632ce44b5f60e11b815260040160405180910390fd5b6000610a3e87611258565b90506000610a4b87611258565b8254909150678ac7230489e8000090600160a01b90046001600160601b031680821115610a8b57604051631e9acf1760e31b815260040160405180910390fd5b83546001600160601b03918390038216600160a01b9081026001600160a01b0392831617865584548181048416850190931602918116919091178355891660009081526008860160208190526040909120610afd600588018a60609190911b600882901c0154600160ff9092161c1690565b15610b3b576005870160601b60088a901c018054600160ff8c161b191690556000898152600488016020526040902080546001600160a01b03191690555b845463ffffffff60801b198116600160801b9182900463ffffffff90811660001901808216909302919091178755606083901b631fffffff600384901c16015460009260e060059190911b161c1690506000610ba1886000198d01600190811b01610958565b9050610bb4838263ffffffff16846112b2565b610bcf8860001963ffffffff851601600190811b01836112b2565b5050835463ffffffff60801b198116600160801b9182900463ffffffff908116600181019091169092021785556001600160a01b038b166000908152602084905260409020610c1f90828c6112b2565b610c34878b610c2e888f6112df565b84611372565b505050806000528760601b60601c8960601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a3505050505050505050565b8060005260206000f35b6000610c8f826113b7565b610cac5760405163677510db60e11b815260040160405180910390fd5b610cb582610cbb565b92915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a82610cf068a20d6e21d0e5255312610958600160201b8810880261094e565b63ffffffff1681526020810191909152604001600020546001600160a01b03169392505050565b600068a20d6e21d0e525530868a20d6e21d0e525530a82610d4c68a20d6e21d0e5255312610958600160201b8910890261094e565b63ffffffff1681526020810191909152604001600020546001600160a01b03908116925083168214610db2576028838152601483905260038201600090815260488120915254600003610db2576040516367d9dca160e11b815260040160405180910390fd5b6000848152600482016020526040902080546001600160a01b0319166001600160a01b0387169081179091556005820160601b600886901c018054600160ff881690811b1991909116921515901b919091179055509392505050565b6000610e19826113b7565b610e365760405163677510db60e11b815260040160405180910390fd5b50600090815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b6000610e673384846113d4565b50600192915050565b336028908152601484905268a20d6e21d0e525530f6000908152604881209181905281549091906000198114610ec75780841115610ec1576040516313be252b60e01b815260040160405180910390fd5b83810382555b610ed2868686611436565b50600195945050505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6001600160a01b038116600090815268a20d6e21d0e5255313602052604081208054600160581b90046001168203610f6a57823b5b9392505050565b54600160581b9004600216151592915050565b6000610f893383611ca5565b506001919050565b610f99611d23565b6000805460ff60a01b1916600160a01b179055565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b610ff2611d23565b610ffc6000611d3e565b565b6000610e67338484611436565b611013611d23565b6000611029678ac7230489e80000611b4a612257565b9050611036813384611d7c565b611057337309350f89e2d7b6e96ba730783c2d76137b045fef6000196113d4565b61107f33733473729421387941335901f6cafcce615115d4a76812f939c99edab80000611436565b60408051600481526024810182526020810180516001600160e01b03166336778b7360e11b17905290516000916001600160a01b038516916110c1919061227c565b6000604051808303816000865af19150503d80600081146110fe576040519150601f19603f3d011682016040523d82523d6000602084013e611103565b606091505b505090508061112557604051633449496760e21b815260040160405180910390fd5b505050565b60005460405163c87b56dd60e01b8152600481018390526060916001600160a01b03169063c87b56dd90602401600060405180830381865afa158015611174573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cb591908101906122ae565b6111a4611d23565b63389a75e1600c52806000526020600c2080544211156111cc57636f5e88186000526004601cfd5b600090556111d981611d3e565b50565b6111e4611d23565b8060601b6111fa57637448fbae6000526004601cfd5b6111d981611d3e565b61120b611d23565b600054600160a01b900460ff1615611236576040516313ef243160e11b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815268a20d6e21d0e52553136020526040812080549091600160581b90910460011690036112ad57805460ff60581b1916600160581b60ff843b151560020260011716021781555b919050565b8160031c8360601b016007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b8154600160601b900463ffffffff1668a20d6e21d0e5255308600082900361136b57805463ffffffff198116600163ffffffff928316019182169081178355855463ffffffff60601b1916600160601b82021786556000818152600284016020526040812080546001600160a01b0319166001600160a01b038816179055919350900361136b57600080fd5b5092915050565b600183038060021c8560601b016003821660061b9150805467ffffffffffffffff8563ffffffff168560201b178083861c188216851b83188455505050505050505050565b6000806113c383610cbb565b6001600160a01b0316141592915050565b6028828152601484905268a20d6e21d0e525530f600090815260488120915281905560008181526001600160a01b0380841691908516907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590602090a3505050565b6001600160a01b03821661145d57604051633a954ecd60e21b815260040160405180910390fd5b600061146884611258565b9050600061147584611258565b9050600068a20d6e21d0e525530890506114fc604051806101a0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600063ffffffff16815260200160008152602001600063ffffffff1681525090565b835463ffffffff600160801b808304821660808501528554041660a083015282546001600160601b03600160a01b91829004811660c08501529104166040820181905285111561155f57604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905284546001600160601b03918216600160a01b9081026001600160a01b039283161787558554818104841689016060860181905290931602911617835560808101516115dc906115c0678ac7230489e8000090565b8360400151816115d2576115d261235b565b0480821191030290565b81528254600160581b900460021660000361164b57856001600160a01b0316876001600160a01b03160361161857805160808201510360a08201525b611645678ac7230489e800008260600151816116365761163661235b565b048260a0015180821191030290565b60208201525b80516020820151835463ffffffff600160801b80830482169093019390930360e085018190529092160263ffffffff60801b19909116178255600a82016001600160a01b038881169088161415600116156118875760006116cd83608001516116c285600001518660200151808218908211021890565b808218908211021890565b9050801561188557604080516080810182526000808252602080830182815283850183815260608086019081528651888152600589901b81018501885290819052908e9052908e90528101835286518590038752868101805186900390526001600160a01b03808e16835260088901909152838220908c168252929020909190611757888c6112df565b63ffffffff166101408701525b6080860180516000190190819052600381901c606084901b015460009160051b60e0161c63ffffffff1663ffffffff1690506117a5828860a00151836112b2565b6117c486828961014001518a60a0018051809190600101815250611372565b83518181526020018452600881901c6005890160601b015460ff82161c60011615611822576005880160601b600882901c018054600160ff84161b191690556000818152600489016020526040902080546001600160a01b03191690555b5060001984019360000360010161176457600187015461184c9084906001600160a01b0316611f33565b5050506080830151865463ffffffff918216600160801b90810263ffffffff60801b1992831617895560a0860151885493160291161785555b505b600061189c8360200151846000015101611f83565b8454600160601b900463ffffffff16610180850152835190915015611a2f57606089901b6001176020828101919091526001600160a01b038a16600090815260088601909152604081206080850151855181036101008701819052895463ffffffff909116600160801b0263ffffffff60801b199091161789556101808601515b60001991909101600381901c606084901b0154909190600583901b60e0161c63ffffffff1661194f8782600080611372565b8551602080880151600884901b1782520186526006890160601b600882901c018054600160ff84161b19169055841561199c5761199c896009018380600101945063ffffffff16836112b2565b600881901c60058a0160601b015460ff82161c600116156119f0576005890160601b600882901c018054600160ff84161b19169055600081815260048a016020526040902080546001600160a01b03191690555b50866101000151820361191d578315611a2a5763ffffffff81166101808801819052885463ffffffff60601b1916600160601b9091021788555b505050505b602083015115611c3e57606088901b60208201528354600160201b900463ffffffff166101608401526001600160a01b03881660009081526008850160205260409020611a7c868a6112df565b63ffffffff166101408501526000678ac7230489e800008560c0015181611aa557611aa561235b565b60a08701516020880151810161012089018190528a5463ffffffff60801b1916600160801b63ffffffff92831602178b55895493909204935091600160401b9004165b600087610180015163ffffffff168263ffffffff1614611b38576009890160601b631fffffff600384901c160154600183019260e060059190911b161c63ffffffff1663ffffffff169050611b9a565b506101608701515b611b5187600019830160011b610958565b63ffffffff1615611b8657611b7f611b738a6006018360010187600101611fca565b85811180159091021790565b9050611b40565b600181018481118015909102176101608901525b600881901c60068a0160601b018054600160ff84161b8019909116179055611bc38584836112b2565b611bda87828a610140015186806001019750611372565b8551602080880151600884901b178252018652508661012001518203611ae857875461016088015163ffffffff908116600160201b0267ffffffff000000001991909316600160401b02166bffffffffffffffff0000000019909116171787555050505b60408101515115611c62576001840154611c629082906001600160a01b03166120b1565b5050846000528560601b60601c8760601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a350505050505050565b6000611cb083611258565b8054909150600160581b9004600216151582151514611ceb57805460ff600160581b80830482166002189091160260ff60581b199091161781555b8115156000528260601b60601c7fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039360206000a2505050565b638b78c6d819543314610ffc576382b429006000526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b68a20d6e21d0e52553088054600160201b900463ffffffff1615611db357604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b038216611dda576040516339a84a7b60e01b815260040160405180910390fd5b630f4599e560005233602052602060006024601c6000865af160016000511416611e0c5763d125259c6000526004601cfd5b805467ffffffff000000001916600160201b1781556001810180546001600160a01b0384166001600160a01b03199091161790558315611f2d576001600160a01b038316611e6d57604051633a954ecd60e21b815260040160405180910390fd5b6001600160601b03841163fffffffe678ac7230489e800008604111715611ea75760405163e5cfe95760e01b815260040160405180910390fd5b80546001600160a01b0316600160a01b6001600160601b038616021781556000611ed084611258565b80546001600160601b038716600160a01b026001600160a01b0391821617825560008781529192508516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602082a3611f2b846001611ca5565b505b50505050565b6060820151805160051b60840160808203915063144027d38252836020015160208301528360400151604083015260608083015260208282601c85016000875af1600183511416611f2d57600082fd5b611fa760405180606001604052806000815260200160008152602001606081525090565b604051828152806020018360051b81016040528183604001528083525050919050565b6000801990508360601b8360081c81018054198560ff161c8560ff161b8061201f578460081c83015b6001830192508254199150808311821715611ff3578083111561201d5760ff86191691821b90911c905b505b80156120a75782820360081b7e1f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405821960010183166fffffffffffffffffffffffffffffffff811160071b81811c67ffffffffffffffff1060061b1781811c63ffffffff1060051b1790811c63d76453e004601f169190911a171785811015878210176000031793505b5050509392505050565b60408201516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af1600182511416611f2d57600081fd5b60005b838110156121085781810151838201526020016120f0565b50506000910152565b60208152600082518060208401526121308160408501602087016120ed565b601f01601f19169190910160400192915050565b6001600160a01b03811681146111d957600080fd5b6000806040838503121561216c57600080fd5b823561217781612144565b946020939093013593505050565b60008060006060848603121561219a57600080fd5b83356121a581612144565b925060208401356121b581612144565b929592945050506040919091013590565b6000602082840312156121d857600080fd5b8135610f6381612144565b6000602082840312156121f557600080fd5b81358015158114610f6357600080fd5b60006020828403121561221757600080fd5b5035919050565b6000806040838503121561223157600080fd5b823561223c81612144565b9150602083013561224c81612144565b809150509250929050565b8082028115828204841417610cb557634e487b7160e01b600052601160045260246000fd5b6000825161228e8184602087016120ed565b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156122c057600080fd5b815167ffffffffffffffff808211156122d857600080fd5b818401915084601f8301126122ec57600080fd5b8151818111156122fe576122fe612298565b604051601f8201601f19908116603f0116810190838211818310171561232657612326612298565b8160405282815287602084870101111561233f57600080fd5b6123508360208301602088016120ed565b979650505050505050565b634e487b7160e01b600052601260045260246000fdfea26469706673582212206974ec3766851e893741912e154c635ecff18a301f714955f17a564b6698246864736f6c63430008180033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000018570d2f9e33d4c7de8aa289efe3b7f85d6be0b8

-----Decoded View---------------
Arg [0] : metadata_ (address): 0x18570D2f9E33d4C7de8aA289EfE3B7F85D6Be0B8

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000018570d2f9e33d4c7de8aa289efe3b7f85d6be0b8


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.