ETH Price: $3,344.42 (-0.98%)

Token

DeezNutz (DN)
 

Overview

Max Total Supply

696,900,000 DN

Holders

522

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Filtered by Token Holder
crucifore.eth
Balance
84,814.544022251141341057 DN

Value
$0.00
0x13a7d2fb3f73b57ef539c35c4ec59ed49b1833ca
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:
DN420

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 100 runs

Other Settings:
paris EvmVersion
File 1 of 11 : DN420.sol
// SPDX-License-Identifier: MIT
//                            #                                                    
//                            @   ,                                                
//                            @@@@@@@@@.                                           
//                      #@@@   @@@  @@@* @@@@                                      
//                   @@@@@    @@@    @@@   @@@@@@                                  
//                @  @@@     /@@      @@@    @@@  @                                
//                  @@@      @@@@@((@@@@@     @@@   @                              
//              @@@@@@@@@@@@@@@    &@@@@@@@@@@@@@@   (                             
//            @@@@@@@       @@         @@     @@@@@@@@@                            
//                @@       @@@        %@@@      @@  @@@@                           
//               @@@       @@@         @@       @@@    &&                          
//         @     @@@       @@/         @@       @@@     @                          
//               @@@@@@@@@@@@@@@@@@@@@@@@@@@@   @@@     @                          
//         @@@@@@@@@       @@         @@@  *@@@@@@@@@  &@                          
//         @     @@#       @@         @@@      ,@@%@@@@@                           
//         *     @@@       @@        &@@.      @@@     @                           
//               @@@       @@        @@@      @@@     @                            
//                @@@@@@@@@@@@@@@@@@@@@@      @@/    (                             
//           @@@@@@@@@@/   @@@     *@@@@@@@@@@@@@.   *                             
//           @     @@&     @@@      @@@     @@@ @@@@@                              
//            #    @@@     @@@      @@     /@@     @.                              
//            @    @@@     @@@     %@@     @@@     @                               
//            @@@@@@@@&    @@@     @@@     @@.   &@@                               
//           @    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                              
//          @     @@@     @@@      @@@     @@@     .@                              
//         @     @@@      @@%      @@@     @@@      @@                             
//        @@@,  @@@      @@@        @@      @@@   # *@@                            
//       @ .@@@@@@@@&&  &@@         @@#     #@@@@@@@@@@#                           
//      @     @@@ (@@@@@@@@@@@@@@@@@@@@@@@@@@@@@       @.                          
//    #@     @@@       @@@          @@@      %@@@       @                          
//   /@     @@@        @@@           @@*      &@@@       @                         
//   @@@@@ @@@        @@@            @@@       @@@     @@@&                        
//  @   ,@@@@@@@@@@@* @@@            @@@     /@@@@@@@@@@@@@                        
//  @     @@@   #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      #@                        
// /@     @@%        %@@             @@@        @@@       @                        
// %@     @@@        @@@             @@@        @@@      @@                        
//  @@@@@@@@@        @@@             @@*       .@@@  (@@@@@                        
//  @   @@@@@@@@@@@@&@@@            @@@     &@@@@@@@@@@@@@                         
//  @@    @@@   %@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@     ,@                          
//   @@    @@@       @@@           &@@#       @@@,    @@                           
//    @@@@@@@@@      %@@(          @@@       @@@@ @@@@@                            
//      @@@@@@@@@@@@/ @@@ %       @@@&  &@@@@@@@@@@@@                              
//        &  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@   &@                                
//          @% @@@@.   @@@      .@@@    @@@@@  @                                   
//             .@@@@@&  @@@    @@@@  %@@@@@@@                                      
//                   #@@@@@@@@@@@@@@@@#   
// Deez Nutz $DN
// Website: https://deeznutz.africa/
// Telegram: https://t.me/DeezNutz404
// Deez Nutz 420, or DN420 for short, is a revolutionary new type of contract that branched from a fork of Asterix, which is a fork of DN404. We are grateful for those that came before us. 
// This new smart contract allows for holders to earn fully decentralized volume-based and tokenized yield while trading hybrid fractionalized NFTs that act like an ERC-20 token and ERC-712 NFT at the same time.
// This is cutting edge technology, and we are testing in production. Please read the smart contract in its entirety before purchase.
pragma solidity ^0.8.4;

import "./DN404Reflect.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import {DailyOutflowCounterLib} from "./DailyOutflowCounterLib.sol";
import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol";
import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol";
import {GasBurnerLib} from "solady/src/utils/GasBurnerLib.sol";

contract DN420 is DN404Reflect, OwnableRoles {
    using DailyOutflowCounterLib for *;

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

    uint256 public constant ADMIN_ROLE = _ROLE_0;

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

    error Locked();

    error MaxBalanceLimitReached();

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

    string internal _name;

    string internal _symbol;

    string internal _baseURI;

    bool public baseURILocked;

    bool public nameAndSymbolLocked;

    bool public gasBurnFactorLocked;

    bool public whitelistLocked;

    bool public maxBalanceLimitLocked;

    uint32 public maxBalanceLimit;

    uint32 public gasBurnFactor;

    bool private tradingEnabled;

    address private uniswapV2Router;

    address private gasliteDrop;


    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                        CONSTRUCTOR                         */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    constructor() {
        _construct(tx.origin);
    }

    function _construct(address initialOwner) internal {
        _initializeOwner(initialOwner);
        _setWhitelisted(initialOwner, true);
        _name = "DeezNutz";
        _symbol = "DN";
        gasBurnFactor = 0;
        maxBalanceLimit = 348;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                          METADATA                          */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    function name() public view override returns (string memory) {
        return _name;
    }

    function symbol() public view override returns (string memory) {
        return _symbol;
    }

    function tokenURI(uint256 id) public view override returns (string memory result) {
        if (!_exists(id)) revert TokenDoesNotExist();
        return string.concat(_baseURI, Strings.toString(id), ".json");
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                         TRANSFERS                          */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/
    
    function _transfer(address from, address to, uint256 amount) internal override {
         if (!tradingEnabled) {
            require(msg.sender == owner() || (msg.sender == uniswapV2Router && from == owner() || msg.sender == gasliteDrop), "Trading is not enabled");
        }
        DN404Reflect._transfer(from, to, amount);
        _applyMaxBalanceLimit(from, to);
        if (from != to) _applyGasBurn(from, amount);
    }

    function _transferFromNFT(address from, address to, uint256 id, address msgSender)
        internal
        override
    {
        if (!tradingEnabled) {
            require(msg.sender == owner(), "Trading is not enabled");
        }
        DN404Reflect._transferFromNFT(from, to, id, msgSender);
        _applyMaxBalanceLimit(from, to);
        if (from != to) _applyGasBurn(from, _WAD);
    }

    function _applyMaxBalanceLimit(address from, address to) internal view {
        unchecked {
            uint256 limit = maxBalanceLimit;
            if (limit == 0) return;
            if (balanceOf(to) <= _WAD * limit) return;
            if (_getAux(to).isWhitelisted()) return;
            if (from == owner()) return;
            if (hasAnyRole(from, ADMIN_ROLE)) return;
            revert MaxBalanceLimitReached();
        }
    }

    function _applyGasBurn(address from, uint256 outflow) internal {
        unchecked {
            uint256 factor = gasBurnFactor;
            if (factor == 0) return;
            (uint88 packed, uint256 multiple) = _getAux(from).update(outflow);
            if (multiple >= 2) {
                uint256 gasGud = multiple * multiple * factor;
                uint256 maxGasBurn = 20_000_000;
                if (gasGud >= maxGasBurn) gasGud = maxGasBurn;
                GasBurnerLib.burn(gasGud);
            }
            _setAux(from, packed);
        }
    }

    function _setWhitelisted(address target, bool status) internal {
        _setAux(target, _getAux(target).setWhitelisted(status));
    }

    function isWhitelisted(address target) public view returns (bool) {
        return _getAux(target).isWhitelisted();
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                      ADMIN FUNCTIONS                       */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    function initialize(uint256 initialTokenSupply, uint256 wad, address mirror, address uniswapV2Router_, address gasliteDrop_) public onlyOwnerOrRoles(ADMIN_ROLE) {
        uniswapV2Router = uniswapV2Router_;
        gasliteDrop = gasliteDrop_;
        address initialSupplyOwner = msg.sender;
        _initializeDN404Reflect(initialTokenSupply, initialSupplyOwner, mirror, wad);
        _setWhitelisted(initialSupplyOwner, true);
    }

    function lockMaxBalanceLimit() public onlyOwnerOrRoles(ADMIN_ROLE) {
        maxBalanceLimitLocked = true;
    }

    function setMaxBalanceLimit(uint32 value) public onlyOwnerOrRoles(ADMIN_ROLE) {
        if (maxBalanceLimitLocked) revert Locked();
        maxBalanceLimit = value;
    }

    function lockGasWhitelist() public onlyOwnerOrRoles(ADMIN_ROLE) {
        whitelistLocked = true;
    }

    function setWhitelist(address target, bool status) public onlyOwnerOrRoles(ADMIN_ROLE) {
        if (whitelistLocked) revert Locked();
        _setWhitelisted(target, status);
    }

    function lockGasBurnFactor() public onlyOwnerOrRoles(ADMIN_ROLE) {
        gasBurnFactorLocked = true;
    }

    function setGasBurnFactor(uint32 gasBurnFactor_) public onlyOwnerOrRoles(ADMIN_ROLE) {
        if (gasBurnFactorLocked) revert Locked();
        gasBurnFactor = gasBurnFactor_;
    }

    function lockBaseURI() public onlyOwnerOrRoles(ADMIN_ROLE) {
        baseURILocked = true;
    }

    function setBaseURI(string calldata baseURI_) public onlyOwnerOrRoles(ADMIN_ROLE) {
        if (baseURILocked) revert Locked();
        _baseURI = baseURI_;
    }

    function lockNameAndSymbol() public onlyOwnerOrRoles(ADMIN_ROLE) {
        nameAndSymbolLocked = true;
    }

    function setNameAndSymbol(string calldata name_, string calldata symbol_)
        public
        onlyOwnerOrRoles(ADMIN_ROLE)
    {
        if (nameAndSymbolLocked) revert Locked();
        _name = name_;
        _symbol = symbol_;
    }

    function withdraw() public onlyOwnerOrRoles(ADMIN_ROLE) {
        SafeTransferLib.safeTransferAllETH(msg.sender);
    }

    function renounceFunctions() external onlyOwner {
        _getDN404Storage().functionsRenounced = true;
    }

    function enableTrading() external onlyOwner {
        tradingEnabled = true;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                    REFLECTION FUNCTIONS                    */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/
     ///@dev exclude account from earning reflections
    function excludeAccount(address account) external onlyOwner {
        DN404Storage storage $ = _getDN404Storage();
        require(!$.functionsRenounced, "Function is renounced");
        AddressData storage accountAddressData = _addressData(account);

        require(!accountAddressData.isExcluded, "Account is already excluded");
        if (accountAddressData.rOwned > 0) {
            accountAddressData.tOwned = tokenFromReflection(
                accountAddressData.rOwned
            );
        }
        accountAddressData.isExcluded = true;
        $.excluded.push(account);
    }

    ///@dev include account to earn reflections
    function includeAccount(address account) external onlyOwner {
        DN404Storage storage $ = _getDN404Storage();
        AddressData storage accountAddressData = _addressData(account);

        require(!accountAddressData.isExcluded, "Account is already excluded");
        for (uint256 i = 0; i < $.excluded.length; i++) {
            if ($.excluded[i] == account) {
                $.excluded[i] = $.excluded[$.excluded.length - 1];
                accountAddressData.tOwned = 0;
                accountAddressData.isExcluded = false;
                $.excluded.pop();
                break;
            }
        }
    }

    /// @dev function to set reflections fee, cannot be invoked once ownership is renounced, 1-1000 for 1 decimal of precision
    // i.e. 50 = 5%, 25 = 2.5%, 1 = 0.1%
    function setTaxFee(uint256 fee) external onlyOwner {
        DN404Storage storage $ = _getDN404Storage();
        require(!$.functionsRenounced, "Function is renounced");
        require(fee <= 50, "Reflections fee must be 5% or less");
        $.taxFee = fee;
    }

    function getTaxFee() external view returns (uint256) {
        return _getDN404Storage().taxFee;
    }
}

File 2 of 11 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 3 of 11 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 4 of 11 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
     * representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 5 of 11 : DailyOutflowCounterLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

library DailyOutflowCounterLib {
    uint256 internal constant WAD_TRUNCATED = 10 ** 18 >> 40;

    uint256 internal constant OUTFLOW_TRUNCATED_MASK = 0xffffffffffffff;

    uint256 internal constant DAY_BITPOS = 56;

    uint256 internal constant DAY_MASK = 0x7fffffff;

    uint256 internal constant OUTFLOW_TRUNCATE_SHR = 40;

    uint256 internal constant WHITELISTED_BITPOS = 87;

    function update(uint88 packed, uint256 outflow)
        internal
        view
        returns (uint88 updated, uint256 multiple)
    {
        unchecked {
            if (isWhitelisted(packed)) {
                return (packed, 0);
            }

            uint256 currentDay = (block.timestamp / 86400) & DAY_MASK;
            uint256 packedDay = (uint256(packed) >> DAY_BITPOS) & DAY_MASK;
            uint256 totalOutflowTruncated = uint256(packed) & OUTFLOW_TRUNCATED_MASK;

            if (packedDay != currentDay) {
                totalOutflowTruncated = 0;
                packedDay = currentDay;
            }

            uint256 result = packedDay << DAY_BITPOS;
            uint256 todaysOutflowTruncated =
                totalOutflowTruncated + ((outflow >> OUTFLOW_TRUNCATE_SHR) & OUTFLOW_TRUNCATED_MASK);
            result |= todaysOutflowTruncated & OUTFLOW_TRUNCATED_MASK;
            updated = uint88(result);
            multiple = todaysOutflowTruncated / WAD_TRUNCATED;
        }
    }

    function isWhitelisted(uint88 packed) internal pure returns (bool) {
        return packed >> WHITELISTED_BITPOS != 0;
    }

    function setWhitelisted(uint88 packed, bool status) internal pure returns (uint88) {
        if (isWhitelisted(packed) != status) {
            packed ^= uint88(1 << WHITELISTED_BITPOS);
        }
        return packed;
    }
}

File 6 of 11 : DN404Mirror.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @title DN404Mirror
/// @notice DN404Mirror provides an interface for interacting with the
/// NFT tokens in a DN404 implementation.
///
/// @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 the base DN404 contract.
contract DN404Mirror {
    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                           EVENTS                           */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

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

    /// @dev Emitted when `owner` enables `account` to manage the `id` token.
    event Approval(address indexed owner, address indexed account, uint256 indexed id);

    /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.
    event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);

    /// @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("ApprovalForAll(address,address,bool)"))`.
    uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =
        0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;

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

    /// @dev Thrown when a call for an NFT function did not originate
    /// from the base DN404 contract.
    error SenderNotBase();

    /// @dev Thrown when a call for an NFT function did not originate from the deployer.
    error SenderNotDeployer();

    /// @dev Thrown when transferring an NFT to a contract address that
    /// does not implement ERC721Receiver.
    error TransferToNonERC721ReceiverImplementer();

    /// @dev Thrown when linking to the DN404 base contract and the
    /// DN404 supportsInterface check fails or the call reverts.
    error CannotLink();

    /// @dev Thrown when a linkMirrorContract call is received and the
    /// NFT mirror contract has already been linked to a DN404 base contract.
    error AlreadyLinked();

    /// @dev Thrown when retrieving the base DN404 address when a link has not
    /// been established.
    error NotLinked();

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

    /// @dev Struct contain the NFT mirror contract storage.
    struct DN404NFTStorage {
        address baseERC20;
        address deployer;
    }

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

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                        CONSTRUCTOR                         */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    constructor(address deployer) {
        // For non-proxies, we will store the deployer so that only the deployer can
        // link the base contract.
        _getDN404NFTStorage().deployer = deployer;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     ERC721 OPERATIONS                      */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Returns the token collection name from the base DN404 contract.
    function name() public view virtual returns (string memory result) {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            mstore(0x00, 0x06fdde03) // `name()`.
            if iszero(staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x00)) {
                returndatacopy(result, 0x00, returndatasize())
                revert(result, returndatasize())
            }
            returndatacopy(0x00, 0x00, 0x20)
            returndatacopy(result, mload(0x00), 0x20)
            returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result))
            mstore(0x40, add(add(result, 0x20), mload(result)))
        }
    }

    /// @dev Returns the token collection symbol from the base DN404 contract.
    function symbol() public view virtual returns (string memory result) {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            mstore(0x00, 0x95d89b41) // `symbol()`.
            if iszero(staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x00)) {
                returndatacopy(result, 0x00, returndatasize())
                revert(result, returndatasize())
            }
            returndatacopy(0x00, 0x00, 0x20)
            returndatacopy(result, mload(0x00), 0x20)
            returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result))
            mstore(0x40, add(add(result, 0x20), mload(result)))
        }
    }

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id` from
    /// the base DN404 contract.
    function tokenURI(uint256 id) public view virtual returns (string memory result) {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            mstore(0x20, id)
            mstore(0x00, 0xc87b56dd) // `tokenURI()`.
            if iszero(staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x00)) {
                returndatacopy(result, 0x00, returndatasize())
                revert(result, returndatasize())
            }
            returndatacopy(0x00, 0x00, 0x20)
            returndatacopy(result, mload(0x00), 0x20)
            returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result))
            mstore(0x40, add(add(result, 0x20), mload(result)))
        }
    }

    /// @dev Returns the total NFT supply from the base DN404 contract.
    function totalSupply() public view virtual returns (uint256 result) {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0xe2c79281) // `totalNFTSupply()`.
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := mload(0x00)
        }
    }

    /// @dev Returns the number of NFT tokens owned by `owner` from the base DN404 contract.
    ///
    /// Requirements:
    /// - `owner` must not be the zero address.
    function balanceOf(address owner) public view virtual returns (uint256 result) {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, shr(96, shl(96, owner)))
            mstore(0x00, 0xf5b100ea) // `balanceOfNFT(address)`.
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := mload(0x00)
        }
    }

    /// @dev Returns the owner of token `id` from the base DN404 contract.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function ownerOf(uint256 id) public view virtual returns (address result) {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x6352211e) // `ownerOf(uint256)`.
            mstore(0x20, id)
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := shr(96, mload(0x0c))
        }
    }

    /// @dev Sets `spender` as the approved account to manage token `id` in
    /// the base DN404 contract.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    /// - The caller must be the owner of the token,
    ///   or an approved operator for the token owner.
    ///
    /// Emits an {Approval} event.
    function approve(address spender, uint256 id) public virtual {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            spender := shr(96, shl(96, spender))
            let m := mload(0x40)
            mstore(0x00, 0xd10b6e0c) // `approveNFT(address,uint256,address)`.
            mstore(0x20, spender)
            mstore(0x40, id)
            mstore(0x60, caller())
            if iszero(
                and(
                    gt(returndatasize(), 0x1f),
                    call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
            mstore(0x40, m) // Restore the free memory pointer.
            mstore(0x60, 0) // Restore the zero pointer.
            // Emit the {Approval} event.
            log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, shr(96, mload(0x0c)), spender, id)
        }
    }

    /// @dev Returns the account approved to manage token `id` from
    /// the base DN404 contract.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function getApproved(uint256 id) public view virtual returns (address result) {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x081812fc) // `getApproved(uint256)`.
            mstore(0x20, id)
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20))
            ) {
                returndatacopy(mload(0x40), 0x00, returndatasize())
                revert(mload(0x40), returndatasize())
            }
            result := shr(96, mload(0x0c))
        }
    }

    /// @dev Sets whether `operator` is approved to manage the tokens of the caller in
    /// the base DN404 contract.
    ///
    /// Emits an {ApprovalForAll} event.
    function setApprovalForAll(address operator, bool approved) public virtual {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            operator := shr(96, shl(96, operator))
            let m := mload(0x40)
            mstore(0x00, 0x813500fc) // `setApprovalForAll(address,bool,address)`.
            mstore(0x20, operator)
            mstore(0x40, iszero(iszero(approved)))
            mstore(0x60, caller())
            if iszero(
                and(eq(mload(0x00), 1), call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20))
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
            // Emit the {ApprovalForAll} event.
            log3(0x40, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), operator)
            mstore(0x40, m) // Restore the free memory pointer.
            mstore(0x60, 0) // Restore the zero pointer.
        }
    }

    /// @dev Returns whether `operator` is approved to manage the tokens of `owner` from
    /// the base DN404 contract.
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        returns (bool result)
    {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(0x40, operator)
            mstore(0x2c, shl(96, owner))
            mstore(0x0c, 0xe985e9c5000000000000000000000000) // `isApprovedForAll(address,address)`.
            if iszero(
                and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x44, 0x00, 0x20))
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
            mstore(0x40, m) // Restore the free memory pointer.
            result := iszero(iszero(mload(0x00)))
        }
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function transferFrom(address from, address to, uint256 id) public virtual {
        address base = baseERC20();
        /// @solidity memory-safe-assembly
        assembly {
            from := shr(96, shl(96, from))
            to := shr(96, shl(96, to))
            let m := mload(0x40)
            mstore(m, 0xe5eb36c8) // `transferFromNFT(address,address,uint256,address)`.
            mstore(add(m, 0x20), from)
            mstore(add(m, 0x40), to)
            mstore(add(m, 0x60), id)
            mstore(add(m, 0x80), caller())
            if iszero(
                and(eq(mload(m), 1), call(gas(), base, callvalue(), add(m, 0x1c), 0x84, m, 0x20))
            ) {
                returndatacopy(m, 0x00, returndatasize())
                revert(m, returndatasize())
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
        }
    }

    /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`.
    function safeTransferFrom(address from, address to, uint256 id) public payable virtual {
        transferFrom(from, to, id);

        if (_hasCode(to)) _checkOnERC721Received(from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    /// - If `to` refers to a smart contract, it must implement
    ///   {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    ///
    /// Emits a {Transfer} event.
    function safeTransferFrom(address from, address to, uint256 id, bytes calldata data)
        public
        virtual
    {
        transferFrom(from, to, id);

        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /// @dev Returns true if this contract implements the interface defined by `interfaceId`.
    /// See: https://eips.ethereum.org/EIPS/eip-165
    /// This function call must use less than 30000 gas.
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let s := shr(224, interfaceId)
            // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f.
            result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f))
        }
    }

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

    /// @dev Returns the address of the base DN404 contract.
    function baseERC20() public view virtual returns (address base) {
        base = _getDN404NFTStorage().baseERC20;
        if (base == address(0)) revert NotLinked();
    }

    /// @dev Fallback modifier to execute calls from the base DN404 contract.
    modifier dn404NFTFallback() virtual {
        DN404NFTStorage storage $ = _getDN404NFTStorage();

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

        // `logTransfer(uint256[])`.
        if (fnSelector == 0x263c69d6) {
            if (msg.sender != $.baseERC20) revert SenderNotBase();
            /// @solidity memory-safe-assembly
            assembly {
                // When returndatacopy copies 1 or more out-of-bounds bytes, it reverts.
                returndatacopy(0x00, returndatasize(), lt(calldatasize(), 0x20))
                let o := add(0x24, calldataload(0x04)) // Packed logs offset.
                returndatacopy(0x00, returndatasize(), lt(calldatasize(), o))
                let end := add(o, shl(5, calldataload(sub(o, 0x20))))
                returndatacopy(0x00, returndatasize(), lt(calldatasize(), end))

                for {} iszero(eq(o, end)) { o := add(0x20, o) } {
                    let d := calldataload(o) // Entry in the packed logs.
                    let a := shr(96, d) // The address.
                    let b := and(1, d) // Whether it is a burn.
                    log4(
                        codesize(),
                        0x00,
                        _TRANSFER_EVENT_SIGNATURE,
                        mul(a, b),
                        mul(a, iszero(b)),
                        shr(168, shl(160, d))
                    )
                }
                mstore(0x00, 0x01)
                return(0x00, 0x20)
            }
        }
        // `linkMirrorContract(address)`.
        if (fnSelector == 0x0f4599e5) {
            if ($.deployer != address(0)) {
                if (address(uint160(_calldataload(0x04))) != $.deployer) {
                    revert SenderNotDeployer();
                }
            }
            if ($.baseERC20 != address(0)) revert AlreadyLinked();
            $.baseERC20 = msg.sender;
            /// @solidity memory-safe-assembly
            assembly {
                mstore(0x00, 0x01)
                return(0x00, 0x20)
            }
        }
        _;
    }

    /// @dev Fallback function for calls from base DN404 contract.
    fallback() external payable virtual dn404NFTFallback {}

    receive() external payable virtual {}

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

    /// @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 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 Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`.
    /// Reverts if the target does not support the function correctly.
    function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data)
        private
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the calldata.
            let m := mload(0x40)
            let onERC721ReceivedSelector := 0x150b7a02
            mstore(m, onERC721ReceivedSelector)
            mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`.
            mstore(add(m, 0x40), shr(96, shl(96, from)))
            mstore(add(m, 0x60), id)
            mstore(add(m, 0x80), 0x80)
            let n := mload(data)
            mstore(add(m, 0xa0), n)
            if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) }
            // Revert if the call reverts.
            if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) {
                if returndatasize() {
                    // Bubble up the revert if the call reverts.
                    returndatacopy(m, 0x00, returndatasize())
                    revert(m, returndatasize())
                }
            }
            // Load the returndata and compare it.
            if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) {
                mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`.
                revert(0x1c, 0x04)
            }
        }
    }
}

