ERC-20
Overview
Max Total Supply
10,000,000,000 ASH
Holders
54
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
Phoenix
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {DN404} from "./vendor/DN404.sol"; import {DN404Mirror} from "./vendor/DN404Mirror.sol"; contract Phoenix is DN404 { using Strings for uint256; uint256 public constant MAX_SUPPLY = 10_000_000_000 ether; string private _name; string private _symbol; string private constant _baseURI = "ipfs://bafybeigxeax4gimatuqwckllxh2spsbaujim3rjgatezq2iri4pfvf6nim/"; constructor( string memory name_, string memory symbol_, address initialSupplyOwner ) { _name = name_; _symbol = symbol_; address mirror = address(new DN404Mirror(msg.sender)); _initializeDN404(MAX_SUPPLY, initialSupplyOwner, mirror); } function _unit() internal pure override returns (uint256) { return 10_000_000 ether; } function name() public view override returns (string memory) { return _name; } function symbol() public view override returns (string memory) { return _symbol; } function tokenURI( uint256 tokenId ) public pure override returns (string memory result) { if (bytes(_baseURI).length != 0) { result = string( abi.encodePacked(_baseURI, tokenId.toString(), ".json") ); } } }
// 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; } }
// 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); } } }
// 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)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @title DN404 /// @notice DN404 is a hybrid ERC20 and ERC721 implementation that mints /// and burns NFTs based on an account's ERC20 token balance. /// /// @author vectorized.eth (@optimizoor) /// @author Quit (@0xQuit) /// @author Michael Amadi (@AmadiMichaels) /// @author cygaar (@0xCygaar) /// @author Thomas (@0xjustadev) /// @author Harrison (@PopPunkOnChain) /// /// @dev Note: /// - The ERC721 data is stored in this base DN404 contract, however a /// DN404Mirror contract ***MUST*** be deployed and linked during /// initialization. abstract contract DN404 { /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* EVENTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Emitted when `amount` tokens is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 amount); /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`. event Approval( address indexed owner, address indexed spender, uint256 amount ); /// @dev Emitted when `target` sets their skipNFT flag to `status`. event SkipNFTSet(address indexed target, bool status); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Thrown when attempting to double-initialize the contract. error DNAlreadyInitialized(); /// @dev Thrown when attempting to transfer or burn more tokens than sender's balance. error InsufficientBalance(); /// @dev Thrown when a spender attempts to transfer tokens with an insufficient allowance. error InsufficientAllowance(); /// @dev Thrown when minting an amount of tokens that would overflow the max tokens. error TotalSupplyOverflow(); /// @dev The unit cannot be zero. error UnitIsZero(); /// @dev Thrown when the caller for a fallback NFT function is not the mirror contract. error SenderNotMirror(); /// @dev Thrown when attempting to transfer tokens to the zero address. error TransferToZeroAddress(); /// @dev Thrown when the mirror address provided for initialization is the zero address. error MirrorAddressIsZero(); /// @dev Thrown when the link call to the mirror contract reverts. error LinkMirrorContractFailed(); /// @dev Thrown when setting an NFT token approval /// and the caller is not the owner or an approved operator. error ApprovalCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT /// and the caller is not the owner or an approved operator. error TransferCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT and the from address is not the current owner. error TransferFromIncorrectOwner(); /// @dev Thrown when checking the owner or approved address for an non-existent NFT. error TokenDoesNotExist(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTANTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev The flag to denote that the address data is initialized. uint8 internal constant _ADDRESS_DATA_INITIALIZED_FLAG = 1 << 0; /// @dev The flag to denote that the address should skip NFTs. uint8 internal constant _ADDRESS_DATA_SKIP_NFT_FLAG = 1 << 1; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct containing an address's token data and settings. struct AddressData { // Auxiliary data. uint88 aux; // Flags for `initialized` and `skipNFT`. uint8 flags; // The alias for the address. Zero means absence of an alias. uint32 addressAlias; // The number of NFT tokens. uint32 ownedLength; // The token balance in wei. uint96 balance; } /// @dev A uint32 map in storage. struct Uint32Map { mapping(uint256 => uint256) map; } /// @dev A struct to wrap a uint256 in storage. struct Uint256Ref { uint256 value; } /// @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; // 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 => Uint256Ref)) 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; } /// @dev Returns a storage pointer for DN404Storage. function _getDN404Storage() internal pure virtual returns (DN404Storage storage $) { /// @solidity memory-safe-assembly assembly { // `uint72(bytes9(keccak256("DN404_STORAGE")))`. $.slot := 0xa20d6e21d0e5255308 // Truncate to 9 bytes to reduce bytecode size. } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INITIALIZER */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Initializes the DN404 contract with an /// `initialTokenSupply`, `initialTokenOwner` and `mirror` NFT contract address. function _initializeDN404( uint256 initialTokenSupply, address initialSupplyOwner, address mirror ) internal virtual { DN404Storage storage $ = _getDN404Storage(); if ($.nextTokenId != 0) revert DNAlreadyInitialized(); if (mirror == address(0)) revert MirrorAddressIsZero(); /// @solidity memory-safe-assembly assembly { // Make the call to link the mirror contract. mstore(0x00, 0x0f4599e5) // `linkMirrorContract(address)`. mstore(0x20, caller()) if iszero( and( eq(mload(0x00), 1), call(gas(), mirror, 0, 0x1c, 0x24, 0x00, 0x20) ) ) { mstore(0x00, 0xd125259c) // `LinkMirrorContractFailed()`. revert(0x1c, 0x04) } } $.nextTokenId = 1; $.mirrorERC721 = mirror; if (_unit() == 0) revert UnitIsZero(); if (initialTokenSupply != 0) { if (initialSupplyOwner == address(0)) revert TransferToZeroAddress(); if (_totalSupplyOverflows(initialTokenSupply) != 0) revert TotalSupplyOverflow(); $.totalSupply = uint96(initialTokenSupply); AddressData storage initialOwnerAddressData = _addressData( initialSupplyOwner ); initialOwnerAddressData.balance = uint96(initialTokenSupply); /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, initialTokenSupply) log3( 0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, initialSupplyOwner)) ) } _setSkipNFT(initialSupplyOwner, true); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* BASE UNIT FUNCTION TO OVERRIDE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Amount of token balance that is equal to one NFT. function _unit() internal view virtual returns (uint256) { return 10 ** 18; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* METADATA FUNCTIONS TO OVERRIDE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the name of the token. function name() public view virtual returns (string memory); /// @dev Returns the symbol of the token. function symbol() public view virtual returns (string memory); /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. function tokenURI(uint256 id) public view virtual returns (string memory); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* ERC20 OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the decimals places of the token. Always 18. function decimals() public pure returns (uint8) { return 18; } /// @dev Returns the amount of tokens in existence. function totalSupply() public view virtual returns (uint256) { return uint256(_getDN404Storage().totalSupply); } /// @dev Returns the amount of tokens owned by `owner`. function balanceOf(address owner) public view virtual returns (uint256) { return _getDN404Storage().addressData[owner].balance; } /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`. function allowance( address owner, address spender ) public view returns (uint256) { return _getDN404Storage().allowance[owner][spender].value; } /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. /// /// Emits a {Approval} event. function approve( address spender, uint256 amount ) public virtual returns (bool) { _approve(msg.sender, spender, amount); return true; } /// @dev Transfer `amount` tokens from the caller to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// /// Emits a {Transfer} event. function transfer( address to, uint256 amount ) public virtual returns (bool) { _transfer(msg.sender, to, amount); return true; } /// @dev Transfers `amount` tokens from `from` to `to`. /// /// Note: Does not update the allowance if it is the maximum uint256 value. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. /// /// Emits a {Transfer} event. function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { Uint256Ref storage a = _getDN404Storage().allowance[from][msg.sender]; uint256 allowed = a.value; if (allowed != type(uint256).max) { if (amount > allowed) revert InsufficientAllowance(); unchecked { a.value = allowed - amount; } } _transfer(from, to, amount); return true; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 totalSupply_ = uint256($.totalSupply) + amount; if ( _totalSupplyOverflows(totalSupply_) | _toUint(totalSupply_ < amount) != 0 ) { revert TotalSupplyOverflow(); } $.totalSupply = uint96(totalSupply_); 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 / _unit(); _PackedLogs memory packedLogs = _packedLogsMalloc( _zeroFloorSub(toEnd, toIndex) ); Uint32Map storage oo = $.oo; if (packedLogs.logs.length != 0) { uint256 maxNFTId = totalSupply_ / _unit(); 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); } } } /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, amount) log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, to))) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL BURN FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Burns `amount` tokens from `from`, reducing the total supply. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Emits a {Transfer} event. function _burn(address from, uint256 amount) internal virtual { 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 / _unit() ); if (nftAmountToBurn != 0) { $.totalNFTSupply -= uint32(nftAmountToBurn); _PackedLogs memory packedLogs = _packedLogsMalloc( nftAmountToBurn ); Uint32Map storage oo = $.oo; 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); } } /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, amount) log3( 0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0 ) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL TRANSFER FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Moves `amount` of tokens from `from` to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Emits a {Transfer} event. function _transfer( address from, address to, uint256 amount ) internal virtual { if (to == address(0)) revert TransferToZeroAddress(); DN404Storage storage $ = _getDN404Storage(); AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); _TransferTemps memory t; t.fromOwnedLength = fromAddressData.ownedLength; t.toOwnedLength = toAddressData.ownedLength; t.fromBalance = fromAddressData.balance; if (amount > t.fromBalance) revert InsufficientBalance(); unchecked { t.fromBalance -= amount; fromAddressData.balance = uint96(t.fromBalance); toAddressData.balance = uint96( t.toBalance = toAddressData.balance + amount ); t.nftAmountToBurn = _zeroFloorSub( t.fromOwnedLength, t.fromBalance / _unit() ); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { if (from == to) t.toOwnedLength = t.fromOwnedLength - t.nftAmountToBurn; t.nftAmountToMint = _zeroFloorSub( t.toBalance / _unit(), t.toOwnedLength ); } _PackedLogs memory packedLogs = _packedLogsMalloc( t.nftAmountToBurn + t.nftAmountToMint ); Uint32Map storage oo = $.oo; 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 / _unit(); 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); } } /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, amount) // forgefmt: disable-next-item log3( 0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), shr(96, shl(96, to)) ) } } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Call must originate from the mirror contract. /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// `msgSender` must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _transferFromNFT( address from, address to, uint256 id, address msgSender ) internal virtual { DN404Storage storage $ = _getDN404Storage(); if (to == address(0)) revert TransferToZeroAddress(); Uint32Map storage oo = $.oo; if (from != $.aliasToAddress[_get(oo, _ownershipIndex(id))]) { 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); fromAddressData.balance -= uint96(_unit()); unchecked { toAddressData.balance += uint96(_unit()); mapping(address => Uint32Map) storage owned = $.owned; Uint32Map storage fromOwned = owned[from]; _set( oo, _ownershipIndex(id), _registerAndResolveAlias(toAddressData, to) ); delete $.tokenApprovals[id]; uint256 updatedId = _get(fromOwned, --fromAddressData.ownedLength); _set(fromOwned, _get(oo, _ownedIndex(id)), uint32(updatedId)); _set(oo, _ownedIndex(updatedId), _get(oo, _ownedIndex(id))); uint256 n = toAddressData.ownedLength++; _set(owned[to], n, uint32(id)); _set(oo, _ownedIndex(id), uint32(n)); } uint256 unit = _unit(); /// @solidity memory-safe-assembly assembly { // Emit the {Transfer} event. mstore(0x00, unit) // forgefmt: disable-next-item log3( 0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), shr(96, shl(96, to)) ) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL APPROVE FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`. /// /// Emits a {Approval} event. function _approve( address owner, address spender, uint256 amount ) internal virtual { _getDN404Storage().allowance[owner][spender].value = amount; /// @solidity memory-safe-assembly assembly { // Emit the {Approval} event. mstore(0x00, amount) // forgefmt: disable-next-item log3( 0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, shl(96, owner)), shr(96, shl(96, spender)) ) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* DATA HITCHHIKING FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the auxiliary data for `owner`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _getAux(address owner) internal view virtual returns (uint88) { return _getDN404Storage().addressData[owner].aux; } /// @dev Set the auxiliary data for `owner` to `value`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _setAux(address owner, uint88 value) internal virtual { _getDN404Storage().addressData[owner].aux = value; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* SKIP NFT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns true if account `owner` will skip NFT minting on token mints and transfers. /// Returns false if account `owner` will mint NFTs on token mints and transfers. function getSkipNFT(address owner) public view virtual returns (bool) { AddressData storage d = _getDN404Storage().addressData[owner]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) return _hasCode(owner); return d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0; } /// @dev Sets the caller's skipNFT flag to `skipNFT` /// /// Emits a {SkipNFTSet} event. function setSkipNFT(bool skipNFT) public virtual { _setSkipNFT(msg.sender, skipNFT); } /// @dev Internal function to set account `owner` skipNFT flag to `state` /// /// Initializes account `owner` AddressData if it is not currently initialized. /// /// Emits a {SkipNFTSet} event. function _setSkipNFT(address owner, bool state) internal virtual { AddressData storage d = _addressData(owner); if ((d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0) != state) { d.flags ^= _ADDRESS_DATA_SKIP_NFT_FLAG; } emit SkipNFTSet(owner, state); } /// @dev Returns a storage data pointer for account `owner` AddressData /// /// Initializes account `owner` AddressData if it is not currently initialized. function _addressData( address owner ) internal virtual returns (AddressData storage d) { d = _getDN404Storage().addressData[owner]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) { uint8 flags = _ADDRESS_DATA_INITIALIZED_FLAG; if (_hasCode(owner)) 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 owner) { DN404Storage storage $ = _getDN404Storage(); owner = $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; if (msgSender != owner) { if (!$.operatorApprovals[owner][msgSender]) { revert ApprovalCallerNotOwnerNorApproved(); } } $.tokenApprovals[id] = spender; } /// @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 Fallback modifier to dispatch calls from the mirror NFT contract /// to internal functions in this contract. modifier dn404Fallback() virtual { DN404Storage storage $ = _getDN404Storage(); uint256 fnSelector = _calldataload(0x00) >> 224; // `transferFromNFT(address,address,uint256,address)`. if (fnSelector == 0xe5eb36c8) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x84) revert(); address from = address(uint160(_calldataload(0x04))); address to = address(uint160(_calldataload(0x24))); uint256 id = _calldataload(0x44); address msgSender = address(uint160(_calldataload(0x64))); _transferFromNFT(from, to, id, msgSender); _return(1); } // `setApprovalForAll(address,bool,address)`. if (fnSelector == 0x813500fc) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x64) revert(); address spender = address(uint160(_calldataload(0x04))); bool status = _calldataload(0x24) != 0; address msgSender = address(uint160(_calldataload(0x44))); _setApprovalForAll(spender, status, msgSender); _return(1); } // `isApprovedForAll(address,address)`. if (fnSelector == 0xe985e9c5) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x44) revert(); address owner = address(uint160(_calldataload(0x04))); address operator = address(uint160(_calldataload(0x24))); _return(_toUint($.operatorApprovals[owner][operator])); } // `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))); } // `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 Returns whether `amount` is a valid `totalSupply`. function _totalSupplyOverflows( uint256 amount ) private view returns (uint256) { unchecked { return _toUint(amount > type(uint96).max) | _toUint(amount / _unit() > type(uint32).max - 1); } } /// @dev Struct containing packed log data for {Transfer} events to be /// emitted by the mirror NFT contract. struct _PackedLogs { uint256 offset; uint256[] logs; } /// @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 { // Note that `p` implicitly allocates and advances the free memory pointer by // 2 words, which we can safely mutate in `_packedLogsSend`. let logs := mload(0x40) mstore(logs, n) // Store the length. let offset := add(0x20, logs) mstore(0x40, add(offset, shl(5, n))) // Allocate memory. mstore(add(0x20, p), logs) // Set `p.logs`. mstore(p, offset) // Set `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(p) mstore(offset, or(or(shl(96, a), shl(8, id)), burnBit)) mstore(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(add(p, 0x20)) 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 `b ? 1 : 0`. function _toUint(bool b) private pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := iszero(iszero(b)) } } /// @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))))) } } }
// 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 The ownership is transferred from `oldOwner` to `newOwner`. /// This is for marketplace signaling purposes. This contract has a `pullOwner()` /// function that will sync the owner from the base contract. event OwnershipTransferred( address indexed oldOwner, address indexed newOwner ); /// @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; address owner; } /// @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) { return _readString(0x06fdde03, 0); // `symbol()`. } /// @dev Returns the token collection symbol from the base DN404 contract. function symbol() public view virtual returns (string memory result) { return _readString(0x95d89b41, 0); // `symbol()`. } /// @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) { return _readString(0xc87b56dd, id); // `tokenURI()`. } /// @dev Returns the total NFT supply from the base DN404 contract. function totalSupply() public view virtual returns (uint256 result) { return _readWord(0xe2c79281, 0, 0); // `totalNFTSupply()`. } /// @dev Returns the number of NFT tokens owned by `nftOwner` from the base DN404 contract. /// /// Requirements: /// - `nftOwner` must not be the zero address. function balanceOf( address nftOwner ) public view virtual returns (uint256 result) { return _readWord(0xf5b100ea, uint160(nftOwner), 0); // `balanceOfNFT(address)`. } /// @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) { return address(uint160(_readWord(0x6352211e, id, 0))); // `ownerOf(uint256)`. } /// @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) { return address(uint160(_readWord(0x081812fc, id, 0))); // `getApproved(uint256)`. } /// @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. // The `approved` value is already at 0x40. 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 `nftOwner` from /// the base DN404 contract. function isApprovedForAll( address nftOwner, address operator ) public view virtual returns (bool result) { // `isApprovedForAll(address,address)`. return _readWord(0xe985e9c5, uint160(nftOwner), uint160(operator)) != 0; } /// @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) ) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* OWNER SYNCING OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the `owner` of the contract, for marketplace signaling purposes. function owner() public view virtual returns (address) { return _getDN404NFTStorage().owner; } /// @dev Permissionless function to pull the owner from the base DN404 contract /// if it implements ownable, for marketplace signaling purposes. function pullOwner() public virtual { address newOwner; address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x8da5cb5b) // `owner()`. if and( gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x20) ) { newOwner := shr(96, mload(0x0c)) } } DN404NFTStorage storage $ = _getDN404NFTStorage(); address oldOwner = $.owner; if (oldOwner != newOwner) { $.owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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 Helper to read a string from the base DN404 contract. function _readString( uint256 fnSelector, uint256 arg0 ) private view returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x00, fnSelector) mstore(0x20, arg0) if iszero(staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) // Copy the offset of the string in returndata. returndatacopy(result, mload(0x00), 0x20) // Copy the length of the string. returndatacopy( add(result, 0x20), add(mload(0x00), 0x20), mload(result) ) // Copy the string. mstore(0x40, add(add(result, 0x20), mload(result))) // Allocate memory. } } /// @dev Helper to read a word from the base DN404 contract. function _readWord( uint256 fnSelector, uint256 arg0, uint256 arg1 ) private view returns (uint256 result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(0x00, fnSelector) mstore(0x20, arg0) mstore(0x40, arg1) 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 := mload(0x00) } } /// @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) } } } }
{ "viaIR": false, "optimizer": { "enabled": true, "runs": 1000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"initialSupplyOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"MirrorAddressIsZero","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":"UnitIsZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"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":"MAX_SUPPLY","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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getSkipNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"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":[{"internalType":"bool","name":"skipNFT","type":"bool"}],"name":"setSkipNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"pure","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"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162002fc938038062002fc9833981016040819052620000349162000475565b600062000042848262000593565b50600162000051838262000593565b5060003360405162000063906200039f565b6001600160a01b039091168152602001604051809103906000f08015801562000090573d6000803e3d6000fd5b509050620000ac6b204fce5e3e250261100000008383620000b6565b505050506200065f565b68a20d6e21d0e52553088054640100000000900463ffffffff1615620000ef57604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b03821662000117576040516339a84a7b60e01b815260040160405180910390fd5b630f4599e560005233602052602060006024601c6000865af1600160005114166200014a5763d125259c6000526004601cfd5b805463ffffffff60201b19166401000000001781556001810180546001600160a01b0384166001600160a01b0319909116179055831562000282576001600160a01b038316620001ad57604051633a954ecd60e21b815260040160405180910390fd5b6001600160601b03841163fffffffe6a084595161401484a0000008604111715620001eb5760405163e5cfe95760e01b815260040160405180910390fd5b8054600160601b600160c01b0319166c010000000000000000000000006001600160601b038616021781556000620002238462000288565b80546001600160601b038716600160a01b026001600160a01b0391821617825560008781529192508516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602082a362000280846001620002fb565b505b50505050565b6001600160a01b038116600090815268a20d6e21d0e525531060205260408120805490916b0100000000000000000000009091046001169003620002f6576001823b15620002d4576002175b815460ff9091166b0100000000000000000000000260ff60581b199091161781555b919050565b6000620003088362000288565b80549091506b01000000000000000000000090046002161515821515146200035457805460ff6b01000000000000000000000080830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d64203938360405162000392911515815260200190565b60405180910390a2505050565b610d68806200226183390190565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620003d557600080fd5b81516001600160401b0380821115620003f257620003f2620003ad565b604051601f8301601f19908116603f011681019082821181831017156200041d576200041d620003ad565b81604052838152602092508660208588010111156200043b57600080fd5b600091505b838210156200045f578582018301518183018401529082019062000440565b6000602085830101528094505050505092915050565b6000806000606084860312156200048b57600080fd5b83516001600160401b0380821115620004a357600080fd5b620004b187838801620003c3565b94506020860151915080821115620004c857600080fd5b50620004d786828701620003c3565b604086015190935090506001600160a01b0381168114620004f757600080fd5b809150509250925092565b600181811c908216806200051757607f821691505b6020821081036200053857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200058e576000816000526020600020601f850160051c81016020861015620005695750805b601f850160051c820191505b818110156200058a5782815560010162000575565b5050505b505050565b81516001600160401b03811115620005af57620005af620003ad565b620005c781620005c0845462000502565b846200053e565b602080601f831160018114620005ff5760008415620005e65750858301515b600019600386901b1c1916600185901b1785556200058a565b600085815260208120601f198616915b8281101562000630578886015182559484019460019091019084016200060f565b50858210156200064f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611bf2806200066f6000396000f3fe6080604052600436106100e15760003560e01c806332cb6b0c1161007f57806395d89b411161005957806395d89b4114610664578063a9059cbb14610679578063c87b56dd14610699578063dd62ed3e146106b9576100e8565b806332cb6b0c146105c15780634ef41efc146105e157806370a0823114610611576100e8565b806323b872dd116100bb57806323b872dd14610545578063274e430b146105655780632a6a935d14610585578063313ce567146105a5576100e8565b806306fdde03146104ae578063095ea7b3146104d957806318160ddd14610509576100e8565b366100e857005b68a20d6e21d0e525530860003560e01c63e5eb36c88190036101665760018201546001600160a01b031633146101315760405163ce5a776b60e01b815260040160405180910390fd5b608436101561013f57600080fd5b60043560243560443560643561015784848484610707565b6101616001610b7d565b505050505b8063813500fc036102005760018201546001600160a01b0316331461019e5760405163ce5a776b60e01b815260040160405180910390fd5b60643610156101ac57600080fd5b6001600160a01b03604435818116600090815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906101fc6001610b7d565b5050505b8063e985e9c50361028b5760018201546001600160a01b031633146102385760405163ce5a776b60e01b815260040160405180910390fd5b604436101561024657600080fd5b6004356001600160a01b038181166000908152600385016020908152604080832060243594851684529091529020546102889060ff161515610b7d565b610b7d565b50505b80636352211e036102f05760018201546001600160a01b031633146102c35760405163ce5a776b60e01b815260040160405180910390fd5b60243610156102d157600080fd5b6004356102ee6102e082610b87565b6001600160a01b0316610b7d565b505b8063d10b6e0c036103515760018201546001600160a01b031633146103285760405163ce5a776b60e01b815260040160405180910390fd5b606436101561033657600080fd5b60043560243560443561034d6102e0848484610bbe565b5050505b8063081812fc036103a85760018201546001600160a01b031633146103895760405163ce5a776b60e01b815260040160405180910390fd5b602436101561039757600080fd5b6004356103a66102e082610cba565b505b8063f5b100ea0361042b5760018201546001600160a01b031633146103e05760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103ee57600080fd5b600435610429610283826001600160a01b0316600090815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b505b8063e2c79281036104975760018201546001600160a01b031633146104635760405163ce5a776b60e01b815260040160405180910390fd5b600436101561047157600080fd5b68a20d6e21d0e5255308546104979068010000000000000000900463ffffffff16610b7d565b8063b7a94eb8036104ac576104ac6001610b7d565b005b3480156104ba57600080fd5b506104c3610d06565b6040516104d09190611925565b60405180910390f35b3480156104e557600080fd5b506104f96104f436600461196f565b610d98565b60405190151581526020016104d0565b34801561051557600080fd5b5068a20d6e21d0e525530854600160601b90046bffffffffffffffffffffffff165b6040519081526020016104d0565b34801561055157600080fd5b506104f9610560366004611999565b610dae565b34801561057157600080fd5b506104f96105803660046119d5565b610e3b565b34801561059157600080fd5b506104ac6105a03660046119f0565b610e8a565b3480156105b157600080fd5b50604051601281526020016104d0565b3480156105cd57600080fd5b506105376b204fce5e3e2502611000000081565b3480156105ed57600080fd5b5068a20d6e21d0e5255309546040516001600160a01b0390911681526020016104d0565b34801561061d57600080fd5b5061053761062c3660046119d5565b6001600160a01b0316600090815268a20d6e21d0e52553106020526040902054600160a01b90046bffffffffffffffffffffffff1690565b34801561067057600080fd5b506104c3610e97565b34801561068557600080fd5b506104f961069436600461196f565b610ea6565b3480156106a557600080fd5b506104c36106b4366004611a12565b610eb3565b3480156106c557600080fd5b506105376106d4366004611a2b565b6001600160a01b03918216600090815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b68a20d6e21d0e52553086001600160a01b03841661073857604051633a954ecd60e21b815260040160405180910390fd5b60078101600282016000610773836107508860011b90565b600381901c600090815260209290925260409091205460059190911b60e0161c90565b63ffffffff1681526020810191909152604001600020546001600160a01b038781169116146107ce576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316836001600160a01b03161461086b576001600160a01b03808716600090815260038401602090815260408083209387168352929052205460ff1661086b5760008481526004830160205260409020546001600160a01b0384811691161461086b576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061087687610f1e565b9050600061088387610f1e565b90506a084595161401484a000000825483906014906108b8908490600160a01b90046bffffffffffffffffffffffff16611a74565b92506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506108f86a084595161401484a00000090565b81546bffffffffffffffffffffffff600160a01b8083048216909301169091026001600160a01b03918216178255881660009081526006850160208190526040909120610987856109498a60011b90565b610953868d610f86565b826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b60008881526004870160209081526040808320805473ffffffffffffffffffffffffffffffffffffffff19169055865463ffffffff60801b198116600160801b9182900463ffffffff90811660001901908116909202178855631fffffff600382901c1684529184905282205460059190911b60e0161c63ffffffff169050610a5482610a198860018d811b01610750565b63ffffffff1683826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b610a6d86600183811b016109538960018e811b01610750565b835463ffffffff60801b198116600160801b9182900463ffffffff8181166001810182169094029290921787556001600160a01b038d16600090815260208781526040808320909152631fffffff600384901c1682529020805460e060059390931b9290921682811c8e1890931690921b189055610b208760018c811b0183826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b505050506000610b386a084595161401484a00000090565b9050806000528760601b60601c8960601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a3505050505050505050565b8060005260206000f35b6000610b928261104e565b610baf5760405163677510db60e11b815260040160405180910390fd5b610bb88261106b565b92915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a82610bec68a20d6e21d0e525530f600188901b610750565b63ffffffff1681526020810191909152604001600020546001600160a01b03908116925083168214610c79576001600160a01b03808316600090815260038301602090815260408083209387168352929052205460ff16610c79576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009384526004016020526040909220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039490941693909317909255919050565b6000610cc58261104e565b610ce25760405163677510db60e11b815260040160405180910390fd5b50600090815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b606060008054610d1590611a99565b80601f0160208091040260200160405190810160405280929190818152602001828054610d4190611a99565b8015610d8e5780601f10610d6357610100808354040283529160200191610d8e565b820191906000526020600020905b815481529060010190602001808311610d7157829003601f168201915b5050505050905090565b6000610da53384846110c0565b50600192915050565b6001600160a01b038316600090815268a20d6e21d0e525530d60209081526040808320338452909152812080546000198114610e245780841115610e1e576040517f13be252b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83810382555b610e2f86868661111d565b50600195945050505050565b6001600160a01b038116600090815268a20d6e21d0e5255310602052604081208054600160581b90046001168203610e7757823b5b9392505050565b54600160581b9004600216151592915050565b610e9433826116a5565b50565b606060018054610d1590611a99565b6000610da533848461111d565b6060604051806080016040528060438152602001611b7a604391395115610f1957604051806080016040528060438152602001611b7a60439139610ef68361173d565b604051602001610f07929190611ad3565b60405160208183030381529060405290505b919050565b6001600160a01b038116600090815268a20d6e21d0e52553106020526040812080549091600160581b9091046001169003610f19576001823b15610f60576002175b815460ff909116600160581b026bff000000000000000000000019909116178155919050565b8154600160601b900463ffffffff1668a20d6e21d0e525530860008290036110475780548190600090610fbe9063ffffffff16611b2a565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b82027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff9091161786556000908152600283016020526040902080546001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1990911617905591505b5092915050565b60008061105a8361106b565b6001600160a01b0316141592915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a8261109968a20d6e21d0e525530f600187901b610750565b63ffffffff1681526020810191909152604001600020546001600160a01b03169392505050565b6001600160a01b03838116600081815268a20d6e21d0e525530d6020908152604080832094871680845294825282208590558482527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a3505050565b6001600160a01b03821661114457604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e5255308600061115985610f1e565b9050600061116685610f1e565b90506111a16040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b825463ffffffff600160801b808304821660808501528454041660a08301526bffffffffffffffffffffffff600160a01b9091041660408201819052851115611216576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040810180518690039081905283546bffffffffffffffffffffffff918216600160a01b9081026001600160a01b0392831617865584548181048416890160608601819052909316029116178255608081015161129b9061127f6a084595161401484a00000090565b83604001518161129157611291611b4d565b0480821191030290565b81528154600160581b900460021660000361130d57856001600160a01b0316876001600160a01b0316036112d757805160808201510360a08201525b6113076a084595161401484a0000008260600151816112f8576112f8611b4d565b048260a0015180821191030290565b60208201525b602081810151825160408051808201825260008152606081860190815282519390940180845260051b83018501909152918190529091018152815160078601901561147a576001600160a01b0389166000908152600687016020526040902060808401518451885463ffffffff6801000000000000000080830482168490038216026bffffffff000000000000000019909216919091178a558854918303908116600160801b0263ffffffff60801b199092169190911788555b60001991909101600381901c600090815260208490526040812054919291600584901b60e0161c6020869052633fffffff600282901c16600090815260409020805460c0600684901b1681811c67ffffffffffffffff16901b18905563ffffffff169050600081815260048b0160209081526040909120805473ffffffffffffffffffffffffffffffffffffffff19169055865160608f901b600884901b176001178152018652508082036113c7575050505b60208301511561163e576001600160a01b03881660009081526006870160209081526040822060a0860151918601519092908201906114b9888d610f86565b905060006a084595161401484a0000008b54600160601b90046bffffffffffffffffffffffff16816114ed576114ed611b4d565b8c5460208b01516bffffffff000000000000000019821663ffffffff6801000000000000000080850482169093018116909202178f558c5463ffffffff60801b1916600160801b88831602178d559290910492506401000000009004165b611559876107508360011b90565b63ffffffff16156115785760010181811115611573575060015b61154b565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b1890556020878152600282901c600090815260409020805460c0600685901b1681811c9389901b63ffffffff8816179390931867ffffffffffffffff1690921b9091189055600190940193875160608f901b600883901b178152602001885260010181811115611610575060015b83850361154b578b5463ffffffff9091166401000000000267ffffffff0000000019909116178b5550505050505b602082015151156116625760018601546116629083906001600160a01b03166117dd565b5050846000528560601b60601c8760601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a350505050505050565b60006116b083610f1e565b8054909150600160581b90046002161515821515146116f357805460ff600160581b8083048216600218909116026bff0000000000000000000000199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611730911515815260200190565b60405180910390a2505050565b6060600061174a8361181f565b600101905060008167ffffffffffffffff81111561176a5761176a611b63565b6040519080825280601f01601f191660200182016040528015611794576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a850494508461179e57509392505050565b60208201516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af160018251141661181957600081fd5b50505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611868577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611894576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106118b257662386f26fc10000830492506010015b6305f5e10083106118ca576305f5e100830492506008015b61271083106118de57612710830492506004015b606483106118f0576064830492506002015b600a8310610bb85760010192915050565b60005b8381101561191c578181015183820152602001611904565b50506000910152565b6020815260008251806020840152611944816040850160208701611901565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114610f1957600080fd5b6000806040838503121561198257600080fd5b61198b83611958565b946020939093013593505050565b6000806000606084860312156119ae57600080fd5b6119b784611958565b92506119c560208501611958565b9150604084013590509250925092565b6000602082840312156119e757600080fd5b610e7082611958565b600060208284031215611a0257600080fd5b81358015158114610e7057600080fd5b600060208284031215611a2457600080fd5b5035919050565b60008060408385031215611a3e57600080fd5b611a4783611958565b9150611a5560208401611958565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b6bffffffffffffffffffffffff82811682821603908082111561104757611047611a5e565b600181811c90821680611aad57607f821691505b602082108103611acd57634e487b7160e01b600052602260045260246000fd5b50919050565b60008351611ae5818460208801611901565b835190830190611af9818360208801611901565b7f2e6a736f6e0000000000000000000000000000000000000000000000000000009101908152600501949350505050565b600063ffffffff808316818103611b4357611b43611a5e565b6001019392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fdfe697066733a2f2f6261667962656967786561783467696d6174757177636b6c6c7868327370736261756a696d33726a676174657a71326972693470667666366e696d2fa2646970667358221220785600654ffc720b7b53732cca9e23c087640bd1500db36df739c99385aac6f464736f6c63430008180033608060405234801561001057600080fd5b50604051610d68380380610d6883398101604081905261002f9161005c565b683602298b8c10b0123180546001600160a01b0319166001600160a01b039290921691909117905561008c565b60006020828403121561006e57600080fd5b81516001600160a01b038116811461008557600080fd5b9392505050565b610ccd8061009b6000396000f3fe6080604052600436106101125760003560e01c80636cef16e6116100a557806397e5311c11610074578063b88d4fde11610059578063b88d4fde146104c1578063c87b56dd146104e1578063e985e9c51461050157610119565b806397e5311c1461048c578063a22cb465146104a157610119565b80636cef16e61461041c57806370a08231146104315780638da5cb5b1461045157806395d89b411461047757610119565b806318160ddd116100e157806318160ddd146103a657806323b872dd146103c957806342842e0e146103e95780636352211e146103fc57610119565b806301ffc9a7146102da57806306fdde031461032c578063081812fc1461034e578063095ea7b31461038657610119565b3661011957005b683602298b8c10b0123060003560e01c63263c69d68190036101fe5781546001600160a01b03163314610178576040517f363cb31200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602036103d60003e6004356024018036103d60003e602081033560051b81018036103d60003e5b8082146101f15781358060601c816001168260a01b60a81c811583028284027fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a450505081602001915061019f565b5050600160005260206000f35b80630f4599e5036102d85760018201546001600160a01b03161561026d5760018201546001600160a01b03166004356001600160a01b03161461026d576040517fc59ec47a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81546001600160a01b0316156102af576040517fbf656a4600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815473ffffffffffffffffffffffffffffffffffffffff19163317825560016000908152602090f35b005b3480156102e657600080fd5b506103176102f5366004610a3f565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020015b60405180910390f35b34801561033857600080fd5b50610341610521565b6040516103239190610a88565b34801561035a57600080fd5b5061036e610369366004610ad7565b610537565b6040516001600160a01b039091168152602001610323565b34801561039257600080fd5b506102d86103a1366004610b0c565b61054f565b3480156103b257600080fd5b506103bb6105d5565b604051908152602001610323565b3480156103d557600080fd5b506102d86103e4366004610b36565b6105e7565b6102d86103f7366004610b36565b610676565b34801561040857600080fd5b5061036e610417366004610ad7565b6106a8565b34801561042857600080fd5b506102d86106ba565b34801561043d57600080fd5b506103bb61044c366004610b72565b61077a565b34801561045d57600080fd5b50683602298b8c10b01232546001600160a01b031661036e565b34801561048357600080fd5b50610341610795565b34801561049857600080fd5b5061036e6107a6565b3480156104ad57600080fd5b506102d86104bc366004610b8d565b6107f4565b3480156104cd57600080fd5b506102d86104dc366004610bc9565b610877565b3480156104ed57600080fd5b506103416104fc366004610ad7565b6108d2565b34801561050d57600080fd5b5061031761051c366004610c64565b6108e2565b60606105326306fdde03600061090e565b905090565b600061054963081812fc83600061096b565b92915050565b60006105596107a6565b90508260601b60601c925060405163d10b6e0c600052836020528260405233606052602060006064601c34865af1601f3d1116610599573d6000823e3d81fd5b806040525060006060528183600c5160601c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600038a4505050565b600061053263e2c7928160008061096b565b60006105f16107a6565b90508360601b60601c93508260601b60601c925060405163e5eb36c881528460208201528360408201528260608201523360808201526020816084601c840134865af1600182511416610647573d6000823e3d81fd5b508183857fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a450505050565b6106818383836105e7565b813b156106a3576106a3838383604051806020016040528060008152506109b3565b505050565b6000610549636352211e83600061096b565b6000806106c56107a6565b9050638da5cb5b600052602060006004601c845afa601f3d1116156106ed57600c5160601c91505b683602298b8c10b0123254683602298b8c10b01230906001600160a01b0390811690841681146107745760028201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925560405190918316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35b50505050565b600061054963f5b100ea836001600160a01b0316600061096b565b60606105326395d89b41600061090e565b683602298b8c10b01230546001600160a01b0316806107f1576040517f5b2a47ae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90565b60006107fe6107a6565b90508260601b60601c925060405163813500fc6000528360205282151560405233606052602060006064601c34865af160016000511416610842573d6000823e3d81fd5b83337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206040a36040525050600060605250565b6108828585856105e7565b833b156108cb576108cb85858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109b392505050565b5050505050565b606061054963c87b56dd8361090e565b600061090563e985e9c5846001600160a01b0316846001600160a01b031661096b565b15159392505050565b6060600061091a6107a6565b9050604051915083600052826020526000806024601c845afa610940573d6000833e3d82fd5b60206000803e6020600051833e8151602060005101602084013e815160208301016040525092915050565b6000806109766107a6565b9050604051856000528460205283604052602060006044601c855afa601f3d11166109a4573d6000823e3d81fd5b60405250506000519392505050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a084015280156109fa578060c08401826020870160045afa505b60208360a48301601c860160008a5af1610a1d573d15610a1d573d6000843e3d83fd5b508060e01b825114610a375763d1a57ed66000526004601cfd5b505050505050565b600060208284031215610a5157600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610a8157600080fd5b9392505050565b60006020808352835180602085015260005b81811015610ab657858101830151858201604001528201610a9a565b506000604082860101526040601f19601f8301168501019250505092915050565b600060208284031215610ae957600080fd5b5035919050565b80356001600160a01b0381168114610b0757600080fd5b919050565b60008060408385031215610b1f57600080fd5b610b2883610af0565b946020939093013593505050565b600080600060608486031215610b4b57600080fd5b610b5484610af0565b9250610b6260208501610af0565b9150604084013590509250925092565b600060208284031215610b8457600080fd5b610a8182610af0565b60008060408385031215610ba057600080fd5b610ba983610af0565b915060208301358015158114610bbe57600080fd5b809150509250929050565b600080600080600060808688031215610be157600080fd5b610bea86610af0565b9450610bf860208701610af0565b935060408601359250606086013567ffffffffffffffff80821115610c1c57600080fd5b818801915088601f830112610c3057600080fd5b813581811115610c3f57600080fd5b896020828501011115610c5157600080fd5b9699959850939650602001949392505050565b60008060408385031215610c7757600080fd5b610c8083610af0565b9150610c8e60208401610af0565b9050925092905056fea2646970667358221220103053f954db8ac1ff5aa8756d2fc2b8269448143eda45dfaf49e1766ffcaa1764736f6c63430008180033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000df9c82e0d976413d1e4b368277f250d805819479000000000000000000000000000000000000000000000000000000000000000750686f656e69780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034153480000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106100e15760003560e01c806332cb6b0c1161007f57806395d89b411161005957806395d89b4114610664578063a9059cbb14610679578063c87b56dd14610699578063dd62ed3e146106b9576100e8565b806332cb6b0c146105c15780634ef41efc146105e157806370a0823114610611576100e8565b806323b872dd116100bb57806323b872dd14610545578063274e430b146105655780632a6a935d14610585578063313ce567146105a5576100e8565b806306fdde03146104ae578063095ea7b3146104d957806318160ddd14610509576100e8565b366100e857005b68a20d6e21d0e525530860003560e01c63e5eb36c88190036101665760018201546001600160a01b031633146101315760405163ce5a776b60e01b815260040160405180910390fd5b608436101561013f57600080fd5b60043560243560443560643561015784848484610707565b6101616001610b7d565b505050505b8063813500fc036102005760018201546001600160a01b0316331461019e5760405163ce5a776b60e01b815260040160405180910390fd5b60643610156101ac57600080fd5b6001600160a01b03604435818116600090815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff19166024351515908117909155906101fc6001610b7d565b5050505b8063e985e9c50361028b5760018201546001600160a01b031633146102385760405163ce5a776b60e01b815260040160405180910390fd5b604436101561024657600080fd5b6004356001600160a01b038181166000908152600385016020908152604080832060243594851684529091529020546102889060ff161515610b7d565b610b7d565b50505b80636352211e036102f05760018201546001600160a01b031633146102c35760405163ce5a776b60e01b815260040160405180910390fd5b60243610156102d157600080fd5b6004356102ee6102e082610b87565b6001600160a01b0316610b7d565b505b8063d10b6e0c036103515760018201546001600160a01b031633146103285760405163ce5a776b60e01b815260040160405180910390fd5b606436101561033657600080fd5b60043560243560443561034d6102e0848484610bbe565b5050505b8063081812fc036103a85760018201546001600160a01b031633146103895760405163ce5a776b60e01b815260040160405180910390fd5b602436101561039757600080fd5b6004356103a66102e082610cba565b505b8063f5b100ea0361042b5760018201546001600160a01b031633146103e05760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103ee57600080fd5b600435610429610283826001600160a01b0316600090815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b505b8063e2c79281036104975760018201546001600160a01b031633146104635760405163ce5a776b60e01b815260040160405180910390fd5b600436101561047157600080fd5b68a20d6e21d0e5255308546104979068010000000000000000900463ffffffff16610b7d565b8063b7a94eb8036104ac576104ac6001610b7d565b005b3480156104ba57600080fd5b506104c3610d06565b6040516104d09190611925565b60405180910390f35b3480156104e557600080fd5b506104f96104f436600461196f565b610d98565b60405190151581526020016104d0565b34801561051557600080fd5b5068a20d6e21d0e525530854600160601b90046bffffffffffffffffffffffff165b6040519081526020016104d0565b34801561055157600080fd5b506104f9610560366004611999565b610dae565b34801561057157600080fd5b506104f96105803660046119d5565b610e3b565b34801561059157600080fd5b506104ac6105a03660046119f0565b610e8a565b3480156105b157600080fd5b50604051601281526020016104d0565b3480156105cd57600080fd5b506105376b204fce5e3e2502611000000081565b3480156105ed57600080fd5b5068a20d6e21d0e5255309546040516001600160a01b0390911681526020016104d0565b34801561061d57600080fd5b5061053761062c3660046119d5565b6001600160a01b0316600090815268a20d6e21d0e52553106020526040902054600160a01b90046bffffffffffffffffffffffff1690565b34801561067057600080fd5b506104c3610e97565b34801561068557600080fd5b506104f961069436600461196f565b610ea6565b3480156106a557600080fd5b506104c36106b4366004611a12565b610eb3565b3480156106c557600080fd5b506105376106d4366004611a2b565b6001600160a01b03918216600090815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b68a20d6e21d0e52553086001600160a01b03841661073857604051633a954ecd60e21b815260040160405180910390fd5b60078101600282016000610773836107508860011b90565b600381901c600090815260209290925260409091205460059190911b60e0161c90565b63ffffffff1681526020810191909152604001600020546001600160a01b038781169116146107ce576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316836001600160a01b03161461086b576001600160a01b03808716600090815260038401602090815260408083209387168352929052205460ff1661086b5760008481526004830160205260409020546001600160a01b0384811691161461086b576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061087687610f1e565b9050600061088387610f1e565b90506a084595161401484a000000825483906014906108b8908490600160a01b90046bffffffffffffffffffffffff16611a74565b92506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506108f86a084595161401484a00000090565b81546bffffffffffffffffffffffff600160a01b8083048216909301169091026001600160a01b03918216178255881660009081526006850160208190526040909120610987856109498a60011b90565b610953868d610f86565b826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b60008881526004870160209081526040808320805473ffffffffffffffffffffffffffffffffffffffff19169055865463ffffffff60801b198116600160801b9182900463ffffffff90811660001901908116909202178855631fffffff600382901c1684529184905282205460059190911b60e0161c63ffffffff169050610a5482610a198860018d811b01610750565b63ffffffff1683826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b610a6d86600183811b016109538960018e811b01610750565b835463ffffffff60801b198116600160801b9182900463ffffffff8181166001810182169094029290921787556001600160a01b038d16600090815260208781526040808320909152631fffffff600384901c1682529020805460e060059390931b9290921682811c8e1890931690921b189055610b208760018c811b0183826020528160031c60005260406000206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b505050506000610b386a084595161401484a00000090565b9050806000528760601b60601c8960601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a3505050505050505050565b8060005260206000f35b6000610b928261104e565b610baf5760405163677510db60e11b815260040160405180910390fd5b610bb88261106b565b92915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a82610bec68a20d6e21d0e525530f600188901b610750565b63ffffffff1681526020810191909152604001600020546001600160a01b03908116925083168214610c79576001600160a01b03808316600090815260038301602090815260408083209387168352929052205460ff16610c79576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009384526004016020526040909220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039490941693909317909255919050565b6000610cc58261104e565b610ce25760405163677510db60e11b815260040160405180910390fd5b50600090815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b606060008054610d1590611a99565b80601f0160208091040260200160405190810160405280929190818152602001828054610d4190611a99565b8015610d8e5780601f10610d6357610100808354040283529160200191610d8e565b820191906000526020600020905b815481529060010190602001808311610d7157829003601f168201915b5050505050905090565b6000610da53384846110c0565b50600192915050565b6001600160a01b038316600090815268a20d6e21d0e525530d60209081526040808320338452909152812080546000198114610e245780841115610e1e576040517f13be252b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83810382555b610e2f86868661111d565b50600195945050505050565b6001600160a01b038116600090815268a20d6e21d0e5255310602052604081208054600160581b90046001168203610e7757823b5b9392505050565b54600160581b9004600216151592915050565b610e9433826116a5565b50565b606060018054610d1590611a99565b6000610da533848461111d565b6060604051806080016040528060438152602001611b7a604391395115610f1957604051806080016040528060438152602001611b7a60439139610ef68361173d565b604051602001610f07929190611ad3565b60405160208183030381529060405290505b919050565b6001600160a01b038116600090815268a20d6e21d0e52553106020526040812080549091600160581b9091046001169003610f19576001823b15610f60576002175b815460ff909116600160581b026bff000000000000000000000019909116178155919050565b8154600160601b900463ffffffff1668a20d6e21d0e525530860008290036110475780548190600090610fbe9063ffffffff16611b2a565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b82027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff9091161786556000908152600283016020526040902080546001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1990911617905591505b5092915050565b60008061105a8361106b565b6001600160a01b0316141592915050565b600068a20d6e21d0e525530868a20d6e21d0e525530a8261109968a20d6e21d0e525530f600187901b610750565b63ffffffff1681526020810191909152604001600020546001600160a01b03169392505050565b6001600160a01b03838116600081815268a20d6e21d0e525530d6020908152604080832094871680845294825282208590558482527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a3505050565b6001600160a01b03821661114457604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e5255308600061115985610f1e565b9050600061116685610f1e565b90506111a16040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b825463ffffffff600160801b808304821660808501528454041660a08301526bffffffffffffffffffffffff600160a01b9091041660408201819052851115611216576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040810180518690039081905283546bffffffffffffffffffffffff918216600160a01b9081026001600160a01b0392831617865584548181048416890160608601819052909316029116178255608081015161129b9061127f6a084595161401484a00000090565b83604001518161129157611291611b4d565b0480821191030290565b81528154600160581b900460021660000361130d57856001600160a01b0316876001600160a01b0316036112d757805160808201510360a08201525b6113076a084595161401484a0000008260600151816112f8576112f8611b4d565b048260a0015180821191030290565b60208201525b602081810151825160408051808201825260008152606081860190815282519390940180845260051b83018501909152918190529091018152815160078601901561147a576001600160a01b0389166000908152600687016020526040902060808401518451885463ffffffff6801000000000000000080830482168490038216026bffffffff000000000000000019909216919091178a558854918303908116600160801b0263ffffffff60801b199092169190911788555b60001991909101600381901c600090815260208490526040812054919291600584901b60e0161c6020869052633fffffff600282901c16600090815260409020805460c0600684901b1681811c67ffffffffffffffff16901b18905563ffffffff169050600081815260048b0160209081526040909120805473ffffffffffffffffffffffffffffffffffffffff19169055865160608f901b600884901b176001178152018652508082036113c7575050505b60208301511561163e576001600160a01b03881660009081526006870160209081526040822060a0860151918601519092908201906114b9888d610f86565b905060006a084595161401484a0000008b54600160601b90046bffffffffffffffffffffffff16816114ed576114ed611b4d565b8c5460208b01516bffffffff000000000000000019821663ffffffff6801000000000000000080850482169093018116909202178f558c5463ffffffff60801b1916600160801b88831602178d559290910492506401000000009004165b611559876107508360011b90565b63ffffffff16156115785760010181811115611573575060015b61154b565b6020869052600385901c600090815260409020805460e0600588901b1681811c841863ffffffff16901b1890556020878152600282901c600090815260409020805460c0600685901b1681811c9389901b63ffffffff8816179390931867ffffffffffffffff1690921b9091189055600190940193875160608f901b600883901b178152602001885260010181811115611610575060015b83850361154b578b5463ffffffff9091166401000000000267ffffffff0000000019909116178b5550505050505b602082015151156116625760018601546116629083906001600160a01b03166117dd565b5050846000528560601b60601c8760601b60601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000a350505050505050565b60006116b083610f1e565b8054909150600160581b90046002161515821515146116f357805460ff600160581b8083048216600218909116026bff0000000000000000000000199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611730911515815260200190565b60405180910390a2505050565b6060600061174a8361181f565b600101905060008167ffffffffffffffff81111561176a5761176a611b63565b6040519080825280601f01601f191660200182016040528015611794576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a850494508461179e57509392505050565b60208201516040810363263c69d68152602080820152815160051b604401915060208183601c84016000875af160018251141661181957600081fd5b50505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611868577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611894576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106118b257662386f26fc10000830492506010015b6305f5e10083106118ca576305f5e100830492506008015b61271083106118de57612710830492506004015b606483106118f0576064830492506002015b600a8310610bb85760010192915050565b60005b8381101561191c578181015183820152602001611904565b50506000910152565b6020815260008251806020840152611944816040850160208701611901565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114610f1957600080fd5b6000806040838503121561198257600080fd5b61198b83611958565b946020939093013593505050565b6000806000606084860312156119ae57600080fd5b6119b784611958565b92506119c560208501611958565b9150604084013590509250925092565b6000602082840312156119e757600080fd5b610e7082611958565b600060208284031215611a0257600080fd5b81358015158114610e7057600080fd5b600060208284031215611a2457600080fd5b5035919050565b60008060408385031215611a3e57600080fd5b611a4783611958565b9150611a5560208401611958565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b6bffffffffffffffffffffffff82811682821603908082111561104757611047611a5e565b600181811c90821680611aad57607f821691505b602082108103611acd57634e487b7160e01b600052602260045260246000fd5b50919050565b60008351611ae5818460208801611901565b835190830190611af9818360208801611901565b7f2e6a736f6e0000000000000000000000000000000000000000000000000000009101908152600501949350505050565b600063ffffffff808316818103611b4357611b43611a5e565b6001019392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fdfe697066733a2f2f6261667962656967786561783467696d6174757177636b6c6c7868327370736261756a696d33726a676174657a71326972693470667666366e696d2fa2646970667358221220785600654ffc720b7b53732cca9e23c087640bd1500db36df739c99385aac6f464736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000df9c82e0d976413d1e4b368277f250d805819479000000000000000000000000000000000000000000000000000000000000000750686f656e69780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034153480000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): Phoenix
Arg [1] : symbol_ (string): ASH
Arg [2] : initialSupplyOwner (address): 0xdF9C82E0D976413d1e4B368277f250D805819479
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 000000000000000000000000df9c82e0d976413d1e4b368277f250d805819479
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [4] : 50686f656e697800000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [6] : 4153480000000000000000000000000000000000000000000000000000000000
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.