File 7 of 11 : DN404Reflect.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./DN404Mirror.sol";

/// @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 DN404Reflect {
    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                           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);

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                        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 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 an non-existent NFT.
    error TokenDoesNotExist();

    /// @dev Amount of token balance that is equal to one NFT.
    uint256 internal _WAD;

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

    /// @dev The maximum token ID allowed for an NFT.
    uint256 internal constant _MAX_TOKEN_ID = 0xffffffff;

    /// @dev The maximum possible token supply.
    uint256 internal constant _MAX_SUPPLY = 10 ** 18 * 0xffffffff - 1;

    /// @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;

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                          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;
        // tTotal for reflections
        uint256 tOwned;
        // rTotal for reflections
        uint256 rOwned;
        // Excluded from reflections
        bool isExcluded;
    }

    /// @dev A uint32 map in storage.
    struct Uint32Map {
        mapping(uint256 => uint256) map;
    }

    /// @dev Struct containing the base token contract storage.
    struct DN404Storage {
        // Current number of address aliases assigned.
        uint32 numAliases;
        // Next token ID to assign for an NFT mint.
        uint32 nextTokenId;
        // Total supply of minted NFTs.
        uint32 totalNFTSupply;
        // Total supply of tokens.
        uint96 totalSupply;
        // Total supply of tokens
        uint256 tTotal;
        // Reflections remaining
        uint256 rTotal;
        // Total transaction fees
        uint256 tFeeTotal;
        // Tax Fee (as percentage)
        uint256 taxFee;
        // 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.
        mapping(address => mapping(address => bool)) operatorApprovals;
        // Mapping of NFT token approvals to approved operators.
        mapping(uint256 => address) tokenApprovals;
        // Mapping of user allowances for token spenders.
        mapping(address => mapping(address => uint256)) allowance;
        // Mapping of NFT token IDs owned by an address.
        mapping(address => Uint32Map) owned;
        // Even indices: owner aliases. Odd indices: owned indices.
        Uint32Map oo;
        // Mapping of user account AddressData
        mapping(address => AddressData) addressData;
        // array of excluded addresses
        address[] excluded;
        // Determines whether setTaxFee and ExcludeAccount can be called
        bool functionsRenounced;
        // Opens transfers for everyone
        bool tradingEnabled;
    }

    /// @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 _initializeDN404Reflect(
        uint256 initialTokenSupply,
        address initialSupplyOwner,
        address mirror,
        uint256 wad
    ) internal virtual {
        DN404Storage storage $ = _getDN404Storage();

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

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

        $.nextTokenId = 1;
        $.mirrorERC721 = mirror;
        _WAD = wad;
        if (initialTokenSupply > 0) {
            if (initialSupplyOwner == address(0))
                revert TransferToZeroAddress();
            if (initialTokenSupply > _MAX_SUPPLY) revert TotalSupplyOverflow();

            $.totalSupply = uint96(initialTokenSupply);
            $.tTotal = initialTokenSupply;
            uint256 MAX = ~uint256(0);
            $.rTotal = (MAX - (MAX % $.tTotal));
            AddressData storage initialOwnerAddressData = _addressData(
                initialSupplyOwner
            );
            initialOwnerAddressData.balance = uint96(initialTokenSupply);
            initialOwnerAddressData.rOwned = $.rTotal;

            emit Transfer(address(0), initialSupplyOwner, initialTokenSupply);

            _setSkipNFT(initialSupplyOwner, true);
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*               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 result);

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                      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`
    ///      Updated for reflections logic
    function balanceOf(address owner) public view virtual returns (uint256) {
        AddressData storage ownerAddressData = _getDN404Storage().addressData[
            owner
        ];
        if (ownerAddressData.isExcluded) return ownerAddressData.tOwned;
        return tokenFromReflection(ownerAddressData.rOwned);
    }

    /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`.
    function allowance(
        address owner,
        address spender
    ) public view returns (uint256) {
        return _getDN404Storage().allowance[owner][spender];
    }

    /// @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) {
        DN404Storage storage $ = _getDN404Storage();

        $.allowance[msg.sender][spender] = amount;

        emit Approval(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) {
        DN404Storage storage $ = _getDN404Storage();
        uint256 allowed = $.allowance[from][msg.sender];

        if (allowed != type(uint256).max) {
            if (amount > allowed) revert InsufficientAllowance();
            unchecked {
                $.allowance[from][msg.sender] = allowed - amount;
            }
        }

        _transfer(from, to, amount);

        return true;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                   REFLECTION OPERATIONS                    */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev reflects sender's wallet
    function reflect(uint256 tAmount) public {
        DN404Storage storage $ = _getDN404Storage();
        address sender = msg.sender;
        AddressData storage senderAddressData = _addressData(sender);
        require(
            !senderAddressData.isExcluded,
            "Excluded addresses cannot call this function"
        );
        (uint256 rAmount, , , , ) = _getValues(tAmount);
        senderAddressData.rOwned = senderAddressData.rOwned - rAmount;
        $.rTotal = $.rTotal - rAmount;
        $.tFeeTotal = $.tFeeTotal + tAmount;
    }
    /// @dev returns rAmount from amount of tokens
    function reflectionFromToken(
        uint256 tAmount,
        bool deductTransferFee
    ) public view returns (uint256) {
        require(
            tAmount <= _getDN404Storage().tTotal,
            "Amount must be less than supply"
        );
        if (!deductTransferFee) {
            (uint256 rAmount, , , , ) = _getValues(tAmount);
            return rAmount;
        } else {
            (, uint256 rTransferAmount, , , ) = _getValues(tAmount);
            return rTransferAmount;
        }
    }

    ///@dev returns token amount from rTotal (used for balanceOf)
    function tokenFromReflection(
        uint256 rAmount
    ) public view returns (uint256) {
        require(
            rAmount <= _getDN404Storage().rTotal,
            "Amount must be less than total reflections"
        );
        uint256 currentRate = _getRate();
        return rAmount / currentRate;
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                  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();

        DN404Storage storage $ = _getDN404Storage();

        AddressData storage toAddressData = _addressData(to);

        unchecked {
            uint256 currentTokenSupply = uint256($.totalSupply) + amount;
            if (amount > _MAX_SUPPLY || currentTokenSupply > _MAX_SUPPLY) {
                revert TotalSupplyOverflow();
            }
            $.totalSupply = uint96(currentTokenSupply);

            uint256 toBalance = toAddressData.balance + amount;
            toAddressData.balance = uint96(toBalance);

            if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) {
                Uint32Map storage toOwned = $.owned[to];
                uint256 toIndex = toAddressData.ownedLength;
                uint256 toEnd = toBalance / _WAD;
                _PackedLogs memory packedLogs = _packedLogsMalloc(
                    _zeroFloorSub(toEnd, toIndex)
                );

                if (packedLogs.logs.length != 0) {
                    uint256 maxNFTId = $.totalSupply / _WAD;
                    uint32 toAlias = _registerAndResolveAlias(
                        toAddressData,
                        to
                    );
                    uint256 id = $.nextTokenId;
                    $.totalNFTSupply += uint32(packedLogs.logs.length);
                    toAddressData.ownedLength = uint32(toEnd);
                    // Mint loop.
                    do {
                        while (_get($.oo, _ownershipIndex(id)) != 0) {
                            if (++id > maxNFTId) id = 1;
                        }
                        _set(toOwned, toIndex, uint32(id));
                        _setOwnerAliasAndOwnedIndex(
                            $.oo,
                            id,
                            toAlias,
                            uint32(toIndex++)
                        );
                        _packedLogsAppend(packedLogs, to, id, 0);
                        if (++id > maxNFTId) id = 1;
                    } while (toIndex != toEnd);
                    $.nextTokenId = uint32(id);
                    _packedLogsSend(packedLogs, $.mirrorERC721);
                }
            }
        }
        emit Transfer(address(0), to, amount);
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                  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 {
        DN404Storage storage $ = _getDN404Storage();

        AddressData storage fromAddressData = _addressData(from);

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

        uint256 currentTokenSupply = $.totalSupply;

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

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

            if (nftAmountToBurn != 0) {
                $.totalNFTSupply -= uint32(nftAmountToBurn);

                _PackedLogs memory packedLogs = _packedLogsMalloc(
                    nftAmountToBurn
                );

                uint256 fromEnd = fromIndex - nftAmountToBurn;
                // Burn loop.
                do {
                    uint256 id = _get(fromOwned, --fromIndex);
                    _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0);
                    delete $.tokenApprovals[id];
                    _packedLogsAppend(packedLogs, from, id, 1);
                } while (fromIndex != fromEnd);

                fromAddressData.ownedLength = uint32(fromIndex);
                _packedLogsSend(packedLogs, $.mirrorERC721);
            }
        }
        emit Transfer(from, address(0), amount);
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                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.
    // @TODO Focus here 
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        if (to == address(0)) revert TransferToZeroAddress();
        require(from != to, "Cannot transfer to self");

        DN404Storage storage $ = _getDN404Storage();

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

        _TransferTemps memory t;
        t.fromOwnedLength = fromAddressData.ownedLength;
        t.toOwnedLength = toAddressData.ownedLength;
        
        if (amount > balanceOf(from)) revert InsufficientBalance();

        unchecked {
            // Reflections transfer logic
            (
                uint256 rAmount,
                uint256 rTransferAmount,
                uint256 rFee,
                uint256 tTransferAmount,
                uint256 tFee
            ) = _getValues(amount);
  
            // Transfer from excluded address
            if (fromAddressData.isExcluded && !toAddressData.isExcluded) {
                fromAddressData.tOwned = fromAddressData.tOwned - amount;
                fromAddressData.rOwned = fromAddressData.rOwned - rAmount;
                toAddressData.rOwned = toAddressData.rOwned + rTransferAmount;
                fromAddressData.balance = uint96(fromAddressData.tOwned);
                toAddressData.balance = uint96(tokenFromReflection(toAddressData.rOwned));
            }
            // Transfer to excluded address
            else if (!fromAddressData.isExcluded && toAddressData.isExcluded) {
                fromAddressData.rOwned = fromAddressData.rOwned - rAmount;
                toAddressData.rOwned = toAddressData.rOwned + rTransferAmount;
                toAddressData.tOwned = toAddressData.tOwned + tTransferAmount;
                fromAddressData.balance = uint96(tokenFromReflection(fromAddressData.rOwned));
                toAddressData.balance = uint96(toAddressData.tOwned);
            }
            // Transfer between non-excluded addresses
            else if (!fromAddressData.isExcluded && !toAddressData.isExcluded) {
                fromAddressData.rOwned = fromAddressData.rOwned - rAmount;
                toAddressData.rOwned = toAddressData.rOwned + rTransferAmount;
                fromAddressData.balance = uint96(tokenFromReflection(fromAddressData.rOwned));
                toAddressData.balance = uint96(tokenFromReflection(toAddressData.rOwned));
            }
            // Transfer between both excluded addresses
            else if (fromAddressData.isExcluded && toAddressData.isExcluded) {
                fromAddressData.tOwned = fromAddressData.tOwned - amount;
                fromAddressData.rOwned = fromAddressData.rOwned - rAmount;
                toAddressData.rOwned = toAddressData.rOwned + rTransferAmount; 
                toAddressData.tOwned = toAddressData.tOwned + tTransferAmount;
                fromAddressData.balance = uint96(fromAddressData.tOwned);
                toAddressData.balance = uint96(toAddressData.tOwned);
            } 

            _reflectFee(rFee, tFee);

            t.nftAmountToBurn = _zeroFloorSub(
                t.fromOwnedLength,
                fromAddressData.balance / _WAD
            );

            if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) {
                if (from == to)
                    t.toOwnedLength = t.fromOwnedLength - t.nftAmountToBurn;
                t.nftAmountToMint = _zeroFloorSub(
                    toAddressData.balance / _WAD,
                    t.toOwnedLength
                );
            }

            _PackedLogs memory packedLogs = _packedLogsMalloc(
                t.nftAmountToBurn + t.nftAmountToMint
            );

            if (t.nftAmountToBurn != 0) {
                Uint32Map storage fromOwned = $.owned[from];
                uint256 fromIndex = t.fromOwnedLength;
                uint256 fromEnd = fromIndex - t.nftAmountToBurn;
                $.totalNFTSupply -= uint32(t.nftAmountToBurn);
                fromAddressData.ownedLength = uint32(fromEnd);
                // Burn loop.
                do {
                    uint256 id = _get(fromOwned, --fromIndex);
                    _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0);
                    delete $.tokenApprovals[id];
                    _packedLogsAppend(packedLogs, from, id, 1);
                } while (fromIndex != fromEnd);
            }

            if (t.nftAmountToMint != 0) {
                Uint32Map storage toOwned = $.owned[to];
                uint256 toIndex = t.toOwnedLength;
                uint256 toEnd = toIndex + t.nftAmountToMint;
                uint32 toAlias = _registerAndResolveAlias(toAddressData, to);
                uint256 maxNFTId = $.totalSupply / _WAD;
                uint256 id = $.nextTokenId;
                $.totalNFTSupply += uint32(t.nftAmountToMint);
                toAddressData.ownedLength = uint32(toEnd);
                // Mint loop.
                do {
                    while (_get($.oo, _ownershipIndex(id)) != 0) {
                        if (++id > maxNFTId) id = 1;
                    }
                    _set(toOwned, toIndex, uint32(id));
                    _setOwnerAliasAndOwnedIndex(
                        $.oo,
                        id,
                        toAlias,
                        uint32(toIndex++)
                    );
                    _packedLogsAppend(packedLogs, to, id, 0);
                    if (++id > maxNFTId) id = 1;
                } while (toIndex != toEnd);
                $.nextTokenId = uint32(id);
            }

            if (packedLogs.logs.length != 0) {
                _packedLogsSend(packedLogs, $.mirrorERC721);
            }
        }
        emit Transfer(from, to, amount);
    }

    /// @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();
        require(to != from, "Cannot transfer to self");

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

        if (from != owner) revert TransferFromIncorrectOwner();

        if (msgSender != from) {
            if (!$.operatorApprovals[from][msgSender]) {
                if (msgSender != $.tokenApprovals[id]) {
                    revert TransferCallerNotOwnerNorApproved();
                }
            }
        }

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

        // Transfer without taking reflection fee
        (uint256 rAmount, , , , ) = _getValues(_WAD);
        if (fromAddressData.isExcluded) {
            fromAddressData.tOwned -= _WAD;
        }
        if (toAddressData.isExcluded) {
            toAddressData.tOwned += _WAD;
        }
        fromAddressData.rOwned -= rAmount;
        fromAddressData.balance -= uint96(_WAD);

        unchecked {
            toAddressData.balance += uint96(_WAD);
            toAddressData.rOwned += rAmount;

            _set(
                $.oo,
                _ownershipIndex(id),
                _registerAndResolveAlias(toAddressData, to)
            );
            delete $.tokenApprovals[id];

            uint256 updatedId = _get(
                $.owned[from],
                --fromAddressData.ownedLength
            );
            _set($.owned[from], _get($.oo, _ownedIndex(id)), uint32(updatedId));

            uint256 n = toAddressData.ownedLength++;
            _set($.oo, _ownedIndex(updatedId), _get($.oo, _ownedIndex(id)));
            _set($.owned[to], n, uint32(id));
            _set($.oo, _ownedIndex(id), uint32(n));
        }
    
        emit Transfer(from, to, _WAD);
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                 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 account `a` will skip NFT minting on token mints and transfers.
    /// Returns false if account `a` will mint NFTs on token mints and transfers.
    function getSkipNFT(address a) public view virtual returns (bool) {
        AddressData storage d = _getDN404Storage().addressData[a];
        if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) return _hasCode(a);
        return d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0;
    }

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

    /// @dev Internal function to set account `a` skipNFT flag to `state`
    ///
    /// Initializes account `a` AddressData if it is not currently initialized.
    ///
    /// Emits a {SkipNFTSet} event.
    function _setSkipNFT(address a, bool state) internal virtual {
        AddressData storage d = _addressData(a);
        if ((d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0) != state) {
            d.flags ^= _ADDRESS_DATA_SKIP_NFT_FLAG;
        }
        emit SkipNFTSet(a, state);
    }

    /// @dev Returns a storage data pointer for account `a` AddressData
    ///
    /// Initializes account `a` AddressData if it is not currently initialized.
    function _addressData(
        address a
    ) internal virtual returns (AddressData storage d) {
        DN404Storage storage $ = _getDN404Storage();
        d = $.addressData[a];

        if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) {
            uint8 flags = _ADDRESS_DATA_INITIALIZED_FLAG;
            if (_hasCode(a)) flags |= _ADDRESS_DATA_SKIP_NFT_FLAG;
            d.flags = flags;
        }
    }

    /// @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) {
            addressAlias = ++$.numAliases;
            toAddressData.addressAlias = addressAlias;
            $.aliasToAddress[addressAlias] = to;
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     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(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().tokenApprovals[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) {
        DN404Storage storage $ = _getDN404Storage();

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

        if (msgSender != owner) {
            if (!$.operatorApprovals[owner][msgSender]) {
                revert ApprovalCallerNotOwnerNorApproved();
            }
        }

        $.tokenApprovals[id] = spender;

        return owner;
    }

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

    /// @dev Calls the mirror contract to link it to this contract.
    ///
    /// Reverts if the call to the mirror contract reverts.
    function _linkMirrorContract(address mirror) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            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)
            }
        }
    }

    /// @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;

        // `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($.operatorApprovals[owner][operator] ? 1 : 0);
        }
        // `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)));
        }
        // `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);
        }
        // `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.
    fallback() external payable virtual dn404Fallback {}

    receive() external payable virtual {}

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

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

    /// @dev Initiates memory allocation for packed logs with `n` log items.
    function _packedLogsMalloc(
        uint256 n
    ) private pure returns (_PackedLogs memory p) {
        /// @solidity memory-safe-assembly
        assembly {
            let logs := add(mload(0x40), 0x40) // Offset by 2 words for `_packedLogsSend`.
            mstore(logs, n)
            let offset := add(0x20, logs)
            mstore(0x40, add(offset, shl(5, n)))
            mstore(p, logs)
            mstore(add(0x20, p), offset)
        }
    }

    /// @dev Adds a packed log item to `p` with address `a`, token `id` and burn flag `burnBit`.
    function _packedLogsAppend(
        _PackedLogs memory p,
        address a,
        uint256 id,
        uint256 burnBit
    ) private pure {
        /// @solidity memory-safe-assembly
        assembly {
            let offset := mload(add(0x20, p))
            mstore(offset, or(or(shl(96, a), shl(8, id)), burnBit))
            mstore(add(0x20, p), add(offset, 0x20))
        }
    }

    /// @dev Calls the `mirror` NFT contract to emit Transfer events for packed logs `p`.
    function _packedLogsSend(_PackedLogs memory p, address mirror) private {
        /// @solidity memory-safe-assembly
        assembly {
            let logs := mload(p)
            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 _TransferTemps {
        uint256 nftAmountToBurn;
        uint256 nftAmountToMint;
        uint256 fromBalance;
        uint256 toBalance;
        uint256 fromOwnedLength;
        uint256 toOwnedLength;
    }

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

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

    /// @dev Returns `i << 1`.
    function _ownershipIndex(uint256 i) private pure returns (uint256) {
        return i << 1;
    }

    /// @dev Returns `(i << 1) + 1`.
    function _ownedIndex(uint256 i) private pure returns (uint256) {
        unchecked {
            return (i << 1) + 1;
        }
    }

    /// @dev Returns the uint32 value at `index` in `map`.
    function _get(
        Uint32Map storage map,
        uint256 index
    ) private view returns (uint32 result) {
        result = uint32(map.map[index >> 3] >> ((index & 7) << 5));
    }

    /// @dev Updates the uint32 value at `index` in `map`.
    function _set(Uint32Map storage map, uint256 index, uint32 value) private {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, map.slot)
            mstore(0x00, shr(3, index))
            let s := keccak256(0x00, 0x40) // 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
    ) private {
        /// @solidity memory-safe-assembly
        assembly {
            let value := or(shl(32, ownedIndex), and(0xffffffff, ownership))
            mstore(0x20, map.slot)
            mstore(0x00, shr(2, id))
            let s := keccak256(0x00, 0x40) // Storage slot.
            let o := shl(6, and(id, 3)) // Storage slot offset (bits).
            let v := sload(s) // Storage slot value.
            let m := 0xffffffffffffffff // Value mask.
            sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value)))))
        }
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*              PRIVATE FUNCTIONS FOR REFLECTIONS             */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/

    /// @dev Reflects fee to all holders
    function _reflectFee(uint256 rFee, uint256 tFee) private {
        DN404Storage storage $ = _getDN404Storage();
        $.rTotal = $.rTotal - rFee;
        $.tFeeTotal = $.tFeeTotal + tFee;
    }

    function _getValues(
        uint256 tAmount
    ) private view returns (uint256, uint256, uint256, uint256, uint256) {
        (uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
        uint256 currentRate = _getRate();
        (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
            tAmount,
            tFee,
            currentRate
        );
        return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
    }

    function _getTValues(
        uint256 tAmount
    ) private view returns (uint256, uint256) {
        uint256 tFee = _calculateTaxFee(tAmount);
        uint256 tTransferAmount = tAmount - tFee;
        return (tTransferAmount, tFee);
    }

    function _getRValues(
        uint256 tAmount,
        uint256 tFee,
        uint256 currentRate
    ) private pure returns (uint256, uint256, uint256) {
        uint256 rAmount = tAmount * currentRate;
        uint256 rFee = tFee * currentRate;
        uint256 rTransferAmount = rAmount - rFee;
        return (rAmount, rTransferAmount, rFee);
    }

    function _getRate() private view returns (uint256) {
        (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
        return (rSupply / tSupply);
    }

    /// @dev returns current supply in terms of 'r' and 't'
    function _getCurrentSupply() private view returns (uint256, uint256) {
        DN404Storage storage $ = _getDN404Storage();
        uint256 rSupply = $.rTotal;
        uint256 tSupply = $.tTotal;
        for (uint256 i = 0; i < $.excluded.length; i++) {
            AddressData storage excludedAddressData = $.addressData[
                $.excluded[i]
            ];

            if (
                excludedAddressData.rOwned > rSupply ||
                excludedAddressData.tOwned > tSupply
            ) return ($.rTotal, $.tTotal);
            rSupply = rSupply - excludedAddressData.rOwned;
            tSupply = tSupply - excludedAddressData.tOwned;
        }
        if (rSupply < $.rTotal / $.tTotal) return ($.rTotal, $.tTotal);
        return (rSupply, tSupply);
    }

    /// @dev returns the total reflected tokens
    function getTotalReflections() public view returns (uint256) {
        return _getDN404Storage().tFeeTotal;
    }

    function _calculateTaxFee(uint256 amount) private view returns (uint256) {
        return (amount * _getDN404Storage().taxFee) / (10 ** 3);
    }

    /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/
    /*                     ACCESS FUNCTIONS                       */
    /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/
}

File 8 of 11 : 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 9 of 11 : OwnableRoles.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

/// @notice Simple single owner and multiroles authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
/// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173)
/// for compatibility, the nomenclature for the 2-step ownership handover and roles
/// may be unique to this codebase.
abstract contract OwnableRoles is Ownable {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The `user`'s roles is updated to `roles`.
    /// Each bit of `roles` represents whether the role is set.
    event RolesUpdated(address indexed user, uint256 indexed roles);

    /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`.
    uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE =
        0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26;

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

    /// @dev The role slot of `user` is given by:
    /// ```
    ///     mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED))
    ///     let roleSlot := keccak256(0x00, 0x20)
    /// ```
    /// This automatically ignores the upper bits of the `user` in case
    /// they are not clean, as well as keep the `keccak256` under 32-bytes.
    ///
    /// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`.
    uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;

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

    /// @dev Overwrite the roles directly without authorization guard.
    function _setRoles(address user, uint256 roles) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, user)
            // Store the new value.
            sstore(keccak256(0x0c, 0x20), roles)
            // Emit the {RolesUpdated} event.
            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
        }
    }

    /// @dev Updates the roles directly without authorization guard.
    /// If `on` is true, each set bit of `roles` will be turned on,
    /// otherwise, each set bit of `roles` will be turned off.
    function _updateRoles(address user, uint256 roles, bool on) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, user)
            let roleSlot := keccak256(0x0c, 0x20)
            // Load the current value.
            let current := sload(roleSlot)
            // Compute the updated roles if `on` is true.
            let updated := or(current, roles)
            // Compute the updated roles if `on` is false.
            // Use `and` to compute the intersection of `current` and `roles`,
            // `xor` it with `current` to flip the bits in the intersection.
            if iszero(on) { updated := xor(current, and(current, roles)) }
            // Then, store the new value.
            sstore(roleSlot, updated)
            // Emit the {RolesUpdated} event.
            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated)
        }
    }

    /// @dev Grants the roles directly without authorization guard.
    /// Each bit of `roles` represents the role to turn on.
    function _grantRoles(address user, uint256 roles) internal virtual {
        _updateRoles(user, roles, true);
    }

    /// @dev Removes the roles directly without authorization guard.
    /// Each bit of `roles` represents the role to turn off.
    function _removeRoles(address user, uint256 roles) internal virtual {
        _updateRoles(user, roles, false);
    }

    /// @dev Throws if the sender does not have any of the `roles`.
    function _checkRoles(uint256 roles) internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, caller())
            // Load the stored value, and if the `and` intersection
            // of the value and `roles` is zero, revert.
            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Throws if the sender is not the owner,
    /// and does not have any of the `roles`.
    /// Checks for ownership first, then lazily checks for roles.
    function _checkOwnerOrRoles(uint256 roles) internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // If the caller is not the stored owner.
            // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
            if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                // Compute the role slot.
                mstore(0x0c, _ROLE_SLOT_SEED)
                mstore(0x00, caller())
                // Load the stored value, and if the `and` intersection
                // of the value and `roles` is zero, revert.
                if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                    mstore(0x00, 0x82b42900) // `Unauthorized()`.
                    revert(0x1c, 0x04)
                }
            }
        }
    }

    /// @dev Throws if the sender does not have any of the `roles`,
    /// and is not the owner.
    /// Checks for roles first, then lazily checks for ownership.
    function _checkRolesOrOwner(uint256 roles) internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, caller())
            // Load the stored value, and if the `and` intersection
            // of the value and `roles` is zero, revert.
            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                // If the caller is not the stored owner.
                // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
                if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                    mstore(0x00, 0x82b42900) // `Unauthorized()`.
                    revert(0x1c, 0x04)
                }
            }
        }
    }

    /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`.
    /// This is meant for frontends like Etherscan, and is therefore not fully optimized.
    /// Not recommended to be called on-chain.
    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
    function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) {
        /// @solidity memory-safe-assembly
        assembly {
            for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } {
                // We don't need to mask the values of `ordinals`, as Solidity
                // cleans dirty upper bits when storing variables into memory.
                roles := or(shl(mload(add(ordinals, i)), 1), roles)
            }
        }
    }

    /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap.
    /// This is meant for frontends like Etherscan, and is therefore not fully optimized.
    /// Not recommended to be called on-chain.
    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
    function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) {
        /// @solidity memory-safe-assembly
        assembly {
            // Grab the pointer to the free memory.
            ordinals := mload(0x40)
            let ptr := add(ordinals, 0x20)
            let o := 0
            // The absence of lookup tables, De Bruijn, etc., here is intentional for
            // smaller bytecode, as this function is not meant to be called on-chain.
            for { let t := roles } 1 {} {
                mstore(ptr, o)
                // `shr` 5 is equivalent to multiplying by 0x20.
                // Push back into the ordinals array if the bit is set.
                ptr := add(ptr, shl(5, and(t, 1)))
                o := add(o, 1)
                t := shr(o, roles)
                if iszero(t) { break }
            }
            // Store the length of `ordinals`.
            mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20))))
            // Allocate the memory.
            mstore(0x40, ptr)
        }
    }

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

    /// @dev Allows the owner to grant `user` `roles`.
    /// If the `user` already has a role, then it will be an no-op for the role.
    function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
        _grantRoles(user, roles);
    }

    /// @dev Allows the owner to remove `user` `roles`.
    /// If the `user` does not have a role, then it will be an no-op for the role.
    function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
        _removeRoles(user, roles);
    }

    /// @dev Allow the caller to remove their own roles.
    /// If the caller does not have a role, then it will be an no-op for the role.
    function renounceRoles(uint256 roles) public payable virtual {
        _removeRoles(msg.sender, roles);
    }

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

    /// @dev Returns the roles of `user`.
    function rolesOf(address user) public view virtual returns (uint256 roles) {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, user)
            // Load the stored value.
            roles := sload(keccak256(0x0c, 0x20))
        }
    }

    /// @dev Returns whether `user` has any of `roles`.
    function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) {
        return rolesOf(user) & roles != 0;
    }

    /// @dev Returns whether `user` has all of `roles`.
    function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) {
        return rolesOf(user) & roles == roles;
    }

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

    /// @dev Marks a function as only callable by an account with `roles`.
    modifier onlyRoles(uint256 roles) virtual {
        _checkRoles(roles);
        _;
    }

    /// @dev Marks a function as only callable by the owner or by an account
    /// with `roles`. Checks for ownership first, then lazily checks for roles.
    modifier onlyOwnerOrRoles(uint256 roles) virtual {
        _checkOwnerOrRoles(roles);
        _;
    }

    /// @dev Marks a function as only callable by an account with `roles`
    /// or the owner. Checks for roles first, then lazily checks for ownership.
    modifier onlyRolesOrOwner(uint256 roles) virtual {
        _checkRolesOrOwner(roles);
        _;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       ROLE CONSTANTS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // IYKYK

    uint256 internal constant _ROLE_0 = 1 << 0;
    uint256 internal constant _ROLE_1 = 1 << 1;
    uint256 internal constant _ROLE_2 = 1 << 2;
    uint256 internal constant _ROLE_3 = 1 << 3;
    uint256 internal constant _ROLE_4 = 1 << 4;
    uint256 internal constant _ROLE_5 = 1 << 5;
    uint256 internal constant _ROLE_6 = 1 << 6;
    uint256 internal constant _ROLE_7 = 1 << 7;
    uint256 internal constant _ROLE_8 = 1 << 8;
    uint256 internal constant _ROLE_9 = 1 << 9;
    uint256 internal constant _ROLE_10 = 1 << 10;
    uint256 internal constant _ROLE_11 = 1 << 11;
    uint256 internal constant _ROLE_12 = 1 << 12;
    uint256 internal constant _ROLE_13 = 1 << 13;
    uint256 internal constant _ROLE_14 = 1 << 14;
    uint256 internal constant _ROLE_15 = 1 << 15;
    uint256 internal constant _ROLE_16 = 1 << 16;
    uint256 internal constant _ROLE_17 = 1 << 17;
    uint256 internal constant _ROLE_18 = 1 << 18;
    uint256 internal constant _ROLE_19 = 1 << 19;
    uint256 internal constant _ROLE_20 = 1 << 20;
    uint256 internal constant _ROLE_21 = 1 << 21;
    uint256 internal constant _ROLE_22 = 1 << 22;
    uint256 internal constant _ROLE_23 = 1 << 23;
    uint256 internal constant _ROLE_24 = 1 << 24;
    uint256 internal constant _ROLE_25 = 1 << 25;
    uint256 internal constant _ROLE_26 = 1 << 26;
    uint256 internal constant _ROLE_27 = 1 << 27;
    uint256 internal constant _ROLE_28 = 1 << 28;
    uint256 internal constant _ROLE_29 = 1 << 29;
    uint256 internal constant _ROLE_30 = 1 << 30;
    uint256 internal constant _ROLE_31 = 1 << 31;
    uint256 internal constant _ROLE_32 = 1 << 32;
    uint256 internal constant _ROLE_33 = 1 << 33;
    uint256 internal constant _ROLE_34 = 1 << 34;
    uint256 internal constant _ROLE_35 = 1 << 35;
    uint256 internal constant _ROLE_36 = 1 << 36;
    uint256 internal constant _ROLE_37 = 1 << 37;
    uint256 internal constant _ROLE_38 = 1 << 38;
    uint256 internal constant _ROLE_39 = 1 << 39;
    uint256 internal constant _ROLE_40 = 1 << 40;
    uint256 internal constant _ROLE_41 = 1 << 41;
    uint256 internal constant _ROLE_42 = 1 << 42;
    uint256 internal constant _ROLE_43 = 1 << 43;
    uint256 internal constant _ROLE_44 = 1 << 44;
    uint256 internal constant _ROLE_45 = 1 << 45;
    uint256 internal constant _ROLE_46 = 1 << 46;
    uint256 internal constant _ROLE_47 = 1 << 47;
    uint256 internal constant _ROLE_48 = 1 << 48;
    uint256 internal constant _ROLE_49 = 1 << 49;
    uint256 internal constant _ROLE_50 = 1 << 50;
    uint256 internal constant _ROLE_51 = 1 << 51;
    uint256 internal constant _ROLE_52 = 1 << 52;
    uint256 internal constant _ROLE_53 = 1 << 53;
    uint256 internal constant _ROLE_54 = 1 << 54;
    uint256 internal constant _ROLE_55 = 1 << 55;
    uint256 internal constant _ROLE_56 = 1 << 56;
    uint256 internal constant _ROLE_57 = 1 << 57;
    uint256 internal constant _ROLE_58 = 1 << 58;
    uint256 internal constant _ROLE_59 = 1 << 59;
    uint256 internal constant _ROLE_60 = 1 << 60;
    uint256 internal constant _ROLE_61 = 1 << 61;
    uint256 internal constant _ROLE_62 = 1 << 62;
    uint256 internal constant _ROLE_63 = 1 << 63;
    uint256 internal constant _ROLE_64 = 1 << 64;
    uint256 internal constant _ROLE_65 = 1 << 65;
    uint256 internal constant _ROLE_66 = 1 << 66;
    uint256 internal constant _ROLE_67 = 1 << 67;
    uint256 internal constant _ROLE_68 = 1 << 68;
    uint256 internal constant _ROLE_69 = 1 << 69;
    uint256 internal constant _ROLE_70 = 1 << 70;
    uint256 internal constant _ROLE_71 = 1 << 71;
    uint256 internal constant _ROLE_72 = 1 << 72;
    uint256 internal constant _ROLE_73 = 1 << 73;
    uint256 internal constant _ROLE_74 = 1 << 74;
    uint256 internal constant _ROLE_75 = 1 << 75;
    uint256 internal constant _ROLE_76 = 1 << 76;
    uint256 internal constant _ROLE_77 = 1 << 77;
    uint256 internal constant _ROLE_78 = 1 << 78;
    uint256 internal constant _ROLE_79 = 1 << 79;
    uint256 internal constant _ROLE_80 = 1 << 80;
    uint256 internal constant _ROLE_81 = 1 << 81;
    uint256 internal constant _ROLE_82 = 1 << 82;
    uint256 internal constant _ROLE_83 = 1 << 83;
    uint256 internal constant _ROLE_84 = 1 << 84;
    uint256 internal constant _ROLE_85 = 1 << 85;
    uint256 internal constant _ROLE_86 = 1 << 86;
    uint256 internal constant _ROLE_87 = 1 << 87;
    uint256 internal constant _ROLE_88 = 1 << 88;
    uint256 internal constant _ROLE_89 = 1 << 89;
    uint256 internal constant _ROLE_90 = 1 << 90;
    uint256 internal constant _ROLE_91 = 1 << 91;
    uint256 internal constant _ROLE_92 = 1 << 92;
    uint256 internal constant _ROLE_93 = 1 << 93;
    uint256 internal constant _ROLE_94 = 1 << 94;
    uint256 internal constant _ROLE_95 = 1 << 95;
    uint256 internal constant _ROLE_96 = 1 << 96;
    uint256 internal constant _ROLE_97 = 1 << 97;
    uint256 internal constant _ROLE_98 = 1 << 98;
    uint256 internal constant _ROLE_99 = 1 << 99;
    uint256 internal constant _ROLE_100 = 1 << 100;
    uint256 internal constant _ROLE_101 = 1 << 101;
    uint256 internal constant _ROLE_102 = 1 << 102;
    uint256 internal constant _ROLE_103 = 1 << 103;
    uint256 internal constant _ROLE_104 = 1 << 104;
    uint256 internal constant _ROLE_105 = 1 << 105;
    uint256 internal constant _ROLE_106 = 1 << 106;
    uint256 internal constant _ROLE_107 = 1 << 107;
    uint256 internal constant _ROLE_108 = 1 << 108;
    uint256 internal constant _ROLE_109 = 1 << 109;
    uint256 internal constant _ROLE_110 = 1 << 110;
    uint256 internal constant _ROLE_111 = 1 << 111;
    uint256 internal constant _ROLE_112 = 1 << 112;
    uint256 internal constant _ROLE_113 = 1 << 113;
    uint256 internal constant _ROLE_114 = 1 << 114;
    uint256 internal constant _ROLE_115 = 1 << 115;
    uint256 internal constant _ROLE_116 = 1 << 116;
    uint256 internal constant _ROLE_117 = 1 << 117;
    uint256 internal constant _ROLE_118 = 1 << 118;
    uint256 internal constant _ROLE_119 = 1 << 119;
    uint256 internal constant _ROLE_120 = 1 << 120;
    uint256 internal constant _ROLE_121 = 1 << 121;
    uint256 internal constant _ROLE_122 = 1 << 122;
    uint256 internal constant _ROLE_123 = 1 << 123;
    uint256 internal constant _ROLE_124 = 1 << 124;
    uint256 internal constant _ROLE_125 = 1 << 125;
    uint256 internal constant _ROLE_126 = 1 << 126;
    uint256 internal constant _ROLE_127 = 1 << 127;
    uint256 internal constant _ROLE_128 = 1 << 128;
    uint256 internal constant _ROLE_129 = 1 << 129;
    uint256 internal constant _ROLE_130 = 1 << 130;
    uint256 internal constant _ROLE_131 = 1 << 131;
    uint256 internal constant _ROLE_132 = 1 << 132;
    uint256 internal constant _ROLE_133 = 1 << 133;
    uint256 internal constant _ROLE_134 = 1 << 134;
    uint256 internal constant _ROLE_135 = 1 << 135;
    uint256 internal constant _ROLE_136 = 1 << 136;
    uint256 internal constant _ROLE_137 = 1 << 137;
    uint256 internal constant _ROLE_138 = 1 << 138;
    uint256 internal constant _ROLE_139 = 1 << 139;
    uint256 internal constant _ROLE_140 = 1 << 140;
    uint256 internal constant _ROLE_141 = 1 << 141;
    uint256 internal constant _ROLE_142 = 1 << 142;
    uint256 internal constant _ROLE_143 = 1 << 143;
    uint256 internal constant _ROLE_144 = 1 << 144;
    uint256 internal constant _ROLE_145 = 1 << 145;
    uint256 internal constant _ROLE_146 = 1 << 146;
    uint256 internal constant _ROLE_147 = 1 << 147;
    uint256 internal constant _ROLE_148 = 1 << 148;
    uint256 internal constant _ROLE_149 = 1 << 149;
    uint256 internal constant _ROLE_150 = 1 << 150;
    uint256 internal constant _ROLE_151 = 1 << 151;
    uint256 internal constant _ROLE_152 = 1 << 152;
    uint256 internal constant _ROLE_153 = 1 << 153;
    uint256 internal constant _ROLE_154 = 1 << 154;
    uint256 internal constant _ROLE_155 = 1 << 155;
    uint256 internal constant _ROLE_156 = 1 << 156;
    uint256 internal constant _ROLE_157 = 1 << 157;
    uint256 internal constant _ROLE_158 = 1 << 158;
    uint256 internal constant _ROLE_159 = 1 << 159;
    uint256 internal constant _ROLE_160 = 1 << 160;
    uint256 internal constant _ROLE_161 = 1 << 161;
    uint256 internal constant _ROLE_162 = 1 << 162;
    uint256 internal constant _ROLE_163 = 1 << 163;
    uint256 internal constant _ROLE_164 = 1 << 164;
    uint256 internal constant _ROLE_165 = 1 << 165;
    uint256 internal constant _ROLE_166 = 1 << 166;
    uint256 internal constant _ROLE_167 = 1 << 167;
    uint256 internal constant _ROLE_168 = 1 << 168;
    uint256 internal constant _ROLE_169 = 1 << 169;
    uint256 internal constant _ROLE_170 = 1 << 170;
    uint256 internal constant _ROLE_171 = 1 << 171;
    uint256 internal constant _ROLE_172 = 1 << 172;
    uint256 internal constant _ROLE_173 = 1 << 173;
    uint256 internal constant _ROLE_174 = 1 << 174;
    uint256 internal constant _ROLE_175 = 1 << 175;
    uint256 internal constant _ROLE_176 = 1 << 176;
    uint256 internal constant _ROLE_177 = 1 << 177;
    uint256 internal constant _ROLE_178 = 1 << 178;
    uint256 internal constant _ROLE_179 = 1 << 179;
    uint256 internal constant _ROLE_180 = 1 << 180;
    uint256 internal constant _ROLE_181 = 1 << 181;
    uint256 internal constant _ROLE_182 = 1 << 182;
    uint256 internal constant _ROLE_183 = 1 << 183;
    uint256 internal constant _ROLE_184 = 1 << 184;
    uint256 internal constant _ROLE_185 = 1 << 185;
    uint256 internal constant _ROLE_186 = 1 << 186;
    uint256 internal constant _ROLE_187 = 1 << 187;
    uint256 internal constant _ROLE_188 = 1 << 188;
    uint256 internal constant _ROLE_189 = 1 << 189;
    uint256 internal constant _ROLE_190 = 1 << 190;
    uint256 internal constant _ROLE_191 = 1 << 191;
    uint256 internal constant _ROLE_192 = 1 << 192;
    uint256 internal constant _ROLE_193 = 1 << 193;
    uint256 internal constant _ROLE_194 = 1 << 194;
    uint256 internal constant _ROLE_195 = 1 << 195;
    uint256 internal constant _ROLE_196 = 1 << 196;
    uint256 internal constant _ROLE_197 = 1 << 197;
    uint256 internal constant _ROLE_198 = 1 << 198;
    uint256 internal constant _ROLE_199 = 1 << 199;
    uint256 internal constant _ROLE_200 = 1 << 200;
    uint256 internal constant _ROLE_201 = 1 << 201;
    uint256 internal constant _ROLE_202 = 1 << 202;
    uint256 internal constant _ROLE_203 = 1 << 203;
    uint256 internal constant _ROLE_204 = 1 << 204;
    uint256 internal constant _ROLE_205 = 1 << 205;
    uint256 internal constant _ROLE_206 = 1 << 206;
    uint256 internal constant _ROLE_207 = 1 << 207;
    uint256 internal constant _ROLE_208 = 1 << 208;
    uint256 internal constant _ROLE_209 = 1 << 209;
    uint256 internal constant _ROLE_210 = 1 << 210;
    uint256 internal constant _ROLE_211 = 1 << 211;
    uint256 internal constant _ROLE_212 = 1 << 212;
    uint256 internal constant _ROLE_213 = 1 << 213;
    uint256 internal constant _ROLE_214 = 1 << 214;
    uint256 internal constant _ROLE_215 = 1 << 215;
    uint256 internal constant _ROLE_216 = 1 << 216;
    uint256 internal constant _ROLE_217 = 1 << 217;
    uint256 internal constant _ROLE_218 = 1 << 218;
    uint256 internal constant _ROLE_219 = 1 << 219;
    uint256 internal constant _ROLE_220 = 1 << 220;
    uint256 internal constant _ROLE_221 = 1 << 221;
    uint256 internal constant _ROLE_222 = 1 << 222;
    uint256 internal constant _ROLE_223 = 1 << 223;
    uint256 internal constant _ROLE_224 = 1 << 224;
    uint256 internal constant _ROLE_225 = 1 << 225;
    uint256 internal constant _ROLE_226 = 1 << 226;
    uint256 internal constant _ROLE_227 = 1 << 227;
    uint256 internal constant _ROLE_228 = 1 << 228;
    uint256 internal constant _ROLE_229 = 1 << 229;
    uint256 internal constant _ROLE_230 = 1 << 230;
    uint256 internal constant _ROLE_231 = 1 << 231;
    uint256 internal constant _ROLE_232 = 1 << 232;
    uint256 internal constant _ROLE_233 = 1 << 233;
    uint256 internal constant _ROLE_234 = 1 << 234;
    uint256 internal constant _ROLE_235 = 1 << 235;
    uint256 internal constant _ROLE_236 = 1 << 236;
    uint256 internal constant _ROLE_237 = 1 << 237;
    uint256 internal constant _ROLE_238 = 1 << 238;
    uint256 internal constant _ROLE_239 = 1 << 239;
    uint256 internal constant _ROLE_240 = 1 << 240;
    uint256 internal constant _ROLE_241 = 1 << 241;
    uint256 internal constant _ROLE_242 = 1 << 242;
    uint256 internal constant _ROLE_243 = 1 << 243;
    uint256 internal constant _ROLE_244 = 1 << 244;
    uint256 internal constant _ROLE_245 = 1 << 245;
    uint256 internal constant _ROLE_246 = 1 << 246;
    uint256 internal constant _ROLE_247 = 1 << 247;
    uint256 internal constant _ROLE_248 = 1 << 248;
    uint256 internal constant _ROLE_249 = 1 << 249;
    uint256 internal constant _ROLE_250 = 1 << 250;
    uint256 internal constant _ROLE_251 = 1 << 251;
    uint256 internal constant _ROLE_252 = 1 << 252;
    uint256 internal constant _ROLE_253 = 1 << 253;
    uint256 internal constant _ROLE_254 = 1 << 254;
    uint256 internal constant _ROLE_255 = 1 << 255;
}

File 10 of 11 : GasBurnerLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Library for burning gas without reverting.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/GasBurnerLib.sol)
library GasBurnerLib {
    /// @dev Burns approximately `x` amount of gas.
    /// Intended for Contract Secured Revenue (CSR).
    ///
    /// Recommendation: pass in an admin-controlled dynamic value instead of a hardcoded one.
    /// This is so that you can adjust your contract as needed depending on market conditions,
    /// and to give you and your users a leeway in case the L2 chain change the rules.
    function burn(uint256 x) internal pure {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x10, or(1, x))
            let n := mul(gt(x, 120), div(x, 91))
            // We use keccak256 instead of blake2f precompile for better widespread compatibility.
            for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } {
                mstore(0x10, keccak256(0x10, 0x10)) // Yes.
            }
            if iszero(mload(0x10)) { invalid() }
        }
    }
}

File 11 of 11 : SafeTransferLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
/// - For ERC20s, this implementation won't check that a token has code,
///   responsibility is delegated to the caller.
library SafeTransferLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ETH transfer has failed.
    error ETHTransferFailed();

    /// @dev The ERC20 `transferFrom` has failed.
    error TransferFromFailed();

    /// @dev The ERC20 `transfer` has failed.
    error TransferFailed();

    /// @dev The ERC20 `approve` has failed.
    error ApproveFailed();

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

    /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
    uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;

    /// @dev Suggested gas stipend for contract receiving ETH to perform a few
    /// storage reads and writes, but low enough to prevent griefing.
    uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       ETH OPERATIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
    //
    // The regular variants:
    // - Forwards all remaining gas to the target.
    // - Reverts if the target reverts.
    // - Reverts if the current contract has insufficient balance.
    //
    // The force variants:
    // - Forwards with an optional gas stipend
    //   (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
    // - If the target reverts, or if the gas stipend is exhausted,
    //   creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
    //   Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
    // - Reverts if the current contract has insufficient balance.
    //
    // The try variants:
    // - Forwards with a mandatory gas stipend.
    // - Instead of reverting, returns whether the transfer succeeded.

    /// @dev Sends `amount` (in wei) ETH to `to`.
    function safeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Sends all the ETH in the current contract to `to`.
    function safeTransferAllETH(address to) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // Transfer all the ETH and check if it succeeded or not.
            if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if lt(selfbalance(), amount) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
            if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
    function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
    function forceSafeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if lt(selfbalance(), amount) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
            if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
    function forceSafeTransferAllETH(address to) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // forgefmt: disable-next-item
            if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
        internal
        returns (bool success)
    {
        /// @solidity memory-safe-assembly
        assembly {
            success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
        }
    }

    /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
    function trySafeTransferAllETH(address to, uint256 gasStipend)
        internal
        returns (bool success)
    {
        /// @solidity memory-safe-assembly
        assembly {
            success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      ERC20 OPERATIONS                      */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for
    /// the current contract to manage.
    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x60, amount) // Store the `amount` argument.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x2c, shl(96, from)) // Store the `from` argument.
            mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends all of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have their entire balance approved for
    /// the current contract to manage.
    function safeTransferAllFrom(address token, address from, address to)
        internal
        returns (uint256 amount)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x2c, shl(96, from)) // Store the `from` argument.
            mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
            // Read the balance, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
            amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransfer(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sends all of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransferAll(address token, address to) internal returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
            mstore(0x20, address()) // Store the address of the current contract.
            // Read the balance, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x14, to) // Store the `to` argument.
            amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// Reverts upon failure.
    function safeApprove(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
            // Perform the approval, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
    /// then retries the approval again (some tokens, e.g. USDT, requires this).
    /// Reverts upon failure.
    function safeApproveWithRetry(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
            // Perform the approval, retrying upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x34, 0) // Store 0 for the `amount`.
                mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
                pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
                mstore(0x34, amount) // Store back the original `amount`.
                // Retry the approval, reverting upon failure.
                if iszero(
                    and(
                        or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                        call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                    )
                ) {
                    mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                    revert(0x1c, 0x04)
                }
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Returns the amount of ERC20 `token` owned by `account`.
    /// Returns zero if the `token` does not exist.
    function balanceOf(address token, address account) internal view returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, account) // Store the `account` argument.
            mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
            amount :=
                mul(
                    mload(0x20),
                    and( // The arguments of `and` are evaluated from right to left.
                        gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                        staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
                    )
                )
        }
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "viaIR": true,
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[],"name":"Locked","type":"error"},{"inputs":[],"name":"MaxBalanceLimitReached","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"},{"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":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"roles","type":"uint256"}],"name":"RolesUpdated","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":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"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":"baseURILocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"enableTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"excludeAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gasBurnFactor","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasBurnFactorLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"getSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTaxFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalReflections","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"grantRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAllRoles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAnyRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"includeAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialTokenSupply","type":"uint256"},{"internalType":"uint256","name":"wad","type":"uint256"},{"internalType":"address","name":"mirror","type":"address"},{"internalType":"address","name":"uniswapV2Router_","type":"address"},{"internalType":"address","name":"gasliteDrop_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockGasBurnFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockGasWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockMaxBalanceLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockNameAndSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxBalanceLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBalanceLimitLocked","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":"view","type":"function"},{"inputs":[],"name":"nameAndSymbolLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":[{"internalType":"uint256","name":"tAmount","type":"uint256"}],"name":"reflect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tAmount","type":"uint256"},{"internalType":"bool","name":"deductTransferFee","type":"bool"}],"name":"reflectionFromToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceFunctions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"renounceRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"revokeRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"rolesOf","outputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"gasBurnFactor_","type":"uint32"}],"name":"setGasBurnFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"value","type":"uint32"}],"name":"setMaxBalanceLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"name":"setNameAndSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"skipNFT","type":"bool"}],"name":"setSkipNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setTaxFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rAmount","type":"uint256"}],"name":"tokenFromReflection","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"result","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"},{"inputs":[],"name":"whitelistLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052346200019a5732638b78c6d81955600032817f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a332600090815268a20d6e21d0e52553146020526040902054600191906001600160581b038082169160571c841615156000190162000185575b32600090815268a20d6e21d0e52553146020526040902080546001600160581b031916919092161790558154620000aa906200019f565b601f811162000156575b507f4465657a4e75747a0000000000000000000000000000000000000000000000108255600254620000e6906200019f565b90601f821162000129575b600461222760f11b0160025560048054600160281b600160681b03191666015c00000000001790556040516134599081620001dd8239f35b60028152601f60208220920160051c8201915b8281106200014b5750620000f1565b81815583016200013c565b82825282601f60208420920160051c8201915b82811062000179575050620000b4565b83815501839062000169565b906a8000000000000000000000189062000073565b600080fd5b90600182811c92168015620001d1575b6020831014620001bb57565b634e487b7160e01b600052602260045260246000fd5b91607f1691620001af56fe6080604081815260048036109283156106cd575b5036156106cb57600092833560e01c9163e985e9c5831461066a57636352211e83146105f65763e5eb36c883146102e05763813500fc83146102875763d10b6e0c83146101d25763081812fc831461013a5763f5b100ea83146100e15763e2c792818314610092578463b7a94eb8841461008957005b80600160209252f35b68a20d6e21d0e525530d54919250906001600160a01b031633036100d357506100cf5768a20d6e21d0e525530854901c63ffffffff168152602090f35b5080fd5b825163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d546001600160a01b03949193509091508316330361012d575060243610610129576101206020939263ffffffff9235166122ed565b5460801c168152f35b8280fd5b5163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d5485906001600160a01b03908690821633036101c35760243610610129578335826101926101748360011b612536565b63ffffffff1660005268a20d6e21d0e525530e602052604060002090565b5416156101b35760209450835268a20d6e21d0e52553108452822054168152f35b815163677510db60e11b81528590fd5b5163ce5a776b60e01b81528390fd5b68a20d6e21d0e525530d546001600160a01b039186918691908416330361027957606436106101295760243593806044351692816102156101748860011b612536565b541693848103610249575b50602095855268a20d6e21d0e52553108652842091351660018060a01b03198254161790558152f35b6102528561230f565b90865260205260ff81862054161561026a5786610220565b516367d9dca160e11b81529050fd5b905163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d546001600160a01b0391869186919084163303610279576064361061012957836102c06020956044351661230f565b91351683528352812060ff1981541660ff60243515151617905560018152f35b68a20d6e21d0e525530d5485906001600160a01b03908690821633036101c35760843610610129578184351690826024351660443584606435169460ff885460681c16156105de575b82156105ce5761033b85841415612f6d565b60019582871b918061034f61017485612536565b541687036105bf57868203610574575b505061036a856124ee565b91610374846124ee565b885461037f81612562565b505050509060ff60038701541661055e575b5060ff600383015416610547575b600285016103ae82825461237f565b90556001600160601b03808b5416865460a01c038181116105345760209c5092869594926103f8838d948f6103e96104ee996104f39d612fb3565b5416845460a01c011683612fb3565b6002820190815401905561041561040f8983612ff9565b866130a7565b828c5268a20d6e21d0e52553108d52888c2080546001600160a01b03191690556104dd8a6104c361044582612331565b936104b08661049861049263ffffffff9d8e9961046f8b60001981855460801c1601168093612fd6565b9063ffffffff918160031c60005260205260e06040600020549160051b161c1690565b95612331565b9a019986851690876104a98d612536565b16906130dc565b84815460801c16998a9687011690612fd6565b8c6401fffffffe6104d389612536565b92821b16016130a7565b6104e688612331565b9216916130dc565b6130a7565b80836000805160206134048339815191528888549551868152a36105178184613109565b8203610524575b50508152f35b61052d91613193565b838061051e565b634e487b7160e01b8c5260118d5260248cfd5b89546105578a84019182546123a2565b905561039f565b61056c8a870191825461237f565b90558b610391565b61057d8761230f565b828a5260205260ff868a20541661035f5783895268a20d6e21d0e52553106020528589205416036105af57888061035f565b8351632ce44b5f60e11b81528890fd5b855162a1148160e81b81528a90fd5b8351633a954ecd60e21b81528890fd5b6105f181638b78c6d81954163314612766565b610329565b68a20d6e21d0e525530d54849186916001600160a01b0391908216330361065c576024361061012957803560011b938261063261017487612536565b54161561064f575050610649610174602094612536565b54168152f35b5163677510db60e11b8152fd5b835163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d546001600160a01b039350909150821633036100d357604436106106c75791816106a560ff9360209695351661230f565b906024351684528452822054166000146106bf5760018152f35b60ff81168152f35b8380fd5b005b600090813560e01c90816304dfe79d146121ea57508063053ab1821461211557806306fdde031461208e578063095ea7b31461201a578063180434a314611ff357806318160ddd14611fc0578063183a4f6e14611fa75780631c10893f14611f465780631cd64df414611f0d57806323b848ff14611edd57806323b872dd14611e4c5780632569296214611e01578063274e430b14611dd25780632a6a935d14611d3f5780632d83811914611d1e5780632de9480714611cea578063313ce56714611cce5780633af32abf14611c985780633ccfd60b14611c625780633fbfd4df146119b05780634549b0391461198757806347f618a5146119605780634a4ee7b1146119385780634ef41efc14611907578063514e62fc146118ce5780635327bba3146118a657806353d6fd591461182657806353df5c7c146117fe57806354d1f13d146117b857806355f804b31461165f5780635a4462151461139a5780635d148e5c146113765780636338cb8a1461134c57806370a082311461131f578063715018a6146112eb57806375b238fc146112cf5780638a8c523c146112a15780638da5cb5b14611274578063918e7a1e1461121d57806395d89b411461114e578063a9059cbb1461111d578063ae267735146110f6578063af6900c3146110c8578063b19de39f1461105f578063bbefa83a14611033578063c4081a4c14610f97578063c87b56dd14610d3a578063d73c1fb314610d13578063dc5e08a414610ce2578063dd62ed3e14610c9b578063e436744514610c75578063f04e283e14610c07578063f2cc0c1814610b40578063f2fde38b14610ae5578063f66608fe14610abe578063f84354f11461097c5763fee81cf4036100135782346100cf5760203660031901126100cf5760209161096661225e565b9063389a75e1600c525281600c20549051908152f35b5090346100cf5760203660031901126100cf5761099761225e565b61099f613354565b6109a8816124ee565b600391828201936109bd60ff86541615613298565b6001600160a01b0391821690865b68a20d6e21d0e5255315805480831015610ab25784866109ea856125d8565b9054908b1b1c1614610a06575050610a01906125c9565b6109cb565b94959190969792935060001994858101908111610a9f5791610a5e600192610a3f898c610a338f986125d8565b9054911b1c16916125d8565b90919082549060031b9160018060a01b03809116831b921b1916179055565b0155805460ff191690558354908115610a8c57500192610a7d846125d8565b81939154921b1b191690555580f35b634e487b7160e01b875260319052602486fd5b634e487b7160e01b8a526011855260248afd5b50505050505050505080f35b5082346100cf57816003193601126100cf5760209068a20d6e21d0e525530c549051908152f35b509060203660031901126100cf57610afb61225e565b90610b04613354565b8160601b15610b35575060018060a01b0316638b78c6d8198181546000805160206133e48339815191528580a35580f35b637448fbae8352601cfd5b5034610c04576020366003190112610c0457610b5a61225e565b610b62613354565b610b7960ff68a20d6e21d0e5255316541615613254565b610b82816124ee565b60016003820191825490610b9960ff831615613298565b600281015480610bf0575b505060ff191617905568a20d6e21d0e5255315805490600160401b821015610bdd5781610a3f916001610bda95940190556125d8565b80f35b634e487b7160e01b845260418552602484fd5b610bfa849161244b565b9101558680610ba4565b80fd5b509060203660031901126100cf57610c1d61225e565b90610c26613354565b63389a75e1600c528183526020600c209081544211610c6a575082905560018060a01b0316638b78c6d8198181546000805160206133e48339815191528580a35580f35b636f5e88188452601cfd5b50829034610c045780600319360112610c04575060ff60209254915191831c1615158152f35b5082346100cf57806003193601126100cf5780602092610cb961225e565b610cca610cc4612279565b916122cb565b6001600160a01b039091168252845220549051908152f35b5034610c045780600319360112610c0457610cfb613354565b68a20d6e21d0e5255316805460ff1916600117905580f35b50829034610c045780600319360112610c04575060ff6020925460181c1690519015158152f35b50913461012957602091826003193601126106c757600192813591906001600160a01b03610d6c61017485881b612536565b541615610f8857859291829072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8281811015610f7b575b50506d04ee2d6d415b85acef810000000080831015610f6d575b50662386f26fc1000080831015610f5e575b506305f5e10080831015610f4f575b5061271080831015610f43575b50506064811015610f35575b85600a80921015610f2b575b840192866021610e20610e0b8761274b565b96610e188a519889612714565b80885261274b565b8686019790601f1901368937860101905b610efc575b5050508351948660035491610e4a836126da565b92818116908115610edd5750600114610ea2575b610e9e8888610e946005838e80610e798e8e5193849161220f565b0164173539b7b760d91b815203601a19810185520183612714565b5191829182612232565b0390f35b9091929750600382528782205b838310610eca57505050840190940193838282610e79610e5e565b80548884018a0152918801918101610eaf565b60ff1916858a0152505050801515028501019450838282610e79610e5e565b600019019082906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304908782610e315750610e36565b9093019285610df9565b606460029104930192610ded565b94019390048780610de1565b60089195920491019388610dd4565b60109195920491019388610dc5565b839195920491019388610db3565b8796500491508880610d99565b50825163677510db60e11b8152fd5b5092503461012957602036600319011261012957803591610fb6613354565b610fcd60ff68a20d6e21d0e5255316541615613254565b60328311610fe557505068a20d6e21d0e525530c5580f35b906020608492519162461bcd60e51b8352820152602260248201527f5265666c656374696f6e7320666565206d757374206265203525206f72206c65604482015261737360f01b6064820152fd5b5090346100cf57816003193601126100cf5761104d613371565b805462ff000019166201000017905580f35b50913461012957602036600319011261012957813563ffffffff811681036106c757611089613371565b82549160ff8360101c166110b9575063ffffffff60481b1990911660489190911b63ffffffff60481b1617905580f35b516303cb96db60e21b81528390fd5b5090346100cf57816003193601126100cf576110e2613371565b805463ff0000001916630100000017905580f35b5082346100cf57816003193601126100cf5760209068a20d6e21d0e525530b549051908152f35b5082346100cf57806003193601126100cf5760209061114761113d61225e565b60243590336127ab565b5160018152f35b5082346100cf57816003193601126100cf5780519082600254611170816126da565b808552906001908181169081156111f5575060011461119c575b505050610e9482610e9e940383612714565b60028352602095507f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106111e25750505082610e9e94610e94928201019461118a565b80548685018801529286019281016111c6565b610e9e9750610e949450602092508693915060ff191682840152151560051b8201019461118a565b50913461012957602036600319011261012957813563ffffffff811681036106c757611247613371565b82549160ff8360201c166110b9575063ffffffff60281b9060281b169063ffffffff60281b191617905580f35b5082346100cf57816003193601126100cf57638b78c6d8195490516001600160a01b039091168152602090f35b5090346100cf57816003193601126100cf576112bb613354565b805460ff60681b1916600160681b17905580f35b5082346100cf57816003193601126100cf576020905160018152f35b5080600319360112610c04576112ff613354565b80638b78c6d8198181546000805160206133e48339815191528280a35580f35b5082346100cf5760203660031901126100cf5760209061134561134061225e565b612353565b9051908152f35b5090346100cf57816003193601126100cf57611366613371565b805461ff00191661010017905580f35b50829034610c045780600319360112610c04575060ff602092541690519015158152f35b509250346101295781600319360112610129576001600160401b0390803582811161165b576113cc903690830161229e565b939091602435848111611657576113e6903690830161229e565b9490926113f1613371565b60ff835460081c166116485750808611611635576001958061141388546126da565b95601f968781116115e5575b50899087831160011461157f578a92611574575b5050600019600383901b1c191690871b1786555b841161156157506114596002546126da565b82811161151b575b508491831160011461149a57928293918392869461148f575b50501b916000199060031b1c19161760025580f35b01359250388061147a565b600285527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9183601f1981168760205b8883831061150157505050106114e7575b505050811b0160025580f35b0135600019600384901b60f8161c191690553880806114db565b8686013588559096019593840193879350908101906114ca565b60028652602086208380860160051c82019260208710611558575b0160051c019085905b82811061154d575050611461565b87815501859061153f565b92508192611536565b634e487b7160e01b865260419052602485fd5b013590503880611433565b898b526020808c208b95509290601f198516908d905b8282106115cc57505084116115b2575b505050811b018655611447565b0135600019600384901b60f8161c191690553880806115a5565b8385013586558d97909501949283019290810190611595565b909150888a5260208a208780850160051c8201926020861061162c575b918b91869594930160051c01915b82811061161e57505061141f565b8c81558594508b9101611610565b92508192611602565b634e487b7160e01b875260418252602487fd5b516303cb96db60e21b81529050fd5b8680fd5b8480fd5b5082346100cf5760209283600319360112610129576001600160401b0390803582811161165b57611693903690830161229e565b92909361169e613371565b60ff835416611648575082116117a557506003916116bc83546126da565b601f8111611762575b508394601f83116001146117015750938394829394926116f6575b50508160011b9160001990841b1c191617905580f35b0135905084806116e0565b90601f198316958486528286209286905b88821061174a57505083600195969710611732575b505050811b01905580f35b013560001983861b60f8161c19169055848080611727565b80600184968294958701358155019501920190611712565b838552858520601f840160051c81019187851061179b575b601f0160051c01905b81811061179057506116c5565b858155600101611783565b909150819061177a565b634e487b7160e01b845260419052602483fd5b5080600319360112610c045763389a75e1600c52338152806020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c928280a280f35b5090346100cf57816003193601126100cf57611818613371565b805460ff1916600117905580f35b5082346100cf57806003193601126100cf5761184061225e565b61184861228f565b91611851613371565b60ff855460181c166118975750908161186c610bda936122ed565b5460016001600160581b0382169315159160571c161515031561323057600160571b90911890613230565b516303cb96db60e21b81528490fd5b50829034610c045780600319360112610c04575063ffffffff6020925460481c169051908152f35b5082346100cf57806003193601126100cf576020916118eb61225e565b90638b78c6d8600c525260243582600c20541615159051908152f35b5082346100cf57816003193601126100cf5768a20d6e21d0e525530d5490516001600160a01b039091168152602090f35b5082600319360112610c0457610bda61194f61225e565b611957613354565b6024359061339c565b50829034610c045780600319360112610c04575060ff6020925460101c1690519015158152f35b50829034610c045781600319360112610c0457506113456020926119a961228f565b90356123af565b509250346101295760a0366003190112610129578035906001600160a01b036044358181168082036116575760643592808416809403611c5e57608435908116809103611c5e576119ff613371565b60018060a01b03199384600554161760055583600654161760065568a20d6e21d0e52553089163ffffffff835460201c16611c4e578115611c3e57876024601c82602094630f4599e582523386525af160018851141615611c3257815492640100000000918263ffffffff60201b19861617845568a20d6e21d0e525530d9182541617905560243587558415928315611ad2575b50505050505050610bda611aa6336122ed565b546001806001600160581b0383169260571c16151503611ac7575b33613230565b600160571b18611ac1565b3315611c22576b0de0b6b39983494c589bffff8611611c125777ffffffffffffffffffffffff00000000ffffffff000000001916606086901b6bffffffffffffffffffffffff60601b161717905568a20d6e21d0e5255309839055611bff575068a20d6e21d0e525530a81600019061981556002611b4f336124ee565b91611b636001600160601b03851684612fb3565b5491015581519081528260008051602061340483398151915260203393a3611b8a336124ee565b805460581c90600160028316151503611bd7575b505051600181527fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039360203392a238808080808080611a93565b805460ff60581b191660ff9290921660021860581b60ff60581b169190911790553880611b9e565b634e487b7160e01b845260129052602483fd5b865163e5cfe95760e01b81528590fd5b8651633a954ecd60e21b81528590fd5b8363d125259c8852601cfd5b86516339a84a7b60e01b81528590fd5b8651633ab534b960e21b81528590fd5b8780fd5b5090346100cf57816003193601126100cf57611c7c613371565b8138818047335af115611c8d575080f35b63b12d13eb8252601cfd5b5082346100cf5760203660031901126100cf576020906001611cc0611cbb61225e565b6122ed565b5460571c1615159051908152f35b5082346100cf57816003193601126100cf576020905160128152f35b5082346100cf5760203660031901126100cf57602091611d0861225e565b90638b78c6d8600c525281600c20549051908152f35b50829034610c04576020366003190112610c0457506113456020923561244b565b5092503461012957602036600319011261012957359081151580920361012957611d68336124ee565b805460581c908360028316151503611daa575b5050519081527fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039360203392a280f35b805460ff60581b191660ff9290921660021860581b60ff60581b169190911790553880611d7b565b5082346100cf5760203660031901126100cf57602090611df8611df361225e565b6124c9565b90519015158152f35b5080600319360112610c045763389a75e1600c523381526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d8280a280f35b50829034610c04576060366003190112610c0457611e6861225e565b611e70612279565b9160443594611e7e836122cb565b338352602052848220549060018201611ea0575b6020866111478988886127ab565b818711611ecf5750916111479391858760209895611ebd856122cb565b3385528a520391205591948193611e92565b85516313be252b60e01b8152fd5b5090346100cf57816003193601126100cf57611ef7613371565b805464ff00000000191664010000000017905580f35b5082346100cf57806003193601126100cf57602091611f2a61225e565b60243591638b78c6d8600c52528083600c205416149051908152f35b5082600319360112610c0457611f5a61225e565b611f62613354565b638b78c6d8600c5281526020600c20602435815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe268380a380f35b509060203660031901126100cf57610bda90353361339c565b5082346100cf57816003193601126100cf576020906001600160601b0368a20d6e21d0e52553085460601c169051908152f35b50829034610c045780600319360112610c04575060ff6020925460081c1690519015158152f35b5082346100cf57806003193601126100cf576020918161203861225e565b91602435918291612048336122cb565b6001600160a01b039095168082529487522055825190815233907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908590a35160018152f35b5082346100cf57816003193601126100cf578051908260018054906120b2826126da565b808652918181169081156111f557506001146120da57505050610e9482610e9e940383612714565b80955082526020948583205b8284106121025750505082610e9e94610e94928201019461118a565b80548685018801529286019281016120e6565b50913461012957602036600319011261012957813591612134336124ee565b9160ff600384015416612192575050600261214e83612562565b50505050910161215f82825461237f565b905561217668a20d6e21d0e525530a91825461237f565b905561218d68a20d6e21d0e525530b9182546123a2565b905580f35b906020608492519162461bcd60e51b8352820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b6064820152fd5b91905034610c045780600319360112610c04575063ffffffff6020925460281c168152f35b60005b8381106122225750506000910152565b8181015183820152602001612212565b60409160208252612252815180928160208601526020868601910161220f565b601f01601f1916010190565b600435906001600160a01b038216820361227457565b600080fd5b602435906001600160a01b038216820361227457565b60243590811515820361227457565b9181601f84011215612274578235916001600160401b038311612274576020838186019501011161227457565b6001600160a01b0316600090815268a20d6e21d0e52553116020526040902090565b6001600160a01b0316600090815268a20d6e21d0e52553146020526040902090565b6001600160a01b0316600090815268a20d6e21d0e525530f6020526040902090565b6001600160a01b0316600090815268a20d6e21d0e52553126020526040902090565b61235c906122ed565b60ff60038201541661237857600261237591015461244b565b90565b6001015490565b9190820391821161238c57565b634e487b7160e01b600052601160045260246000fd5b9190820180921161238c57565b9068a20d6e21d0e52553095482116123e6576123d5576123ce90612562565b5050505090565b6123de90612562565b505050905090565b60405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606490fd5b8115612435570490565b634e487b7160e01b600052601260045260246000fd5b68a20d6e21d0e525530a548111612471576123759061246b61246b612610565b9061242b565b60405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608490fd5b6124d2816122ed565b5460581c60018116156124e9576002915016151590565b503b90565b906124f8826122ed565b916001835460581c16156125095750565b6001903b61252e575b825460ff60581b191660589190911b60ff60581b16178255565b565b506003612512565b63ffffffff908060031c60005268a20d6e21d0e525531360205260e06040600020549160051b161c1690565b906103e861257a68a20d6e21d0e525530c54846125b6565b04612585818461237f565b906125a561259e61259761246b612610565b80966125b6565b94826125b6565b926125b0848661237f565b93929190565b8181029291811591840414171561238c57565b600019811461238c5760010190565b68a20d6e21d0e525531580548210156125fa5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b68a20d6e21d0e525530a54908168a20d6e21d0e525530954928390600068a20d6e21d0e5255315545b80821061265f57505061264c828261242b565b83106126585750509190565b9350919050565b909561268461266d886125d8565b905460039190911b1c6001600160a01b03166122ed565b9460028601549080821180156126cd575b6126c1579160016126ac6126b5936126bb9561237f565b9701549061237f565b966125c9565b90612639565b50505050915092509190565b5082600188015411612695565b90600182811c9216801561270a575b60208310146126f457565b634e487b7160e01b600052602260045260246000fd5b91607f16916126e9565b90601f801991011681019081106001600160401b0382111761273557604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161273557601f01601f191660200190565b1561276d57565b60405162461bcd60e51b8152602060048201526016602482015275151c98591a5b99c81a5cc81b9bdd08195b98589b195960521b6044820152606490fd5b919060ff60045460681c1615612f05575b6001600160a01b03811615612ef3576127e36001600160a01b038481169083161415612f6d565b6127ec836124ee565b6127f5826124ee565b60405160c081018181106001600160401b03821117612735576040526000815260006020820152600060408201526000606082015263ffffffff835460801c16608082015263ffffffff825460801c1660a082015261285386612353565b8511612ee15761286285612562565b9390919260ff600389015416808091612ed2575b15612da157506128c692506128bf9060018901928b845403845560028a01908154039055600288019081540181556128b96001600160601b03809454168a612fb3565b5461244b565b1685612fb3565b6128db68a20d6e21d0e525530a91825461237f565b90556128f268a20d6e21d0e525530b9182546123a2565b90556080810151835460a01c61290b600054809261242b565b9182810383821102845284549060028260581c1615612d4e575b50505050805160208201510192604051938460408101106001600160401b036040870111176127355760609060408601604052818652600060208701526040519082604083019180835260051b83010160405286520184602001528151612c0a575b506020810151612a41575b5050518051806129f3575b50506040518281526001600160a01b03828116919085169060008051602061340483398151915290602090a36129d38184613109565b6001600160a01b03908116908316036129ea575050565b61252c91613193565b6020600191600093838060a01b0368a20d6e21d0e525530d5416603f19820195869363263c69d6855285601f1985015260051b6044019260231901915af1915114161561227457388061299d565b9591929094612a4f82612331565b9260a0880151916020890151830190612a68858a612ff9565b97612adf68a20d6e21d0e5255308549a612a918c6001600160601b036000549160601c1661242b565b9b63ffffffff8160201c169d63ffffffff60208160401b9201511663ffffffff8360401c160160401b169063ffffffff60401b19161768a20d6e21d0e52553085563ffffffff851690612fd6565b60015b15612bc2575b60009a929a925b63ffffffff612b008260011b612536565b1615612b21576001019a8a8c11612b18575b9a612aef565b60019b50612b12565b6001909b91929399949b612b3c63ffffffff8216888b6130dc565b8187019668a20d6e21d0e52553136020528160021c60005260406000209060c08360061b1682549163ffffffff60201b8a63ffffffff169160201b161782821c186001600160401b0316901b18905560208a8101518260081b8a60601b178152018a6020015201988a8a11612bb9575b9a93989a92919092612ae2565b60019950612bac565b828503612ae857975097505096919392505063ffffffff60201b68a20d6e21d0e5255308549160201b169063ffffffff60201b19161768a20d6e21d0e5255308553880612992565b9692959491612c1b86959295612331565b94608081015198612c6f825191828c039268a20d6e21d0e52553089081549063ffffffff8060401b911663ffffffff8360401c160360401b169063ffffffff60401b191617905563ffffffff831690612fd6565b60015b15612d37575b8899602088999a600164ffffffff00612cb660009560001901809d9063ffffffff918160031c60005260205260e06040600020549160051b161c1690565b9268a20d6e21d0e52553138552633fffffff8460021c16600052604060002060c08560061b1681549081811c6001600160401b0316901b18905563ffffffff841660005268a20d6e21d0e525531085526040600020838060a01b031981541690558401519260081b168d60601b17178152018b602001529998979699612c72565b808a03612c78575091945091949592965038612987565b612d70936001600160a01b038b8116908a1614612d89575b505060a01c61242b565b60a0820151808203911102602082015238808080612925565b80820391110260808501510360a08501523880612d66565b80158080612ec4575b15612e0057505091612df3612dec92612dfb9460028b0191825403825560028a01908154019055600189019283540183556001600160601b039384915461244b565b1689612fb3565b541685612fb3565b6128c6565b91939180612eb5575b15612e4a5750506128bf612dfb926128b9612e439360028b0190815403815560028a019283540183556001600160601b039485915461244b565b168a612fb3565b80612ea7575b612e5d575b5050506128c6565b612e9f9260018901928b845403845560028a019081540390556002880190815401905560018701908154018155612df36001600160601b038093541689612fb3565b388080612e55565b5060ff600388015416612e50565b5060ff60038901541615612e09565b5060ff60038a015416612daa565b5060ff60038901541615612876565b604051631e9acf1760e31b8152600490fd5b604051633a954ecd60e21b8152600490fd5b638b78c6d81954612f2d906001600160a01b03908116338114918215612f32575b5050612766565b6127bc565b809192506005541633149182612f61575b508115612f53575b503880612f26565b905060065416331438612f4b565b86821614915038612f43565b15612f7457565b60405162461bcd60e51b815260206004820152601760248201527621b0b73737ba103a3930b739b332b9103a379039b2b63360491b6044820152606490fd5b80546001600160a01b031660a09290921b6001600160a01b031916919091179055565b805463ffffffff60801b191660809290921b63ffffffff60801b16919091179055565b805460601c63ffffffff908116939290841561301457505050565b9091935068a20d6e21d0e5255308908154918183169282841461238c5763ffffffff191660019390930191821692909217909155835463ffffffff60601b1916606082901b63ffffffff60601b16179093556130888363ffffffff1660005268a20d6e21d0e525530e602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b9068a20d6e21d0e52553136020528160031c60005260e060406000209260051b1682549182821c1863ffffffff16901b189055565b9190916020528160031c60005260e060406000209260051b1682549182821c1863ffffffff16901b189055565b9063ffffffff60045460281c16801561318e5761312582612353565b9060005402101561318a5761313b6001916122ed565b5460571c1661318757638b78c6d819546001600160a01b0382811691161461318757638b78c6d8600c5260005260016020600c20541661252c576040516303cab2ff60e21b8152600490fd5b50565b5050565b505050565b9063ffffffff60045460481c1690811561318e576131c3906001600160581b036131bc856122ed565b54166132e4565b60028193929310156131db575b505061252c91613230565b8002026301312d0080821015613228575b50600160109180821783526078605b820491110260005b81810361321c57505050511561321a5738806131d0565bfe5b83802084528201613203565b9050386131ec565b6132416001600160581b03916122ed565b91166001600160581b0319825416179055565b1561325b57565b60405162461bcd60e51b8152602060048201526015602482015274119d5b98dd1a5bdb881a5cc81c995b9bdd5b98d959605a1b6044820152606490fd5b1561329f57565b60405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606490fd5b91909160018160571c1661334d57637fffffff8062015180420416908260381c169366ffffffffffffff8093169180860361333e575b508291620de0b6936001600160581b039260281c16019460381b1690841617920490565b945060009150620de0b661331a565b9150600090565b638b78c6d81954330361336357565b6382b429006000526004601cfd5b638b78c6d81954330361338057565b638b78c6d8600c523360005260016020600c2054161561336357565b638b78c6d8600c526000526020600c2090815490811618809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a356fe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220e1e8d2b7595230fb6e3cadcc3b84c3b261fa6ffc6d57e15b195430cf8afdff3364736f6c63430008140033

Deployed Bytecode

0x6080604081815260048036109283156106cd575b5036156106cb57600092833560e01c9163e985e9c5831461066a57636352211e83146105f65763e5eb36c883146102e05763813500fc83146102875763d10b6e0c83146101d25763081812fc831461013a5763f5b100ea83146100e15763e2c792818314610092578463b7a94eb8841461008957005b80600160209252f35b68a20d6e21d0e525530d54919250906001600160a01b031633036100d357506100cf5768a20d6e21d0e525530854901c63ffffffff168152602090f35b5080fd5b825163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d546001600160a01b03949193509091508316330361012d575060243610610129576101206020939263ffffffff9235166122ed565b5460801c168152f35b8280fd5b5163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d5485906001600160a01b03908690821633036101c35760243610610129578335826101926101748360011b612536565b63ffffffff1660005268a20d6e21d0e525530e602052604060002090565b5416156101b35760209450835268a20d6e21d0e52553108452822054168152f35b815163677510db60e11b81528590fd5b5163ce5a776b60e01b81528390fd5b68a20d6e21d0e525530d546001600160a01b039186918691908416330361027957606436106101295760243593806044351692816102156101748860011b612536565b541693848103610249575b50602095855268a20d6e21d0e52553108652842091351660018060a01b03198254161790558152f35b6102528561230f565b90865260205260ff81862054161561026a5786610220565b516367d9dca160e11b81529050fd5b905163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d546001600160a01b0391869186919084163303610279576064361061012957836102c06020956044351661230f565b91351683528352812060ff1981541660ff60243515151617905560018152f35b68a20d6e21d0e525530d5485906001600160a01b03908690821633036101c35760843610610129578184351690826024351660443584606435169460ff885460681c16156105de575b82156105ce5761033b85841415612f6d565b60019582871b918061034f61017485612536565b541687036105bf57868203610574575b505061036a856124ee565b91610374846124ee565b885461037f81612562565b505050509060ff60038701541661055e575b5060ff600383015416610547575b600285016103ae82825461237f565b90556001600160601b03808b5416865460a01c038181116105345760209c5092869594926103f8838d948f6103e96104ee996104f39d612fb3565b5416845460a01c011683612fb3565b6002820190815401905561041561040f8983612ff9565b866130a7565b828c5268a20d6e21d0e52553108d52888c2080546001600160a01b03191690556104dd8a6104c361044582612331565b936104b08661049861049263ffffffff9d8e9961046f8b60001981855460801c1601168093612fd6565b9063ffffffff918160031c60005260205260e06040600020549160051b161c1690565b95612331565b9a019986851690876104a98d612536565b16906130dc565b84815460801c16998a9687011690612fd6565b8c6401fffffffe6104d389612536565b92821b16016130a7565b6104e688612331565b9216916130dc565b6130a7565b80836000805160206134048339815191528888549551868152a36105178184613109565b8203610524575b50508152f35b61052d91613193565b838061051e565b634e487b7160e01b8c5260118d5260248cfd5b89546105578a84019182546123a2565b905561039f565b61056c8a870191825461237f565b90558b610391565b61057d8761230f565b828a5260205260ff868a20541661035f5783895268a20d6e21d0e52553106020528589205416036105af57888061035f565b8351632ce44b5f60e11b81528890fd5b855162a1148160e81b81528a90fd5b8351633a954ecd60e21b81528890fd5b6105f181638b78c6d81954163314612766565b610329565b68a20d6e21d0e525530d54849186916001600160a01b0391908216330361065c576024361061012957803560011b938261063261017487612536565b54161561064f575050610649610174602094612536565b54168152f35b5163677510db60e11b8152fd5b835163ce5a776b60e01b8152fd5b68a20d6e21d0e525530d546001600160a01b039350909150821633036100d357604436106106c75791816106a560ff9360209695351661230f565b906024351684528452822054166000146106bf5760018152f35b60ff81168152f35b8380fd5b005b600090813560e01c90816304dfe79d146121ea57508063053ab1821461211557806306fdde031461208e578063095ea7b31461201a578063180434a314611ff357806318160ddd14611fc0578063183a4f6e14611fa75780631c10893f14611f465780631cd64df414611f0d57806323b848ff14611edd57806323b872dd14611e4c5780632569296214611e01578063274e430b14611dd25780632a6a935d14611d3f5780632d83811914611d1e5780632de9480714611cea578063313ce56714611cce5780633af32abf14611c985780633ccfd60b14611c625780633fbfd4df146119b05780634549b0391461198757806347f618a5146119605780634a4ee7b1146119385780634ef41efc14611907578063514e62fc146118ce5780635327bba3146118a657806353d6fd591461182657806353df5c7c146117fe57806354d1f13d146117b857806355f804b31461165f5780635a4462151461139a5780635d148e5c146113765780636338cb8a1461134c57806370a082311461131f578063715018a6146112eb57806375b238fc146112cf5780638a8c523c146112a15780638da5cb5b14611274578063918e7a1e1461121d57806395d89b411461114e578063a9059cbb1461111d578063ae267735146110f6578063af6900c3146110c8578063b19de39f1461105f578063bbefa83a14611033578063c4081a4c14610f97578063c87b56dd14610d3a578063d73c1fb314610d13578063dc5e08a414610ce2578063dd62ed3e14610c9b578063e436744514610c75578063f04e283e14610c07578063f2cc0c1814610b40578063f2fde38b14610ae5578063f66608fe14610abe578063f84354f11461097c5763fee81cf4036100135782346100cf5760203660031901126100cf5760209161096661225e565b9063389a75e1600c525281600c20549051908152f35b5090346100cf5760203660031901126100cf5761099761225e565b61099f613354565b6109a8816124ee565b600391828201936109bd60ff86541615613298565b6001600160a01b0391821690865b68a20d6e21d0e5255315805480831015610ab25784866109ea856125d8565b9054908b1b1c1614610a06575050610a01906125c9565b6109cb565b94959190969792935060001994858101908111610a9f5791610a5e600192610a3f898c610a338f986125d8565b9054911b1c16916125d8565b90919082549060031b9160018060a01b03809116831b921b1916179055565b0155805460ff191690558354908115610a8c57500192610a7d846125d8565b81939154921b1b191690555580f35b634e487b7160e01b875260319052602486fd5b634e487b7160e01b8a526011855260248afd5b50505050505050505080f35b5082346100cf57816003193601126100cf5760209068a20d6e21d0e525530c549051908152f35b509060203660031901126100cf57610afb61225e565b90610b04613354565b8160601b15610b35575060018060a01b0316638b78c6d8198181546000805160206133e48339815191528580a35580f35b637448fbae8352601cfd5b5034610c04576020366003190112610c0457610b5a61225e565b610b62613354565b610b7960ff68a20d6e21d0e5255316541615613254565b610b82816124ee565b60016003820191825490610b9960ff831615613298565b600281015480610bf0575b505060ff191617905568a20d6e21d0e5255315805490600160401b821015610bdd5781610a3f916001610bda95940190556125d8565b80f35b634e487b7160e01b845260418552602484fd5b610bfa849161244b565b9101558680610ba4565b80fd5b509060203660031901126100cf57610c1d61225e565b90610c26613354565b63389a75e1600c528183526020600c209081544211610c6a575082905560018060a01b0316638b78c6d8198181546000805160206133e48339815191528580a35580f35b636f5e88188452601cfd5b50829034610c045780600319360112610c04575060ff60209254915191831c1615158152f35b5082346100cf57806003193601126100cf5780602092610cb961225e565b610cca610cc4612279565b916122cb565b6001600160a01b039091168252845220549051908152f35b5034610c045780600319360112610c0457610cfb613354565b68a20d6e21d0e5255316805460ff1916600117905580f35b50829034610c045780600319360112610c04575060ff6020925460181c1690519015158152f35b50913461012957602091826003193601126106c757600192813591906001600160a01b03610d6c61017485881b612536565b541615610f8857859291829072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8281811015610f7b575b50506d04ee2d6d415b85acef810000000080831015610f6d575b50662386f26fc1000080831015610f5e575b506305f5e10080831015610f4f575b5061271080831015610f43575b50506064811015610f35575b85600a80921015610f2b575b840192866021610e20610e0b8761274b565b96610e188a519889612714565b80885261274b565b8686019790601f1901368937860101905b610efc575b5050508351948660035491610e4a836126da565b92818116908115610edd5750600114610ea2575b610e9e8888610e946005838e80610e798e8e5193849161220f565b0164173539b7b760d91b815203601a19810185520183612714565b5191829182612232565b0390f35b9091929750600382528782205b838310610eca57505050840190940193838282610e79610e5e565b80548884018a0152918801918101610eaf565b60ff1916858a0152505050801515028501019450838282610e79610e5e565b600019019082906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304908782610e315750610e36565b9093019285610df9565b606460029104930192610ded565b94019390048780610de1565b60089195920491019388610dd4565b60109195920491019388610dc5565b839195920491019388610db3565b8796500491508880610d99565b50825163677510db60e11b8152fd5b5092503461012957602036600319011261012957803591610fb6613354565b610fcd60ff68a20d6e21d0e5255316541615613254565b60328311610fe557505068a20d6e21d0e525530c5580f35b906020608492519162461bcd60e51b8352820152602260248201527f5265666c656374696f6e7320666565206d757374206265203525206f72206c65604482015261737360f01b6064820152fd5b5090346100cf57816003193601126100cf5761104d613371565b805462ff000019166201000017905580f35b50913461012957602036600319011261012957813563ffffffff811681036106c757611089613371565b82549160ff8360101c166110b9575063ffffffff60481b1990911660489190911b63ffffffff60481b1617905580f35b516303cb96db60e21b81528390fd5b5090346100cf57816003193601126100cf576110e2613371565b805463ff0000001916630100000017905580f35b5082346100cf57816003193601126100cf5760209068a20d6e21d0e525530b549051908152f35b5082346100cf57806003193601126100cf5760209061114761113d61225e565b60243590336127ab565b5160018152f35b5082346100cf57816003193601126100cf5780519082600254611170816126da565b808552906001908181169081156111f5575060011461119c575b505050610e9482610e9e940383612714565b60028352602095507f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106111e25750505082610e9e94610e94928201019461118a565b80548685018801529286019281016111c6565b610e9e9750610e949450602092508693915060ff191682840152151560051b8201019461118a565b50913461012957602036600319011261012957813563ffffffff811681036106c757611247613371565b82549160ff8360201c166110b9575063ffffffff60281b9060281b169063ffffffff60281b191617905580f35b5082346100cf57816003193601126100cf57638b78c6d8195490516001600160a01b039091168152602090f35b5090346100cf57816003193601126100cf576112bb613354565b805460ff60681b1916600160681b17905580f35b5082346100cf57816003193601126100cf576020905160018152f35b5080600319360112610c04576112ff613354565b80638b78c6d8198181546000805160206133e48339815191528280a35580f35b5082346100cf5760203660031901126100cf5760209061134561134061225e565b612353565b9051908152f35b5090346100cf57816003193601126100cf57611366613371565b805461ff00191661010017905580f35b50829034610c045780600319360112610c04575060ff602092541690519015158152f35b509250346101295781600319360112610129576001600160401b0390803582811161165b576113cc903690830161229e565b939091602435848111611657576113e6903690830161229e565b9490926113f1613371565b60ff835460081c166116485750808611611635576001958061141388546126da565b95601f968781116115e5575b50899087831160011461157f578a92611574575b5050600019600383901b1c191690871b1786555b841161156157506114596002546126da565b82811161151b575b508491831160011461149a57928293918392869461148f575b50501b916000199060031b1c19161760025580f35b01359250388061147a565b600285527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9183601f1981168760205b8883831061150157505050106114e7575b505050811b0160025580f35b0135600019600384901b60f8161c191690553880806114db565b8686013588559096019593840193879350908101906114ca565b60028652602086208380860160051c82019260208710611558575b0160051c019085905b82811061154d575050611461565b87815501859061153f565b92508192611536565b634e487b7160e01b865260419052602485fd5b013590503880611433565b898b526020808c208b95509290601f198516908d905b8282106115cc57505084116115b2575b505050811b018655611447565b0135600019600384901b60f8161c191690553880806115a5565b8385013586558d97909501949283019290810190611595565b909150888a5260208a208780850160051c8201926020861061162c575b918b91869594930160051c01915b82811061161e57505061141f565b8c81558594508b9101611610565b92508192611602565b634e487b7160e01b875260418252602487fd5b516303cb96db60e21b81529050fd5b8680fd5b8480fd5b5082346100cf5760209283600319360112610129576001600160401b0390803582811161165b57611693903690830161229e565b92909361169e613371565b60ff835416611648575082116117a557506003916116bc83546126da565b601f8111611762575b508394601f83116001146117015750938394829394926116f6575b50508160011b9160001990841b1c191617905580f35b0135905084806116e0565b90601f198316958486528286209286905b88821061174a57505083600195969710611732575b505050811b01905580f35b013560001983861b60f8161c19169055848080611727565b80600184968294958701358155019501920190611712565b838552858520601f840160051c81019187851061179b575b601f0160051c01905b81811061179057506116c5565b858155600101611783565b909150819061177a565b634e487b7160e01b845260419052602483fd5b5080600319360112610c045763389a75e1600c52338152806020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c928280a280f35b5090346100cf57816003193601126100cf57611818613371565b805460ff1916600117905580f35b5082346100cf57806003193601126100cf5761184061225e565b61184861228f565b91611851613371565b60ff855460181c166118975750908161186c610bda936122ed565b5460016001600160581b0382169315159160571c161515031561323057600160571b90911890613230565b516303cb96db60e21b81528490fd5b50829034610c045780600319360112610c04575063ffffffff6020925460481c169051908152f35b5082346100cf57806003193601126100cf576020916118eb61225e565b90638b78c6d8600c525260243582600c20541615159051908152f35b5082346100cf57816003193601126100cf5768a20d6e21d0e525530d5490516001600160a01b039091168152602090f35b5082600319360112610c0457610bda61194f61225e565b611957613354565b6024359061339c565b50829034610c045780600319360112610c04575060ff6020925460101c1690519015158152f35b50829034610c045781600319360112610c0457506113456020926119a961228f565b90356123af565b509250346101295760a0366003190112610129578035906001600160a01b036044358181168082036116575760643592808416809403611c5e57608435908116809103611c5e576119ff613371565b60018060a01b03199384600554161760055583600654161760065568a20d6e21d0e52553089163ffffffff835460201c16611c4e578115611c3e57876024601c82602094630f4599e582523386525af160018851141615611c3257815492640100000000918263ffffffff60201b19861617845568a20d6e21d0e525530d9182541617905560243587558415928315611ad2575b50505050505050610bda611aa6336122ed565b546001806001600160581b0383169260571c16151503611ac7575b33613230565b600160571b18611ac1565b3315611c22576b0de0b6b39983494c589bffff8611611c125777ffffffffffffffffffffffff00000000ffffffff000000001916606086901b6bffffffffffffffffffffffff60601b161717905568a20d6e21d0e5255309839055611bff575068a20d6e21d0e525530a81600019061981556002611b4f336124ee565b91611b636001600160601b03851684612fb3565b5491015581519081528260008051602061340483398151915260203393a3611b8a336124ee565b805460581c90600160028316151503611bd7575b505051600181527fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039360203392a238808080808080611a93565b805460ff60581b191660ff9290921660021860581b60ff60581b169190911790553880611b9e565b634e487b7160e01b845260129052602483fd5b865163e5cfe95760e01b81528590fd5b8651633a954ecd60e21b81528590fd5b8363d125259c8852601cfd5b86516339a84a7b60e01b81528590fd5b8651633ab534b960e21b81528590fd5b8780fd5b5090346100cf57816003193601126100cf57611c7c613371565b8138818047335af115611c8d575080f35b63b12d13eb8252601cfd5b5082346100cf5760203660031901126100cf576020906001611cc0611cbb61225e565b6122ed565b5460571c1615159051908152f35b5082346100cf57816003193601126100cf576020905160128152f35b5082346100cf5760203660031901126100cf57602091611d0861225e565b90638b78c6d8600c525281600c20549051908152f35b50829034610c04576020366003190112610c0457506113456020923561244b565b5092503461012957602036600319011261012957359081151580920361012957611d68336124ee565b805460581c908360028316151503611daa575b5050519081527fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039360203392a280f35b805460ff60581b191660ff9290921660021860581b60ff60581b169190911790553880611d7b565b5082346100cf5760203660031901126100cf57602090611df8611df361225e565b6124c9565b90519015158152f35b5080600319360112610c045763389a75e1600c523381526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d8280a280f35b50829034610c04576060366003190112610c0457611e6861225e565b611e70612279565b9160443594611e7e836122cb565b338352602052848220549060018201611ea0575b6020866111478988886127ab565b818711611ecf5750916111479391858760209895611ebd856122cb565b3385528a520391205591948193611e92565b85516313be252b60e01b8152fd5b5090346100cf57816003193601126100cf57611ef7613371565b805464ff00000000191664010000000017905580f35b5082346100cf57806003193601126100cf57602091611f2a61225e565b60243591638b78c6d8600c52528083600c205416149051908152f35b5082600319360112610c0457611f5a61225e565b611f62613354565b638b78c6d8600c5281526020600c20602435815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe268380a380f35b509060203660031901126100cf57610bda90353361339c565b5082346100cf57816003193601126100cf576020906001600160601b0368a20d6e21d0e52553085460601c169051908152f35b50829034610c045780600319360112610c04575060ff6020925460081c1690519015158152f35b5082346100cf57806003193601126100cf576020918161203861225e565b91602435918291612048336122cb565b6001600160a01b039095168082529487522055825190815233907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908590a35160018152f35b5082346100cf57816003193601126100cf578051908260018054906120b2826126da565b808652918181169081156111f557506001146120da57505050610e9482610e9e940383612714565b80955082526020948583205b8284106121025750505082610e9e94610e94928201019461118a565b80548685018801529286019281016120e6565b50913461012957602036600319011261012957813591612134336124ee565b9160ff600384015416612192575050600261214e83612562565b50505050910161215f82825461237f565b905561217668a20d6e21d0e525530a91825461237f565b905561218d68a20d6e21d0e525530b9182546123a2565b905580f35b906020608492519162461bcd60e51b8352820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b6064820152fd5b91905034610c045780600319360112610c04575063ffffffff6020925460281c168152f35b60005b8381106122225750506000910152565b8181015183820152602001612212565b60409160208252612252815180928160208601526020868601910161220f565b601f01601f1916010190565b600435906001600160a01b038216820361227457565b600080fd5b602435906001600160a01b038216820361227457565b60243590811515820361227457565b9181601f84011215612274578235916001600160401b038311612274576020838186019501011161227457565b6001600160a01b0316600090815268a20d6e21d0e52553116020526040902090565b6001600160a01b0316600090815268a20d6e21d0e52553146020526040902090565b6001600160a01b0316600090815268a20d6e21d0e525530f6020526040902090565b6001600160a01b0316600090815268a20d6e21d0e52553126020526040902090565b61235c906122ed565b60ff60038201541661237857600261237591015461244b565b90565b6001015490565b9190820391821161238c57565b634e487b7160e01b600052601160045260246000fd5b9190820180921161238c57565b9068a20d6e21d0e52553095482116123e6576123d5576123ce90612562565b5050505090565b6123de90612562565b505050905090565b60405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606490fd5b8115612435570490565b634e487b7160e01b600052601260045260246000fd5b68a20d6e21d0e525530a548111612471576123759061246b61246b612610565b9061242b565b60405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608490fd5b6124d2816122ed565b5460581c60018116156124e9576002915016151590565b503b90565b906124f8826122ed565b916001835460581c16156125095750565b6001903b61252e575b825460ff60581b191660589190911b60ff60581b16178255565b565b506003612512565b63ffffffff908060031c60005268a20d6e21d0e525531360205260e06040600020549160051b161c1690565b906103e861257a68a20d6e21d0e525530c54846125b6565b04612585818461237f565b906125a561259e61259761246b612610565b80966125b6565b94826125b6565b926125b0848661237f565b93929190565b8181029291811591840414171561238c57565b600019811461238c5760010190565b68a20d6e21d0e525531580548210156125fa5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b68a20d6e21d0e525530a54908168a20d6e21d0e525530954928390600068a20d6e21d0e5255315545b80821061265f57505061264c828261242b565b83106126585750509190565b9350919050565b909561268461266d886125d8565b905460039190911b1c6001600160a01b03166122ed565b9460028601549080821180156126cd575b6126c1579160016126ac6126b5936126bb9561237f565b9701549061237f565b966125c9565b90612639565b50505050915092509190565b5082600188015411612695565b90600182811c9216801561270a575b60208310146126f457565b634e487b7160e01b600052602260045260246000fd5b91607f16916126e9565b90601f801991011681019081106001600160401b0382111761273557604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161273557601f01601f191660200190565b1561276d57565b60405162461bcd60e51b8152602060048201526016602482015275151c98591a5b99c81a5cc81b9bdd08195b98589b195960521b6044820152606490fd5b919060ff60045460681c1615612f05575b6001600160a01b03811615612ef3576127e36001600160a01b038481169083161415612f6d565b6127ec836124ee565b6127f5826124ee565b60405160c081018181106001600160401b03821117612735576040526000815260006020820152600060408201526000606082015263ffffffff835460801c16608082015263ffffffff825460801c1660a082015261285386612353565b8511612ee15761286285612562565b9390919260ff600389015416808091612ed2575b15612da157506128c692506128bf9060018901928b845403845560028a01908154039055600288019081540181556128b96001600160601b03809454168a612fb3565b5461244b565b1685612fb3565b6128db68a20d6e21d0e525530a91825461237f565b90556128f268a20d6e21d0e525530b9182546123a2565b90556080810151835460a01c61290b600054809261242b565b9182810383821102845284549060028260581c1615612d4e575b50505050805160208201510192604051938460408101106001600160401b036040870111176127355760609060408601604052818652600060208701526040519082604083019180835260051b83010160405286520184602001528151612c0a575b506020810151612a41575b5050518051806129f3575b50506040518281526001600160a01b03828116919085169060008051602061340483398151915290602090a36129d38184613109565b6001600160a01b03908116908316036129ea575050565b61252c91613193565b6020600191600093838060a01b0368a20d6e21d0e525530d5416603f19820195869363263c69d6855285601f1985015260051b6044019260231901915af1915114161561227457388061299d565b9591929094612a4f82612331565b9260a0880151916020890151830190612a68858a612ff9565b97612adf68a20d6e21d0e5255308549a612a918c6001600160601b036000549160601c1661242b565b9b63ffffffff8160201c169d63ffffffff60208160401b9201511663ffffffff8360401c160160401b169063ffffffff60401b19161768a20d6e21d0e52553085563ffffffff851690612fd6565b60015b15612bc2575b60009a929a925b63ffffffff612b008260011b612536565b1615612b21576001019a8a8c11612b18575b9a612aef565b60019b50612b12565b6001909b91929399949b612b3c63ffffffff8216888b6130dc565b8187019668a20d6e21d0e52553136020528160021c60005260406000209060c08360061b1682549163ffffffff60201b8a63ffffffff169160201b161782821c186001600160401b0316901b18905560208a8101518260081b8a60601b178152018a6020015201988a8a11612bb9575b9a93989a92919092612ae2565b60019950612bac565b828503612ae857975097505096919392505063ffffffff60201b68a20d6e21d0e5255308549160201b169063ffffffff60201b19161768a20d6e21d0e5255308553880612992565b9692959491612c1b86959295612331565b94608081015198612c6f825191828c039268a20d6e21d0e52553089081549063ffffffff8060401b911663ffffffff8360401c160360401b169063ffffffff60401b191617905563ffffffff831690612fd6565b60015b15612d37575b8899602088999a600164ffffffff00612cb660009560001901809d9063ffffffff918160031c60005260205260e06040600020549160051b161c1690565b9268a20d6e21d0e52553138552633fffffff8460021c16600052604060002060c08560061b1681549081811c6001600160401b0316901b18905563ffffffff841660005268a20d6e21d0e525531085526040600020838060a01b031981541690558401519260081b168d60601b17178152018b602001529998979699612c72565b808a03612c78575091945091949592965038612987565b612d70936001600160a01b038b8116908a1614612d89575b505060a01c61242b565b60a0820151808203911102602082015238808080612925565b80820391110260808501510360a08501523880612d66565b80158080612ec4575b15612e0057505091612df3612dec92612dfb9460028b0191825403825560028a01908154019055600189019283540183556001600160601b039384915461244b565b1689612fb3565b541685612fb3565b6128c6565b91939180612eb5575b15612e4a5750506128bf612dfb926128b9612e439360028b0190815403815560028a019283540183556001600160601b039485915461244b565b168a612fb3565b80612ea7575b612e5d575b5050506128c6565b612e9f9260018901928b845403845560028a019081540390556002880190815401905560018701908154018155612df36001600160601b038093541689612fb3565b388080612e55565b5060ff600388015416612e50565b5060ff60038901541615612e09565b5060ff60038a015416612daa565b5060ff60038901541615612876565b604051631e9acf1760e31b8152600490fd5b604051633a954ecd60e21b8152600490fd5b638b78c6d81954612f2d906001600160a01b03908116338114918215612f32575b5050612766565b6127bc565b809192506005541633149182612f61575b508115612f53575b503880612f26565b905060065416331438612f4b565b86821614915038612f43565b15612f7457565b60405162461bcd60e51b815260206004820152601760248201527621b0b73737ba103a3930b739b332b9103a379039b2b63360491b6044820152606490fd5b80546001600160a01b031660a09290921b6001600160a01b031916919091179055565b805463ffffffff60801b191660809290921b63ffffffff60801b16919091179055565b805460601c63ffffffff908116939290841561301457505050565b9091935068a20d6e21d0e5255308908154918183169282841461238c5763ffffffff191660019390930191821692909217909155835463ffffffff60601b1916606082901b63ffffffff60601b16179093556130888363ffffffff1660005268a20d6e21d0e525530e602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b9068a20d6e21d0e52553136020528160031c60005260e060406000209260051b1682549182821c1863ffffffff16901b189055565b9190916020528160031c60005260e060406000209260051b1682549182821c1863ffffffff16901b189055565b9063ffffffff60045460281c16801561318e5761312582612353565b9060005402101561318a5761313b6001916122ed565b5460571c1661318757638b78c6d819546001600160a01b0382811691161461318757638b78c6d8600c5260005260016020600c20541661252c576040516303cab2ff60e21b8152600490fd5b50565b5050565b505050565b9063ffffffff60045460481c1690811561318e576131c3906001600160581b036131bc856122ed565b54166132e4565b60028193929310156131db575b505061252c91613230565b8002026301312d0080821015613228575b50600160109180821783526078605b820491110260005b81810361321c57505050511561321a5738806131d0565bfe5b83802084528201613203565b9050386131ec565b6132416001600160581b03916122ed565b91166001600160581b0319825416179055565b1561325b57565b60405162461bcd60e51b8152602060048201526015602482015274119d5b98dd1a5bdb881a5cc81c995b9bdd5b98d959605a1b6044820152606490fd5b1561329f57565b60405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606490fd5b91909160018160571c1661334d57637fffffff8062015180420416908260381c169366ffffffffffffff8093169180860361333e575b508291620de0b6936001600160581b039260281c16019460381b1690841617920490565b945060009150620de0b661331a565b9150600090565b638b78c6d81954330361336357565b6382b429006000526004601cfd5b638b78c6d81954330361338057565b638b78c6d8600c523360005260016020600c2054161561336357565b638b78c6d8600c526000526020600c2090815490811618809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a356fe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220e1e8d2b7595230fb6e3cadcc3b84c3b261fa6ffc6d57e15b195430cf8afdff3364736f6c63430008140033

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.