Feature Tip: Add private address tag to any address under My Name Tag !
ERC-20
Overview
Max Total Supply
1,000 404DOG
Holders
30
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 Name:
DOG404
Compiler Version
v0.8.20+commit.a1b79de6
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2024-02-13 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // File: https://github.com/Vectorized/solady/blob/main/src/utils/SafeTransferLib.sol /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for /// the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } } // File: https://github.com/Vectorized/solady/blob/main/src/utils/LibString.sol pragma solidity ^0.8.4; /// @notice Library for converting numbers into strings and other string operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) /// /// @dev Note: /// For performance and bytecode compactness, most of the string operations are restricted to /// byte strings (7-bit ASCII), except where otherwise specified. /// Usage of byte string operations on charsets with runes spanning two or more bytes /// can lead to undefined behavior. library LibString { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The length of the output is too small to contain all the hex digits. error HexLengthInsufficient(); /// @dev The length of the string is more than 32 bytes. error TooBigForSmallString(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the string. uint256 internal constant NOT_FOUND = type(uint256).max; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the base 10 decimal representation of `value`. function toString(uint256 value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. str := add(mload(0x40), 0x80) // Update the free memory pointer to allocate. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str let w := not(0) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { str := add(str, w) // `sub(str, 1)`. // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /// @dev Returns the base 10 decimal representation of `value`. function toString(int256 value) internal pure returns (string memory str) { if (value >= 0) { return toString(uint256(value)); } unchecked { str = toString(~uint256(value) + 1); } /// @solidity memory-safe-assembly assembly { // We still have some spare memory space on the left, // as we have allocated 3 words (96 bytes) for up to 78 digits. let length := mload(str) // Load the string length. mstore(str, 0x2d) // Store the '-' character. str := sub(str, 1) // Move back the string pointer by a byte. mstore(str, add(length, 1)) // Update the string length. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HEXADECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `length` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `length * 2 + 2` bytes. /// Reverts if `length` is too small for the output to contain all the digits. function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) { str = toHexStringNoPrefix(value, length); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `length` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `length * 2` bytes. /// Reverts if `length` is too small for the output to contain all the digits. function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length. // We add 0x20 to the total and round down to a multiple of 0x20. // (0x20 + 0x20 + 0x02 + 0x20) = 0x62. str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f))) // Allocate the memory. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end to calculate the length later. let end := str // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let start := sub(str, add(length, length)) let w := not(1) // Tsk. let temp := value // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for {} 1 {} { str := add(str, w) // `sub(str, 2)`. mstore8(add(str, 1), mload(and(temp, 15))) mstore8(str, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(xor(str, start)) { break } } if temp { mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`. revert(0x1c, 0x04) } // Compute the string's length. let strLength := sub(end, str) // Move the pointer and write the length. str := sub(str, 0x20) mstore(str, strLength) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2 + 2` bytes. function toHexString(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x". /// The output excludes leading "0" from the `toHexString` output. /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`. function toMinimalHexString(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present. let strLength := add(mload(str), 2) // Compute the length. mstore(add(str, o), 0x3078) // Write the "0x" prefix, accounting for leading zero. str := sub(add(str, o), 2) // Move the pointer, accounting for leading zero. mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output excludes leading "0" from the `toHexStringNoPrefix` output. /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`. function toMinimalHexStringNoPrefix(uint256 value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present. let strLength := mload(str) // Get the length. str := add(str, o) // Move the pointer, accounting for leading zero. mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2` bytes. function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x40 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0. str := add(mload(0x40), 0x80) // Allocate the memory. mstore(0x40, add(str, 0x20)) // Zeroize the slot after the string. mstore(str, 0) // Cache the end to calculate the length later. let end := str // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let w := not(1) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { str := add(str, w) // `sub(str, 2)`. mstore8(add(str, 1), mload(and(temp, 15))) mstore8(str, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(temp) { break } } // Compute the string's length. let strLength := sub(end, str) // Move the pointer and write the length. str := sub(str, 0x20) mstore(str, strLength) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte, /// and the alphabets are capitalized conditionally according to /// https://eips.ethereum.org/EIPS/eip-55 function toHexStringChecksummed(address value) internal pure returns (string memory str) { str = toHexString(value); /// @solidity memory-safe-assembly assembly { let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...` let o := add(str, 0x22) let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... ` let t := shl(240, 136) // `0b10001000 << 240` for { let i := 0 } 1 {} { mstore(add(i, i), mul(t, byte(i, hashed))) i := add(i, 1) if eq(i, 20) { break } } mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask))))) o := add(o, 0x20) mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask))))) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. function toHexString(address value) internal pure returns (string memory str) { str = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(address value) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { str := mload(0x40) // Allocate the memory. // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x28 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80. mstore(0x40, add(str, 0x80)) // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) str := add(str, 2) mstore(str, 40) let o := add(str, 0x20) mstore(add(o, 40), 0) value := shl(96, value) // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let i := 0 } 1 {} { let p := add(o, add(i, i)) let temp := byte(i, value) mstore8(add(p, 1), mload(and(temp, 15))) mstore8(p, mload(shr(4, temp))) i := add(i, 1) if eq(i, 20) { break } } } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexString(bytes memory raw) internal pure returns (string memory str) { str = toHexStringNoPrefix(raw); /// @solidity memory-safe-assembly assembly { let strLength := add(mload(str), 2) // Compute the length. mstore(str, 0x3078) // Write the "0x" prefix. str := sub(str, 2) // Move the pointer. mstore(str, strLength) // Write the length. } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) { /// @solidity memory-safe-assembly assembly { let length := mload(raw) str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix. mstore(str, add(length, length)) // Store the length of the output. // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let o := add(str, 0x20) let end := add(raw, length) for {} iszero(eq(raw, end)) {} { raw := add(raw, 1) mstore8(add(o, 1), mload(and(mload(raw), 15))) mstore8(o, mload(and(shr(4, mload(raw)), 15))) o := add(o, 2) } mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate the memory. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* RUNE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the number of UTF characters in the string. function runeCount(string memory s) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { if mload(s) { mstore(0x00, div(not(0), 255)) mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506) let o := add(s, 0x20) let end := add(o, mload(s)) for { result := 1 } 1 { result := add(result, 1) } { o := add(o, byte(0, mload(shr(250, mload(o))))) if iszero(lt(o, end)) { break } } } } } /// @dev Returns if this string is a 7-bit ASCII string. /// (i.e. all characters codes are in [0..127]) function is7BitASCII(string memory s) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let mask := shl(7, div(not(0), 255)) result := 1 let n := mload(s) if n { let o := add(s, 0x20) let end := add(o, n) let last := mload(end) mstore(end, 0) for {} 1 {} { if and(mask, mload(o)) { result := 0 break } o := add(o, 0x20) if iszero(lt(o, end)) { break } } mstore(end, last) } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // For performance and bytecode compactness, byte string operations are restricted // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets. // Usage of byte string operations on charsets with runes spanning two or more bytes // can lead to undefined behavior. /// @dev Returns `subject` all occurrences of `search` replaced with `replacement`. function replace(string memory subject, string memory search, string memory replacement) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) let searchLength := mload(search) let replacementLength := mload(replacement) subject := add(subject, 0x20) search := add(search, 0x20) replacement := add(replacement, 0x20) result := add(mload(0x40), 0x20) let subjectEnd := add(subject, subjectLength) if iszero(gt(searchLength, subjectLength)) { let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1) let h := 0 if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) } let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(search) for {} 1 {} { let t := mload(subject) // Whether the first `searchLength % 32` bytes of // `subject` and `search` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(subject, searchLength), h)) { mstore(result, t) result := add(result, 1) subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } continue } } // Copy the `replacement` one word at a time. for { let o := 0 } 1 {} { mstore(add(result, o), mload(add(replacement, o))) o := add(o, 0x20) if iszero(lt(o, replacementLength)) { break } } result := add(result, replacementLength) subject := add(subject, searchLength) if searchLength { if iszero(lt(subject, subjectSearchEnd)) { break } continue } } mstore(result, t) result := add(result, 1) subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } } } let resultRemainder := result result := add(mload(0x40), 0x20) let k := add(sub(resultRemainder, result), sub(subjectEnd, subject)) // Copy the rest of the string one word at a time. for {} lt(subject, subjectEnd) {} { mstore(resultRemainder, mload(subject)) resultRemainder := add(resultRemainder, 0x20) subject := add(subject, 0x20) } result := sub(result, 0x20) let last := add(add(result, 0x20), k) // Zeroize the slot after the string. mstore(last, 0) mstore(0x40, add(last, 0x20)) // Allocate the memory. mstore(result, k) // Store the length. } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from left to right, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function indexOf(string memory subject, string memory search, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for { let subjectLength := mload(subject) } 1 {} { if iszero(mload(search)) { if iszero(gt(from, subjectLength)) { result := from break } result := subjectLength break } let searchLength := mload(search) let subjectStart := add(subject, 0x20) result := not(0) // Initialize to `NOT_FOUND`. subject := add(subjectStart, from) let end := add(sub(add(subjectStart, subjectLength), searchLength), 1) let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(add(search, 0x20)) if iszero(and(lt(subject, end), lt(from, subjectLength))) { break } if iszero(lt(searchLength, 0x20)) { for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} { if iszero(shr(m, xor(mload(subject), s))) { if eq(keccak256(subject, searchLength), h) { result := sub(subject, subjectStart) break } } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } for {} 1 {} { if iszero(shr(m, xor(mload(subject), s))) { result := sub(subject, subjectStart) break } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from left to right. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function indexOf(string memory subject, string memory search) internal pure returns (uint256 result) { result = indexOf(subject, search, 0); } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from right to left, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function lastIndexOf(string memory subject, string memory search, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for {} 1 {} { result := not(0) // Initialize to `NOT_FOUND`. let searchLength := mload(search) if gt(searchLength, mload(subject)) { break } let w := result let fromMax := sub(mload(subject), searchLength) if iszero(gt(fromMax, from)) { from := fromMax } let end := add(add(subject, 0x20), w) subject := add(add(subject, 0x20), from) if iszero(gt(subject, end)) { break } // As this function is not too often used, // we shall simply use keccak256 for smaller bytecode size. for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} { if eq(keccak256(subject, searchLength), h) { result := sub(subject, add(end, 1)) break } subject := add(subject, w) // `sub(subject, 1)`. if iszero(gt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `search` in `subject`, /// searching from right to left. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. function lastIndexOf(string memory subject, string memory search) internal pure returns (uint256 result) { result = lastIndexOf(subject, search, uint256(int256(-1))); } /// @dev Returns true if `search` is found in `subject`, false otherwise. function contains(string memory subject, string memory search) internal pure returns (bool) { return indexOf(subject, search) != NOT_FOUND; } /// @dev Returns whether `subject` starts with `search`. function startsWith(string memory subject, string memory search) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let searchLength := mload(search) // Just using keccak256 directly is actually cheaper. // forgefmt: disable-next-item result := and( iszero(gt(searchLength, mload(subject))), eq( keccak256(add(subject, 0x20), searchLength), keccak256(add(search, 0x20), searchLength) ) ) } } /// @dev Returns whether `subject` ends with `search`. function endsWith(string memory subject, string memory search) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let searchLength := mload(search) let subjectLength := mload(subject) // Whether `search` is not longer than `subject`. let withinRange := iszero(gt(searchLength, subjectLength)) // Just using keccak256 directly is actually cheaper. // forgefmt: disable-next-item result := and( withinRange, eq( keccak256( // `subject + 0x20 + max(subjectLength - searchLength, 0)`. add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))), searchLength ), keccak256(add(search, 0x20), searchLength) ) ) } } /// @dev Returns `subject` repeated `times`. function repeat(string memory subject, uint256 times) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) if iszero(or(iszero(times), iszero(subjectLength))) { subject := add(subject, 0x20) result := mload(0x40) let output := add(result, 0x20) for {} 1 {} { // Copy the `subject` one word at a time. for { let o := 0 } 1 {} { mstore(add(output, o), mload(add(subject, o))) o := add(o, 0x20) if iszero(lt(o, subjectLength)) { break } } output := add(output, subjectLength) times := sub(times, 1) if iszero(times) { break } } mstore(output, 0) // Zeroize the slot after the string. let resultLength := sub(output, add(result, 0x20)) mstore(result, resultLength) // Store the length. // Allocate the memory. mstore(0x40, add(result, add(resultLength, 0x20))) } } } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. function slice(string memory subject, uint256 start, uint256 end) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) if iszero(gt(subjectLength, end)) { end := subjectLength } if iszero(gt(subjectLength, start)) { start := subjectLength } if lt(start, end) { result := mload(0x40) let resultLength := sub(end, start) mstore(result, resultLength) subject := add(subject, start) let w := not(0x1f) // Copy the `subject` one word at a time, backwards. for { let o := and(add(resultLength, 0x1f), w) } 1 {} { mstore(add(result, o), mload(add(subject, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } // Zeroize the slot after the string. mstore(add(add(result, 0x20), resultLength), 0) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, add(result, and(add(resultLength, 0x3f), w))) } } } /// @dev Returns a copy of `subject` sliced from `start` to the end of the string. /// `start` is a byte offset. function slice(string memory subject, uint256 start) internal pure returns (string memory result) { result = slice(subject, start, uint256(int256(-1))); } /// @dev Returns all the indices of `search` in `subject`. /// The indices are byte offsets. function indicesOf(string memory subject, string memory search) internal pure returns (uint256[] memory result) { /// @solidity memory-safe-assembly assembly { let subjectLength := mload(subject) let searchLength := mload(search) if iszero(gt(searchLength, subjectLength)) { subject := add(subject, 0x20) search := add(search, 0x20) result := add(mload(0x40), 0x20) let subjectStart := subject let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1) let h := 0 if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) } let m := shl(3, sub(0x20, and(searchLength, 0x1f))) let s := mload(search) for {} 1 {} { let t := mload(subject) // Whether the first `searchLength % 32` bytes of // `subject` and `search` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(subject, searchLength), h)) { subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } continue } } // Append to `result`. mstore(result, sub(subject, subjectStart)) result := add(result, 0x20) // Advance `subject` by `searchLength`. subject := add(subject, searchLength) if searchLength { if iszero(lt(subject, subjectSearchEnd)) { break } continue } } subject := add(subject, 1) if iszero(lt(subject, subjectSearchEnd)) { break } } let resultEnd := result // Assign `result` to the free memory pointer. result := mload(0x40) // Store the length of `result`. mstore(result, shr(5, sub(resultEnd, add(result, 0x20)))) // Allocate memory for result. // We allocate one more word, so this array can be recycled for {split}. mstore(0x40, add(resultEnd, 0x20)) } } } /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string. function split(string memory subject, string memory delimiter) internal pure returns (string[] memory result) { uint256[] memory indices = indicesOf(subject, delimiter); /// @solidity memory-safe-assembly assembly { let w := not(0x1f) let indexPtr := add(indices, 0x20) let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1))) mstore(add(indicesEnd, w), mload(subject)) mstore(indices, add(mload(indices), 1)) let prevIndex := 0 for {} 1 {} { let index := mload(indexPtr) mstore(indexPtr, 0x60) if iszero(eq(index, prevIndex)) { let element := mload(0x40) let elementLength := sub(index, prevIndex) mstore(element, elementLength) // Copy the `subject` one word at a time, backwards. for { let o := and(add(elementLength, 0x1f), w) } 1 {} { mstore(add(element, o), mload(add(add(subject, prevIndex), o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } // Zeroize the slot after the string. mstore(add(add(element, 0x20), elementLength), 0) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, add(element, and(add(elementLength, 0x3f), w))) // Store the `element` into the array. mstore(indexPtr, element) } prevIndex := add(index, mload(delimiter)) indexPtr := add(indexPtr, 0x20) if iszero(lt(indexPtr, indicesEnd)) { break } } result := indices if iszero(mload(delimiter)) { result := add(indices, 0x20) mstore(result, sub(mload(indices), 2)) } } } /// @dev Returns a concatenated string of `a` and `b`. /// Cheaper than `string.concat()` and does not de-align the free memory pointer. function concat(string memory a, string memory b) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let w := not(0x1f) result := mload(0x40) let aLength := mload(a) // Copy `a` one word at a time, backwards. for { let o := and(add(aLength, 0x20), w) } 1 {} { mstore(add(result, o), mload(add(a, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let bLength := mload(b) let output := add(result, aLength) // Copy `b` one word at a time, backwards. for { let o := and(add(bLength, 0x20), w) } 1 {} { mstore(add(output, o), mload(add(b, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let totalLength := add(aLength, bLength) let last := add(add(result, 0x20), totalLength) // Zeroize the slot after the string. mstore(last, 0) // Stores the length. mstore(result, totalLength) // Allocate memory for the length and the bytes, // rounded up to a multiple of 32. mstore(0x40, and(add(last, 0x1f), w)) } } /// @dev Returns a copy of the string in either lowercase or UPPERCASE. /// WARNING! This function is only compatible with 7-bit ASCII strings. function toCase(string memory subject, bool toUpper) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let length := mload(subject) if length { result := add(mload(0x40), 0x20) subject := add(subject, 1) let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff) let w := not(0) for { let o := length } 1 {} { o := add(o, w) let b := and(0xff, mload(add(subject, o))) mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20))) if iszero(o) { break } } result := mload(0x40) mstore(result, length) // Store the length. let last := add(add(result, 0x20), length) mstore(last, 0) // Zeroize the slot after the string. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } } /// @dev Returns a string from a small bytes32 string. /// `s` must be null-terminated, or behavior will be undefined. function fromSmallString(bytes32 s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let n := 0 for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'. mstore(result, n) let o := add(result, 0x20) mstore(o, s) mstore(add(o, n), 0) mstore(0x40, add(result, 0x40)) } } /// @dev Returns the small string, with all bytes after the first null byte zeroized. function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'. mstore(0x00, s) mstore(result, 0x00) result := mload(0x00) } } /// @dev Returns the string as a normalized null-terminated small string. function toSmallString(string memory s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := mload(s) if iszero(lt(result, 33)) { mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`. revert(0x1c, 0x04) } result := shl(shl(3, sub(32, result)), mload(add(s, result))) } } /// @dev Returns a lowercased copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function lower(string memory subject) internal pure returns (string memory result) { result = toCase(subject, false); } /// @dev Returns an UPPERCASED copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function upper(string memory subject) internal pure returns (string memory result) { result = toCase(subject, true); } /// @dev Escapes the string to be used within HTML tags. function escapeHTML(string memory s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let end := add(s, mload(s)) result := add(mload(0x40), 0x20) // Store the bytes of the packed offsets and strides into the scratch space. // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6. mstore(0x1f, 0x900094) mstore(0x08, 0xc0000000a6ab) // Store ""&'<>" into the scratch space. mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b)) for {} iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) // Not in `["\"","'","&","<",">"]`. if iszero(and(shl(c, 1), 0x500000c400000000)) { mstore8(result, c) result := add(result, 1) continue } let t := shr(248, mload(c)) mstore(result, mload(and(t, 0x1f))) result := add(result, shr(5, t)) } let last := result mstore(last, 0) // Zeroize the slot after the string. result := mload(0x40) mstore(result, sub(last, add(result, 0x20))) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes. function escapeJSON(string memory s, bool addDoubleQuotes) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let end := add(s, mload(s)) result := add(mload(0x40), 0x20) if addDoubleQuotes { mstore8(result, 34) result := add(1, result) } // Store "\\u0000" in scratch space. // Store "0123456789abcdef" in scratch space. // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`. // into the scratch space. mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672) // Bitmask for detecting `["\"","\\"]`. let e := or(shl(0x22, 1), shl(0x5c, 1)) for {} iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) if iszero(lt(c, 0x20)) { if iszero(and(shl(c, 1), e)) { // Not in `["\"","\\"]`. mstore8(result, c) result := add(result, 1) continue } mstore8(result, 0x5c) // "\\". mstore8(add(result, 1), c) result := add(result, 2) continue } if iszero(and(shl(c, 1), 0x3700)) { // Not in `["\b","\t","\n","\f","\d"]`. mstore8(0x1d, mload(shr(4, c))) // Hex value. mstore8(0x1e, mload(and(c, 15))) // Hex value. mstore(result, mload(0x19)) // "\\u00XX". result := add(result, 6) continue } mstore8(result, 0x5c) // "\\". mstore8(add(result, 1), mload(add(c, 8))) result := add(result, 2) } if addDoubleQuotes { mstore8(result, 34) result := add(1, result) } let last := result mstore(last, 0) // Zeroize the slot after the string. result := mload(0x40) mstore(result, sub(last, add(result, 0x20))) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. function escapeJSON(string memory s) internal pure returns (string memory result) { result = escapeJSON(s, false); } /// @dev Returns whether `a` equals `b`. function eq(string memory a, string memory b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) } } /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string. function eqs(string memory a, bytes32 b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { // These should be evaluated on compile time, as far as possible. let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. let x := not(or(m, or(b, add(m, and(b, m))))) let r := shl(7, iszero(iszero(shr(128, x)))) r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) } } /// @dev Packs a single string with its length into a single word. /// Returns `bytes32(0)` if the length is zero or greater than 31. function packOne(string memory a) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { // We don't need to zero right pad the string, // since this is our own custom non-standard packing scheme. result := mul( // Load the length and the bytes. mload(add(a, 0x1f)), // `length != 0 && length < 32`. Abuses underflow. // Assumes that the length is valid and within the block gas limit. lt(sub(mload(a), 1), 0x1f) ) } } /// @dev Unpacks a string packed using {packOne}. /// Returns the empty string if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packOne}, the output behavior is undefined. function unpackOne(bytes32 packed) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { // Grab the free memory pointer. result := mload(0x40) // Allocate 2 words (1 for the length, 1 for the bytes). mstore(0x40, add(result, 0x40)) // Zeroize the length slot. mstore(result, 0) // Store the length and bytes. mstore(add(result, 0x1f), packed) // Right pad with zeroes. mstore(add(add(result, 0x20), mload(result)), 0) } } /// @dev Packs two strings with their lengths into a single word. /// Returns `bytes32(0)` if combined length is zero or greater than 30. function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { let aLength := mload(a) // We don't need to zero right pad the strings, // since this is our own custom non-standard packing scheme. result := mul( // Load the length and the bytes of `a` and `b`. or( shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))), mload(sub(add(b, 0x1e), aLength)) ), // `totalLength != 0 && totalLength < 31`. Abuses underflow. // Assumes that the lengths are valid and within the block gas limit. lt(sub(add(aLength, mload(b)), 1), 0x1e) ) } } /// @dev Unpacks strings packed using {packTwo}. /// Returns the empty strings if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packTwo}, the output behavior is undefined. function unpackTwo(bytes32 packed) internal pure returns (string memory resultA, string memory resultB) { /// @solidity memory-safe-assembly assembly { // Grab the free memory pointer. resultA := mload(0x40) resultB := add(resultA, 0x40) // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words. mstore(0x40, add(resultB, 0x40)) // Zeroize the length slots. mstore(resultA, 0) mstore(resultB, 0) // Store the lengths and bytes. mstore(add(resultA, 0x1f), packed) mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA)))) // Right pad with zeroes. mstore(add(add(resultA, 0x20), mload(resultA)), 0) mstore(add(add(resultB, 0x20), mload(resultB)), 0) } } /// @dev Directly returns `a` without copying. function directReturn(string memory a) internal pure { assembly { // Assumes that the string does not start from the scratch space. let retStart := sub(a, 0x20) let retSize := add(mload(a), 0x40) // Right pad with zeroes. Just in case the string is produced // by a method that doesn't zero right pad. mstore(add(retStart, retSize), 0) // Store the return offset. mstore(retStart, 0x20) // End the transaction, returning the string. return(retStart, retSize) } } } // File: https://github.com/Vectorized/solady/blob/main/src/auth/Ownable.sol pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } } // File: https://github.com/Vectorized/dn404/blob/main/src/DN404Mirror.sol 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 is Ownable { /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* EVENTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Emitted when token `id` is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 indexed id); /// @dev Emitted when `owner` enables `account` to manage the `id` token. event Approval(address indexed owner, address indexed account, uint256 indexed id); /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Thrown when a call for an NFT function did not originate /// from the base DN404 contract. error SenderNotBase(); /// @dev Thrown when a call for an NFT function did not originate from the deployer. error SenderNotDeployer(); /// @dev Thrown when transferring an NFT to a contract address that /// does not implement ERC721Receiver. error TransferToNonERC721ReceiverImplementer(); /// @dev Thrown when linking to the DN404 base contract and the /// DN404 supportsInterface check fails or the call reverts. error CannotLink(); /// @dev Thrown when a linkMirrorContract call is received and the /// NFT mirror contract has already been linked to a DN404 base contract. error AlreadyLinked(); /// @dev Thrown when retrieving the base DN404 address when a link has not /// been established. error NotLinked(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct contain the NFT mirror contract storage. struct DN404NFTStorage { address baseERC20; address deployer; } /// @dev Returns a storage pointer for DN404NFTStorage. function _getDN404NFTStorage() internal pure virtual returns (DN404NFTStorage storage $) { /// @solidity memory-safe-assembly assembly { // `uint72(bytes9(keccak256("DN404_MIRROR_STORAGE")))`. $.slot := 0x3602298b8c10b01230 // Truncate to 9 bytes to reduce bytecode size. } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTRUCTOR */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ constructor(address deployer) { // For non-proxies, we will store the deployer so that only the deployer can // link the base contract. _getDN404NFTStorage().deployer = deployer; _initializeOwner(deployer); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* ERC721 OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the token collection name from the base DN404 contract. function name() public view virtual returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x00, 0x06fdde03) // `name()`. if iszero(staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) returndatacopy(result, mload(0x00), 0x20) returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result)) mstore(0x40, add(add(result, 0x20), mload(result))) } } /// @dev Returns the token collection symbol from the base DN404 contract. function symbol() public view virtual returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x00, 0x95d89b41) // `symbol()`. if iszero(staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) returndatacopy(result, mload(0x00), 0x20) returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result)) mstore(0x40, add(add(result, 0x20), mload(result))) } } /// @dev Returns the Uniform Resource Identifier (URI) for token `id` from /// the base DN404 contract. function tokenURI(uint256 id) public view virtual returns (string memory result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x20, id) mstore(0x00, 0xc87b56dd) // `tokenURI()`. if iszero(staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x00)) { returndatacopy(result, 0x00, returndatasize()) revert(result, returndatasize()) } returndatacopy(0x00, 0x00, 0x20) returndatacopy(result, mload(0x00), 0x20) returndatacopy(add(result, 0x20), add(mload(0x00), 0x20), mload(result)) mstore(0x40, add(add(result, 0x20), mload(result))) } } /// @dev Returns the total NFT supply from the base DN404 contract. function totalSupply() public view virtual returns (uint256 result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0xe2c79281) // `totalNFTSupply()`. if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x04, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := mload(0x00) } } /// @dev Returns the number of NFT tokens owned by `owner` from the base DN404 contract. /// /// Requirements: /// - `owner` must not be the zero address. function balanceOf(address owner) public view virtual returns (uint256 result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x20, shr(96, shl(96, owner))) mstore(0x00, 0xf5b100ea) // `balanceOfNFT(address)`. if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := mload(0x00) } } /// @dev Returns the owner of token `id` from the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. function ownerOf(uint256 id) public view virtual returns (address result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x6352211e) // `ownerOf(uint256)`. mstore(0x20, id) if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := shr(96, mload(0x0c)) } } /// @dev Sets `spender` as the approved account to manage token `id` in /// the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. /// - The caller must be the owner of the token, /// or an approved operator for the token owner. /// /// Emits an {Approval} event. function approve(address spender, uint256 id) public virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { spender := shr(96, shl(96, spender)) let m := mload(0x40) mstore(0x00, 0xd10b6e0c) // `approveNFT(address,uint256,address)`. mstore(0x20, spender) mstore(0x40, id) mstore(0x60, caller()) if iszero( and( gt(returndatasize(), 0x1f), call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20) ) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. // Emit the {Approval} event. log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, shr(96, mload(0x0c)), spender, id) } } /// @dev Returns the account approved to manage token `id` from /// the base DN404 contract. /// /// Requirements: /// - Token `id` must exist. function getApproved(uint256 id) public view virtual returns (address result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x081812fc) // `getApproved(uint256)`. mstore(0x20, id) if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x24, 0x00, 0x20)) ) { returndatacopy(mload(0x40), 0x00, returndatasize()) revert(mload(0x40), returndatasize()) } result := shr(96, mload(0x0c)) } } /// @dev Sets whether `operator` is approved to manage the tokens of the caller in /// the base DN404 contract. /// /// Emits an {ApprovalForAll} event. function setApprovalForAll(address operator, bool approved) public virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { operator := shr(96, shl(96, operator)) let m := mload(0x40) mstore(0x00, 0x813500fc) // `setApprovalForAll(address,bool,address)`. mstore(0x20, operator) mstore(0x40, iszero(iszero(approved))) mstore(0x60, caller()) if iszero( and(eq(mload(0x00), 1), call(gas(), base, callvalue(), 0x1c, 0x64, 0x00, 0x20)) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } // Emit the {ApprovalForAll} event. log3(0x40, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), operator) mstore(0x40, m) // Restore the free memory pointer. mstore(0x60, 0) // Restore the zero pointer. } } /// @dev Returns whether `operator` is approved to manage the tokens of `owner` from /// the base DN404 contract. function isApprovedForAll(address owner, address operator) public view virtual returns (bool result) { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(0x40, operator) mstore(0x2c, shl(96, owner)) mstore(0x0c, 0xe985e9c5000000000000000000000000) // `isApprovedForAll(address,address)`. if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), base, 0x1c, 0x44, 0x00, 0x20)) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } mstore(0x40, m) // Restore the free memory pointer. result := iszero(iszero(mload(0x00))) } } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 id) public virtual { address base = baseERC20(); /// @solidity memory-safe-assembly assembly { from := shr(96, shl(96, from)) to := shr(96, shl(96, to)) let m := mload(0x40) mstore(m, 0xe5eb36c8) // `transferFromNFT(address,address,uint256,address)`. mstore(add(m, 0x20), from) mstore(add(m, 0x40), to) mstore(add(m, 0x60), id) mstore(add(m, 0x80), caller()) if iszero( and(eq(mload(m), 1), call(gas(), base, callvalue(), add(m, 0x1c), 0x84, m, 0x20)) ) { returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } } /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. function safeTransferFrom(address from, address to, uint256 id) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function safeTransferFrom(address from, address to, uint256 id, bytes calldata data) public virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* MIRROR OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the address of the base DN404 contract. function baseERC20() public view virtual returns (address base) { base = _getDN404NFTStorage().baseERC20; if (base == address(0)) revert NotLinked(); } /// @dev Fallback modifier to execute calls from the base DN404 contract. modifier dn404NFTFallback() virtual { DN404NFTStorage storage $ = _getDN404NFTStorage(); uint256 fnSelector = _calldataload(0x00) >> 224; // `logTransfer(uint256[])`. if (fnSelector == 0x263c69d6) { if (msg.sender != $.baseERC20) revert SenderNotBase(); /// @solidity memory-safe-assembly assembly { // When returndatacopy copies 1 or more out-of-bounds bytes, it reverts. returndatacopy(0x00, returndatasize(), lt(calldatasize(), 0x20)) let o := add(0x24, calldataload(0x04)) // Packed logs offset. returndatacopy(0x00, returndatasize(), lt(calldatasize(), o)) let end := add(o, shl(5, calldataload(sub(o, 0x20)))) returndatacopy(0x00, returndatasize(), lt(calldatasize(), end)) for {} iszero(eq(o, end)) { o := add(0x20, o) } { let d := calldataload(o) // Entry in the packed logs. let a := shr(96, d) // The address. let b := and(1, d) // Whether it is a burn. log4( codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, mul(a, b), mul(a, iszero(b)), shr(168, shl(160, d)) ) } mstore(0x00, 0x01) return(0x00, 0x20) } } // `linkMirrorContract(address)`. if (fnSelector == 0x0f4599e5) { if ($.deployer != address(0)) { if (address(uint160(_calldataload(0x04))) != $.deployer) { revert SenderNotDeployer(); } } if ($.baseERC20 != address(0)) revert AlreadyLinked(); $.baseERC20 = msg.sender; /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x01) return(0x00, 0x20) } } _; } /// @dev Fallback function for calls from base DN404 contract. fallback() external payable virtual dn404NFTFallback {} receive() external payable virtual {} /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* PRIVATE HELPERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the calldata value at `offset`. function _calldataload(uint256 offset) private pure returns (uint256 value) { /// @solidity memory-safe-assembly assembly { value := calldataload(offset) } } /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) let onERC721ReceivedSelector := 0x150b7a02 mstore(m, onERC721ReceivedSelector) mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), 0x80) let n := mload(data) mstore(add(m, 0xa0), n) if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) } // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } } // Load the returndata and compare it. if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. revert(0x1c, 0x04) } } } } // File: https://github.com/Vectorized/dn404/blob/main/src/DN404.sol 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); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CUSTOM ERRORS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Thrown when attempting to double-initialize the contract. error DNAlreadyInitialized(); /// @dev Thrown when attempting to transfer or burn more tokens than sender's balance. error InsufficientBalance(); /// @dev Thrown when a spender attempts to transfer tokens with an insufficient allowance. error InsufficientAllowance(); /// @dev Thrown when minting an amount of tokens that would overflow the max tokens. error TotalSupplyOverflow(); /// @dev Thrown when the caller for a fallback NFT function is not the mirror contract. error SenderNotMirror(); /// @dev Thrown when attempting to transfer tokens to the zero address. error TransferToZeroAddress(); /// @dev Thrown when the mirror address provided for initialization is the zero address. error MirrorAddressIsZero(); /// @dev Thrown when the link call to the mirror contract reverts. error LinkMirrorContractFailed(); /// @dev Thrown when setting an NFT token approval /// and the caller is not the owner or an approved operator. error ApprovalCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT /// and the caller is not the owner or an approved operator. error TransferCallerNotOwnerNorApproved(); /// @dev Thrown when transferring an NFT and the from address is not the current owner. error TransferFromIncorrectOwner(); /// @dev Thrown when checking the owner or approved address for an non-existent NFT. error TokenDoesNotExist(); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* CONSTANTS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Amount of token balance that is equal to one NFT. uint256 internal constant _WAD = 10 ** 18; /// @dev The maximum token ID allowed for an NFT. uint256 internal constant _MAX_TOKEN_ID = 0xffffffff; /// @dev The maximum possible token supply. uint256 internal constant _MAX_SUPPLY = 10 ** 18 * 0xffffffff - 1; /// @dev The flag to denote that the address data is initialized. uint8 internal constant _ADDRESS_DATA_INITIALIZED_FLAG = 1 << 0; /// @dev The flag to denote that the address should skip NFTs. uint8 internal constant _ADDRESS_DATA_SKIP_NFT_FLAG = 1 << 1; /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* STORAGE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct containing an address's token data and settings. struct AddressData { // Auxiliary data. uint88 aux; // Flags for `initialized` and `skipNFT`. uint8 flags; // The alias for the address. Zero means absence of an alias. uint32 addressAlias; // The number of NFT tokens. uint32 ownedLength; // The token balance in wei. uint96 balance; } /// @dev A uint32 map in storage. struct Uint32Map { mapping(uint256 => uint256) map; } /// @dev Struct containing the base token contract storage. struct DN404Storage { // Current number of address aliases assigned. uint32 numAliases; // Next token ID to assign for an NFT mint. uint32 nextTokenId; // Total supply of minted NFTs. uint32 totalNFTSupply; // Total supply of tokens. uint96 totalSupply; // Address of the NFT mirror contract. address mirrorERC721; // Mapping of a user alias number to their address. mapping(uint32 => address) aliasToAddress; // Mapping of user operator approvals for NFTs. mapping(address => mapping(address => bool)) operatorApprovals; // Mapping of NFT token approvals to approved operators. mapping(uint256 => address) tokenApprovals; // Mapping of user allowances for token spenders. mapping(address => mapping(address => uint256)) allowance; // Mapping of NFT token IDs owned by an address. mapping(address => Uint32Map) owned; // Even indices: owner aliases. Odd indices: owned indices. Uint32Map oo; // Mapping of user account AddressData mapping(address => AddressData) addressData; } /// @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(); _linkMirrorContract(mirror); $.nextTokenId = 1; $.mirrorERC721 = mirror; if (initialTokenSupply > 0) { if (initialSupplyOwner == address(0)) revert TransferToZeroAddress(); if (initialTokenSupply > _MAX_SUPPLY) revert TotalSupplyOverflow(); $.totalSupply = uint96(initialTokenSupply); AddressData storage initialOwnerAddressData = _addressData(initialSupplyOwner); initialOwnerAddressData.balance = uint96(initialTokenSupply); emit Transfer(address(0), initialSupplyOwner, initialTokenSupply); _setSkipNFT(initialSupplyOwner, true); } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* METADATA FUNCTIONS TO OVERRIDE */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the name of the token. function name() public view virtual returns (string memory); /// @dev Returns the symbol of the token. function symbol() public view virtual returns (string memory); /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. function tokenURI(uint256 id) public view virtual returns (string memory); /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* 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]; } /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. /// /// Emits a {Approval} event. function approve(address spender, uint256 amount) public virtual returns (bool) { DN404Storage storage $ = _getDN404Storage(); $.allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /// @dev Transfer `amount` tokens from the caller to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// /// Emits a {Transfer} event. function transfer(address to, uint256 amount) public virtual returns (bool) { _transfer(msg.sender, to, amount); return true; } /// @dev Transfers `amount` tokens from `from` to `to`. /// /// Note: Does not update the allowance if it is the maximum uint256 value. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Requirements: /// - `from` must at least have `amount`. /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) { DN404Storage storage $ = _getDN404Storage(); uint256 allowed = $.allowance[from][msg.sender]; if (allowed != type(uint256).max) { if (amount > allowed) revert InsufficientAllowance(); unchecked { $.allowance[from][msg.sender] = allowed - amount; } } _transfer(from, to, amount); return true; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL MINT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Mints `amount` tokens to `to`, increasing the total supply. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Emits a {Transfer} event. function _mint(address to, uint256 amount) internal virtual { if (to == address(0)) revert TransferToZeroAddress(); DN404Storage storage $ = _getDN404Storage(); AddressData storage toAddressData = _addressData(to); unchecked { uint256 currentTokenSupply = uint256($.totalSupply) + amount; if (amount > _MAX_SUPPLY || currentTokenSupply > _MAX_SUPPLY) { revert TotalSupplyOverflow(); } $.totalSupply = uint96(currentTokenSupply); uint256 toBalance = toAddressData.balance + amount; toAddressData.balance = uint96(toBalance); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { Uint32Map storage toOwned = $.owned[to]; uint256 toIndex = toAddressData.ownedLength; uint256 toEnd = toBalance / _WAD; _PackedLogs memory packedLogs = _packedLogsMalloc(_zeroFloorSub(toEnd, toIndex)); if (packedLogs.logs.length != 0) { uint256 maxNFTId = $.totalSupply / _WAD; uint32 toAlias = _registerAndResolveAlias(toAddressData, to); uint256 id = $.nextTokenId; $.totalNFTSupply += uint32(packedLogs.logs.length); toAddressData.ownedLength = uint32(toEnd); // Mint loop. do { while (_get($.oo, _ownershipIndex(id)) != 0) { if (++id > maxNFTId) id = 1; } _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex($.oo, id, toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, to, id, 0); if (++id > maxNFTId) id = 1; } while (toIndex != toEnd); $.nextTokenId = uint32(id); _packedLogsSend(packedLogs, $.mirrorERC721); } } } emit Transfer(address(0), to, amount); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL BURN FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Burns `amount` tokens from `from`, reducing the total supply. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Emits a {Transfer} event. function _burn(address from, uint256 amount) internal virtual { DN404Storage storage $ = _getDN404Storage(); AddressData storage fromAddressData = _addressData(from); uint256 fromBalance = fromAddressData.balance; if (amount > fromBalance) revert InsufficientBalance(); uint256 currentTokenSupply = $.totalSupply; unchecked { fromBalance -= amount; fromAddressData.balance = uint96(fromBalance); currentTokenSupply -= amount; $.totalSupply = uint96(currentTokenSupply); Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = fromAddressData.ownedLength; uint256 nftAmountToBurn = _zeroFloorSub(fromIndex, fromBalance / _WAD); if (nftAmountToBurn != 0) { $.totalNFTSupply -= uint32(nftAmountToBurn); _PackedLogs memory packedLogs = _packedLogsMalloc(nftAmountToBurn); uint256 fromEnd = fromIndex - nftAmountToBurn; // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0); delete $.tokenApprovals[id]; _packedLogsAppend(packedLogs, from, id, 1); } while (fromIndex != fromEnd); fromAddressData.ownedLength = uint32(fromIndex); _packedLogsSend(packedLogs, $.mirrorERC721); } } emit Transfer(from, address(0), amount); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* INTERNAL TRANSFER FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Moves `amount` of tokens from `from` to `to`. /// /// Will burn sender NFTs if balance after transfer is less than /// the amount required to support the current NFT balance. /// /// Will mint NFTs to `to` if the recipient's new balance supports /// additional NFTs ***AND*** the `to` address's skipNFT flag is /// set to false. /// /// Emits a {Transfer} event. 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 / _WAD); if (toAddressData.flags & _ADDRESS_DATA_SKIP_NFT_FLAG == 0) { if (from == to) t.toOwnedLength = t.fromOwnedLength - t.nftAmountToBurn; t.nftAmountToMint = _zeroFloorSub(t.toBalance / _WAD, t.toOwnedLength); } _PackedLogs memory packedLogs = _packedLogsMalloc(t.nftAmountToBurn + t.nftAmountToMint); if (t.nftAmountToBurn != 0) { Uint32Map storage fromOwned = $.owned[from]; uint256 fromIndex = t.fromOwnedLength; uint256 fromEnd = fromIndex - t.nftAmountToBurn; $.totalNFTSupply -= uint32(t.nftAmountToBurn); fromAddressData.ownedLength = uint32(fromEnd); // Burn loop. do { uint256 id = _get(fromOwned, --fromIndex); _setOwnerAliasAndOwnedIndex($.oo, id, 0, 0); delete $.tokenApprovals[id]; _packedLogsAppend(packedLogs, from, id, 1); } while (fromIndex != fromEnd); } if (t.nftAmountToMint != 0) { Uint32Map storage toOwned = $.owned[to]; uint256 toIndex = t.toOwnedLength; uint256 toEnd = toIndex + t.nftAmountToMint; uint32 toAlias = _registerAndResolveAlias(toAddressData, to); uint256 maxNFTId = $.totalSupply / _WAD; uint256 id = $.nextTokenId; $.totalNFTSupply += uint32(t.nftAmountToMint); toAddressData.ownedLength = uint32(toEnd); // Mint loop. do { while (_get($.oo, _ownershipIndex(id)) != 0) { if (++id > maxNFTId) id = 1; } _set(toOwned, toIndex, uint32(id)); _setOwnerAliasAndOwnedIndex($.oo, id, toAlias, uint32(toIndex++)); _packedLogsAppend(packedLogs, to, id, 0); if (++id > maxNFTId) id = 1; } while (toIndex != toEnd); $.nextTokenId = uint32(id); } if (packedLogs.logs.length != 0) { _packedLogsSend(packedLogs, $.mirrorERC721); } } emit Transfer(from, to, amount); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Call must originate from the mirror contract. /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// `msgSender` must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _transferFromNFT(address from, address to, uint256 id, address msgSender) internal virtual { DN404Storage storage $ = _getDN404Storage(); if (to == address(0)) revert TransferToZeroAddress(); address owner = $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; if (from != owner) revert TransferFromIncorrectOwner(); if (msgSender != from) { if (!$.operatorApprovals[from][msgSender]) { if (msgSender != $.tokenApprovals[id]) { revert TransferCallerNotOwnerNorApproved(); } } } AddressData storage fromAddressData = _addressData(from); AddressData storage toAddressData = _addressData(to); fromAddressData.balance -= uint96(_WAD); unchecked { toAddressData.balance += uint96(_WAD); _set($.oo, _ownershipIndex(id), _registerAndResolveAlias(toAddressData, to)); delete $.tokenApprovals[id]; uint256 updatedId = _get($.owned[from], --fromAddressData.ownedLength); _set($.owned[from], _get($.oo, _ownedIndex(id)), uint32(updatedId)); uint256 n = toAddressData.ownedLength++; _set($.oo, _ownedIndex(updatedId), _get($.oo, _ownedIndex(id))); _set($.owned[to], n, uint32(id)); _set($.oo, _ownedIndex(id), uint32(n)); } emit Transfer(from, to, _WAD); } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* DATA HITCHHIKING FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the auxiliary data for `owner`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _getAux(address owner) internal view virtual returns (uint88) { return _getDN404Storage().addressData[owner].aux; } /// @dev Set the auxiliary data for `owner` to `value`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _setAux(address owner, uint88 value) internal virtual { _getDN404Storage().addressData[owner].aux = value; } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* SKIP NFT FUNCTIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns true if account `a` will skip NFT minting on token mints and transfers. /// Returns false if account `a` will mint NFTs on token mints and transfers. function getSkipNFT(address a) public view virtual returns (bool) { AddressData storage d = _getDN404Storage().addressData[a]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) return _hasCode(a); return d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0; } /// @dev Sets the caller's skipNFT flag to `skipNFT` /// /// Emits a {SkipNFTSet} event. function setSkipNFT(bool skipNFT) public virtual { _setSkipNFT(msg.sender, skipNFT); } /// @dev Internal function to set account `a` skipNFT flag to `state` /// /// Initializes account `a` AddressData if it is not currently initialized. /// /// Emits a {SkipNFTSet} event. function _setSkipNFT(address a, bool state) internal virtual { AddressData storage d = _addressData(a); if ((d.flags & _ADDRESS_DATA_SKIP_NFT_FLAG != 0) != state) { d.flags ^= _ADDRESS_DATA_SKIP_NFT_FLAG; } emit SkipNFTSet(a, state); } /// @dev Returns a storage data pointer for account `a` AddressData /// /// Initializes account `a` AddressData if it is not currently initialized. function _addressData(address a) internal virtual returns (AddressData storage d) { DN404Storage storage $ = _getDN404Storage(); d = $.addressData[a]; if (d.flags & _ADDRESS_DATA_INITIALIZED_FLAG == 0) { uint8 flags = _ADDRESS_DATA_INITIALIZED_FLAG; if (_hasCode(a)) flags |= _ADDRESS_DATA_SKIP_NFT_FLAG; d.flags = flags; } } /// @dev Returns the `addressAlias` of account `to`. /// /// Assigns and registers the next alias if `to` alias was not previously registered. function _registerAndResolveAlias(AddressData storage toAddressData, address to) internal virtual returns (uint32 addressAlias) { DN404Storage storage $ = _getDN404Storage(); addressAlias = toAddressData.addressAlias; if (addressAlias == 0) { addressAlias = ++$.numAliases; toAddressData.addressAlias = addressAlias; $.aliasToAddress[addressAlias] = to; } } /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* MIRROR OPERATIONS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Returns the address of the mirror NFT contract. function mirrorERC721() public view virtual returns (address) { return _getDN404Storage().mirrorERC721; } /// @dev Returns the total NFT supply. function _totalNFTSupply() internal view virtual returns (uint256) { return _getDN404Storage().totalNFTSupply; } /// @dev Returns `owner` NFT balance. function _balanceOfNFT(address owner) internal view virtual returns (uint256) { return _getDN404Storage().addressData[owner].ownedLength; } /// @dev Returns the owner of token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _ownerAt(uint256 id) internal view virtual returns (address) { DN404Storage storage $ = _getDN404Storage(); return $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; } /// @dev Returns the owner of token `id`. /// /// Requirements: /// - Token `id` must exist. function _ownerOf(uint256 id) internal view virtual returns (address) { if (!_exists(id)) revert TokenDoesNotExist(); return _ownerAt(id); } /// @dev Returns if token `id` exists. function _exists(uint256 id) internal view virtual returns (bool) { return _ownerAt(id) != address(0); } /// @dev Returns the account approved to manage token `id`. /// /// Requirements: /// - Token `id` must exist. function _getApproved(uint256 id) internal view virtual returns (address) { if (!_exists(id)) revert TokenDoesNotExist(); return _getDN404Storage().tokenApprovals[id]; } /// @dev Sets `spender` as the approved account to manage token `id`, using `msgSender`. /// /// Requirements: /// - `msgSender` must be the owner or an approved operator for the token owner. function _approveNFT(address spender, uint256 id, address msgSender) internal virtual returns (address) { DN404Storage storage $ = _getDN404Storage(); address owner = $.aliasToAddress[_get($.oo, _ownershipIndex(id))]; if (msgSender != owner) { if (!$.operatorApprovals[owner][msgSender]) { revert ApprovalCallerNotOwnerNorApproved(); } } $.tokenApprovals[id] = spender; return owner; } /// @dev Approve or remove the `operator` as an operator for `msgSender`, /// without authorization checks. function _setApprovalForAll(address operator, bool approved, address msgSender) internal virtual { _getDN404Storage().operatorApprovals[msgSender][operator] = approved; } /// @dev Calls the mirror contract to link it to this contract. /// /// Reverts if the call to the mirror contract reverts. function _linkMirrorContract(address mirror) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x0f4599e5) // `linkMirrorContract(address)`. mstore(0x20, caller()) if iszero(and(eq(mload(0x00), 1), call(gas(), mirror, 0, 0x1c, 0x24, 0x00, 0x20))) { mstore(0x00, 0xd125259c) // `LinkMirrorContractFailed()`. revert(0x1c, 0x04) } } } /// @dev Fallback modifier to dispatch calls from the mirror NFT contract /// to internal functions in this contract. modifier dn404Fallback() virtual { DN404Storage storage $ = _getDN404Storage(); uint256 fnSelector = _calldataload(0x00) >> 224; // `isApprovedForAll(address,address)`. if (fnSelector == 0xe985e9c5) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x44) revert(); address owner = address(uint160(_calldataload(0x04))); address operator = address(uint160(_calldataload(0x24))); _return($.operatorApprovals[owner][operator] ? 1 : 0); } // `ownerOf(uint256)`. if (fnSelector == 0x6352211e) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); uint256 id = _calldataload(0x04); _return(uint160(_ownerOf(id))); } // `transferFromNFT(address,address,uint256,address)`. if (fnSelector == 0xe5eb36c8) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x84) revert(); address from = address(uint160(_calldataload(0x04))); address to = address(uint160(_calldataload(0x24))); uint256 id = _calldataload(0x44); address msgSender = address(uint160(_calldataload(0x64))); _transferFromNFT(from, to, id, msgSender); _return(1); } // `setApprovalForAll(address,bool,address)`. if (fnSelector == 0x813500fc) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x64) revert(); address spender = address(uint160(_calldataload(0x04))); bool status = _calldataload(0x24) != 0; address msgSender = address(uint160(_calldataload(0x44))); _setApprovalForAll(spender, status, msgSender); _return(1); } // `approveNFT(address,uint256,address)`. if (fnSelector == 0xd10b6e0c) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x64) revert(); address spender = address(uint160(_calldataload(0x04))); uint256 id = _calldataload(0x24); address msgSender = address(uint160(_calldataload(0x44))); _return(uint160(_approveNFT(spender, id, msgSender))); } // `getApproved(uint256)`. if (fnSelector == 0x081812fc) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); uint256 id = _calldataload(0x04); _return(uint160(_getApproved(id))); } // `balanceOfNFT(address)`. if (fnSelector == 0xf5b100ea) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x24) revert(); address owner = address(uint160(_calldataload(0x04))); _return(_balanceOfNFT(owner)); } // `totalNFTSupply()`. if (fnSelector == 0xe2c79281) { if (msg.sender != $.mirrorERC721) revert SenderNotMirror(); if (msg.data.length < 0x04) revert(); _return(_totalNFTSupply()); } // `implementsDN404()`. if (fnSelector == 0xb7a94eb8) { _return(1); } _; } /// @dev Fallback function for calls from mirror NFT contract. fallback() external payable virtual dn404Fallback {} receive() external payable virtual {} /*«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-«-*/ /* PRIVATE HELPERS */ /*-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»-»*/ /// @dev Struct containing packed log data for `Transfer` events to be /// emitted by the mirror NFT contract. struct _PackedLogs { uint256[] logs; uint256 offset; } /// @dev Initiates memory allocation for packed logs with `n` log items. function _packedLogsMalloc(uint256 n) private pure returns (_PackedLogs memory p) { /// @solidity memory-safe-assembly assembly { let logs := add(mload(0x40), 0x40) // Offset by 2 words for `_packedLogsSend`. mstore(logs, n) let offset := add(0x20, logs) mstore(0x40, add(offset, shl(5, n))) mstore(p, logs) mstore(add(0x20, p), offset) } } /// @dev Adds a packed log item to `p` with address `a`, token `id` and burn flag `burnBit`. function _packedLogsAppend(_PackedLogs memory p, address a, uint256 id, uint256 burnBit) private pure { /// @solidity memory-safe-assembly assembly { let offset := mload(add(0x20, p)) mstore(offset, or(or(shl(96, a), shl(8, id)), burnBit)) mstore(add(0x20, p), add(offset, 0x20)) } } /// @dev Calls the `mirror` NFT contract to emit Transfer events for packed logs `p`. function _packedLogsSend(_PackedLogs memory p, address mirror) private { /// @solidity memory-safe-assembly assembly { let logs := mload(p) let o := sub(logs, 0x40) // Start of calldata to send. mstore(o, 0x263c69d6) // `logTransfer(uint256[])`. mstore(add(o, 0x20), 0x20) // Offset of `logs` in the calldata to send. let n := add(0x44, shl(5, mload(logs))) // Length of calldata to send. if iszero(and(eq(mload(o), 1), call(gas(), mirror, 0, add(o, 0x1c), n, o, 0x20))) { revert(o, 0x00) } } } /// @dev Struct of temporary variables for transfers. struct _TransferTemps { uint256 nftAmountToBurn; uint256 nftAmountToMint; uint256 fromBalance; uint256 toBalance; uint256 fromOwnedLength; uint256 toOwnedLength; } /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Returns the calldata value at `offset`. function _calldataload(uint256 offset) private pure returns (uint256 value) { /// @solidity memory-safe-assembly assembly { value := calldataload(offset) } } /// @dev Executes a return opcode to return `x` and end the current call frame. function _return(uint256 x) private pure { /// @solidity memory-safe-assembly assembly { mstore(0x00, x) return(0x00, 0x20) } } /// @dev Returns `max(0, x - y)`. function _zeroFloorSub(uint256 x, uint256 y) private pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { z := mul(gt(x, y), sub(x, y)) } } /// @dev Returns `i << 1`. function _ownershipIndex(uint256 i) private pure returns (uint256) { return i << 1; } /// @dev Returns `(i << 1) + 1`. function _ownedIndex(uint256 i) private pure returns (uint256) { unchecked { return (i << 1) + 1; } } /// @dev Returns the uint32 value at `index` in `map`. function _get(Uint32Map storage map, uint256 index) private view returns (uint32 result) { result = uint32(map.map[index >> 3] >> ((index & 7) << 5)); } /// @dev Updates the uint32 value at `index` in `map`. function _set(Uint32Map storage map, uint256 index, uint32 value) private { /// @solidity memory-safe-assembly assembly { mstore(0x20, map.slot) mstore(0x00, shr(3, index)) let s := keccak256(0x00, 0x40) // Storage slot. let o := shl(5, and(index, 7)) // Storage slot offset (bits). let v := sload(s) // Storage slot value. let m := 0xffffffff // Value mask. sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) } } /// @dev Sets the owner alias and the owned index together. function _setOwnerAliasAndOwnedIndex( Uint32Map storage map, uint256 id, uint32 ownership, uint32 ownedIndex ) private { /// @solidity memory-safe-assembly assembly { let value := or(shl(32, ownedIndex), and(0xffffffff, ownership)) mstore(0x20, map.slot) mstore(0x00, shr(2, id)) let s := keccak256(0x00, 0x40) // Storage slot. let o := shl(6, and(id, 3)) // Storage slot offset (bits). let v := sload(s) // Storage slot value. let m := 0xffffffffffffffff // Value mask. sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) } } } // File: contracts/dndblocks.sol pragma solidity ^0.8.4; contract DOG404 is DN404, Ownable { string private _name; string private _symbol; string private _baseURI = 'https://ipfs.gateway.fatsale.finance/ipfs/QmdybwW8HJgGhnC46nJKZh2hD6jW46fAdTLQrzyRq7MxoP'; constructor( string memory name_, string memory symbol_, uint96 initialTokenSupply, address initialSupplyOwner ) { _initializeOwner(msg.sender); _name = name_; _symbol = symbol_; address mirror = address(new DN404Mirror(msg.sender)); _initializeDN404(initialTokenSupply, initialSupplyOwner, mirror); } 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 view override returns (string memory result) { tokenId = tokenId; return _baseURI; // if (bytes(_baseURI).length != 0) { // uint256 seed = uint256(keccak256(abi.encodePacked(tokenId, address(this)))); // result = string(abi.encodePacked(_baseURI, LibString.toString(seed),".json")); // } } // This allows the owner of the contract to mint more tokens. // function mint(address to, uint256 amount) public onlyOwner { // _mint(to, amount); // } function setBaseURI(string calldata baseURI_) public onlyOwner { _baseURI = baseURI_; } function withdraw() public onlyOwner { SafeTransferLib.safeTransferAllETH(msg.sender); } }
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":"uint96","name":"initialTokenSupply","type":"uint96"},{"internalType":"address","name":"initialSupplyOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"DNAlreadyInitialized","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"LinkMirrorContractFailed","type":"error"},{"inputs":[],"name":"MirrorAddressIsZero","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"SenderNotMirror","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TotalSupplyOverflow","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SkipNFTSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"a","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":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","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":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
61010060405260586080818152906200319360a039600290620000239082620004af565b5034801562000030575f80fd5b50604051620031eb380380620031eb833981016040819052620000539162000621565b6200005e33620000d9565b5f6200006b8582620004af565b5060016200007a8482620004af565b505f336040516200008b9062000407565b6001600160a01b039091168152602001604051809103905ff080158015620000b5573d5f803e3d5ffd5b509050620000ce6001600160601b038416838362000115565b5050505050620006c6565b6001600160a01b0316638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a35b50565b68a20d6e21d0e52553088054640100000000900463ffffffff16156200014e57604051633ab534b960e21b815260040160405180910390fd5b6001600160a01b03821662000176576040516339a84a7b60e01b815260040160405180910390fd5b6200018182620002b9565b805463ffffffff60201b19166401000000001781556001810180546001600160a01b0384166001600160a01b03199091161790558315620002b3576001600160a01b038316620001e457604051633a954ecd60e21b815260040160405180910390fd5b6b0de0b6b39983494c589bffff841115620002125760405163e5cfe95760e01b815260040160405180910390fd5b8054600160601b600160c01b0319166c010000000000000000000000006001600160601b038616021781555f6200024984620002e7565b80546001600160a01b03908116600160a01b6001600160601b038916021782556040518781529192508516905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3620002b184600162000364565b505b50505050565b630f4599e55f523360205260205f6024601c5f855af160015f511416620001125763d125259c5f526004601cfd5b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e5255308916b010000000000000000000000900460011690036200035e576001833b156200033c576002175b825460ff9091166b0100000000000000000000000260ff60581b199091161782555b50919050565b5f6200037083620002e7565b80549091506b0100000000000000000000009004600216151582151514620003bc57805460ff6b01000000000000000000000080830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051620003fa911515815260200190565b60405180910390a2505050565b610e9780620022fc83390190565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200043e57607f821691505b6020821081036200035e57634e487b7160e01b5f52602260045260245ffd5b601f821115620004aa575f81815260208120601f850160051c81016020861015620004855750805b601f850160051c820191505b81811015620004a65782815560010162000491565b5050505b505050565b81516001600160401b03811115620004cb57620004cb62000415565b620004e381620004dc845462000429565b846200045d565b602080601f83116001811462000519575f8415620005015750858301515b5f19600386901b1c1916600185901b178555620004a6565b5f85815260208120601f198616915b82811015620005495788860151825594840194600190910190840162000528565b50858210156200056757878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f82601f83011262000587575f80fd5b81516001600160401b0380821115620005a457620005a462000415565b604051601f8301601f19908116603f01168101908282118183101715620005cf57620005cf62000415565b81604052838152602092508683858801011115620005eb575f80fd5b5f91505b838210156200060e5785820183015181830184015290820190620005ef565b5f93810190920192909252949350505050565b5f805f806080858703121562000635575f80fd5b84516001600160401b03808211156200064c575f80fd5b6200065a8883890162000577565b9550602087015191508082111562000670575f80fd5b506200067f8782880162000577565b604087015190945090506001600160601b03811681146200069e575f80fd5b60608601519092506001600160a01b0381168114620006bb575f80fd5b939692955090935050565b611c2880620006d45f395ff3fe608060405260043610610138575f3560e01c806355f804b3116100aa578063a9059cbb1161006e578063a9059cbb14610705578063c87b56dd14610724578063dd62ed3e14610743578063f04e283e1461078f578063f2fde38b146107a2578063fee81cf4146107b55761013f565b806355f804b31461066657806370a0823114610685578063715018a6146106d15780638da5cb5b146106d957806395d89b41146106f15761013f565b8063274e430b116100fc578063274e430b146105b85780632a6a935d146105d7578063313ce567146105f65780633ccfd60b146106115780634ef41efc1461062557806354d1f13d1461065e5761013f565b806306fdde0314610502578063095ea7b31461052c57806318160ddd1461055b57806323b872dd1461059157806325692962146105b05761013f565b3661013f57005b68a20d6e21d0e52553085f3560e01c63e985e9c58190036101e15760018201546001600160a01b031633146101875760405163ce5a776b60e01b815260040160405180910390fd5b6044361015610194575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546101de9060ff166101d3575f6101d6565b60015b60ff166107e6565b50505b80636352211e036102455760018201546001600160a01b031633146102195760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610226575f80fd5b600435610243610235826107ee565b6001600160a01b03166107e6565b505b8063e5eb36c8036102b15760018201546001600160a01b0316331461027d5760405163ce5a776b60e01b815260040160405180910390fd5b608436101561028a575f80fd5b6004356024356044356064356102a284848484610824565b6102ac60016107e6565b505050505b8063813500fc036103495760018201546001600160a01b031633146102e95760405163ce5a776b60e01b815260040160405180910390fd5b60643610156102f6575f80fd5b6001600160a01b036044358181165f90815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff191660243515159081179091559061034560016107e6565b5050505b8063d10b6e0c036103a95760018201546001600160a01b031633146103815760405163ce5a776b60e01b815260040160405180910390fd5b606436101561038e575f80fd5b6004356024356044356103a5610235848484610ba7565b5050505b8063081812fc036103ff5760018201546001600160a01b031633146103e15760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103ee575f80fd5b6004356103fd61023582610c7c565b505b8063f5b100ea036104855760018201546001600160a01b031633146104375760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610444575f80fd5b60043561048361047e826001600160a01b03165f90815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b6107e6565b505b8063e2c79281036104eb5760018201546001600160a01b031633146104bd5760405163ce5a776b60e01b815260040160405180910390fd5b60043610156104ca575f80fd5b68a20d6e21d0e5255308546104eb90600160401b900463ffffffff166107e6565b8063b7a94eb8036105005761050060016107e6565b005b34801561050d575f80fd5b50610516610cc6565b6040516105239190611886565b60405180910390f35b348015610537575f80fd5b5061054b6105463660046118ec565b610d55565b6040519015158152602001610523565b348015610566575f80fd5b5068a20d6e21d0e525530854600160601b90046001600160601b03165b604051908152602001610523565b34801561059c575f80fd5b5061054b6105ab366004611914565b610dc9565b610500610e69565b3480156105c3575f80fd5b5061054b6105d236600461194d565b610eb6565b3480156105e2575f80fd5b506105006105f1366004611966565b610f04565b348015610601575f80fd5b5060405160128152602001610523565b34801561061c575f80fd5b50610500610f11565b348015610630575f80fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b039091168152602001610523565b610500610f24565b348015610671575f80fd5b50610500610680366004611985565b610f5d565b348015610690575f80fd5b5061058361069f36600461194d565b6001600160a01b03165f90815268a20d6e21d0e52553106020526040902054600160a01b90046001600160601b031690565b610500610f77565b3480156106e4575f80fd5b50638b78c6d81954610646565b3480156106fc575f80fd5b50610516610f88565b348015610710575f80fd5b5061054b61071f3660046118ec565b610f97565b34801561072f575f80fd5b5061051661073e3660046119f1565b610fac565b34801561074e575f80fd5b5061058361075d366004611a08565b6001600160a01b039182165f90815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b61050061079d36600461194d565b61103e565b6105006107b036600461194d565b611078565b3480156107c0575f80fd5b506105836107cf36600461194d565b63389a75e1600c9081525f91909152602090205490565b805f5260205ff35b5f6107f88261109e565b6108155760405163677510db60e11b815260040160405180910390fd5b61081e826110ba565b92915050565b68a20d6e21d0e52553086001600160a01b03841661085557604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f61088e8460070161086c8860011b90565b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146108d15760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b031614610953576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff16610953575f8481526004830160205260409020546001600160a01b0384811691161461095357604051632ce44b5f60e11b815260040160405180910390fd5b5f61095d8761110d565b90505f6109698761110d565b8254909150670de0b6b3a7640000908390601490610998908490600160a01b90046001600160601b0316611a4d565b82546101009290920a6001600160601b0381810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b9283900484160190921602178255506109fc60078501600188901b6109f7848b611178565b611218565b5f868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff9081165f1901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a165f908152600687016020526040902063ffffffff919091169150610abd90610ab16007880160018b811b0161086c565b63ffffffff1683611218565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355610b0f60078701610afd84600190811b0190565b6109f760078a0160018d811b0161086c565b6001600160a01b0389165f9081526006870160205260409020610b3390828a611218565b610b466007870160018a811b0183611218565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051610b9591815260200190565b60405180910390a35050505050505050565b5f68a20d6e21d0e52553088168a20d6e21d0e525530a81610bd568a20d6e21d0e525530f600189901b61086c565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610c47576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610c47576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610c868261109e565b610ca35760405163677510db60e11b815260040160405180910390fd5b505f90815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b60605f8054610cd490611a6d565b80601f0160208091040260200160405190810160405280929190818152602001828054610d0090611a6d565b8015610d4b5780601f10610d2257610100808354040283529160200191610d4b565b820191905f5260205f20905b815481529060010190602001808311610d2e57829003601f168201915b5050505050905090565b5f8068a20d6e21d0e5255308335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b6001600160a01b0383165f90815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308905f198114610e525780841115610e28576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610e5d86868661124a565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054600160581b90046001168203610ef157823b5b9392505050565b54600160581b9004600216151592915050565b610f0e3382611706565b50565b610f19611795565b610f22336117af565b565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f65611795565b6002610f72828483611b00565b505050565b610f7f611795565b610f225f6117c8565b606060018054610cd490611a6d565b5f610fa333848461124a565b50600192915050565b606060028054610fbb90611a6d565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe790611a6d565b80156110325780601f1061100957610100808354040283529160200191611032565b820191905f5260205f20905b81548152906001019060200180831161101557829003601f168201915b50505050509050919050565b611046611795565b63389a75e1600c52805f526020600c20805442111561106c57636f5e88185f526004601cfd5b5f9055610f0e816117c8565b611080611795565b8060601b61109557637448fbae5f526004601cfd5b610f0e816117c8565b5f806110a9836110ba565b6001600160a01b0316141592915050565b5f68a20d6e21d0e525530868a20d6e21d0e525530a826110e768a20d6e21d0e525530f600187901b61086c565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b90046001169003611172576001833b15611158576002175b825460ff909116600160581b0260ff60581b199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e52553085f82900361121157805481905f906111ae9063ffffffff16611bbc565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b820263ffffffff60601b199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6001600160a01b03821661127157604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f6112858561110d565b90505f6112918561110d565b90506112c66040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160801b808304821660808501528454041660a08301526001600160601b03600160a01b909104166040820181905285111561131d57604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161138391670de0b6b3a7640000900480821191030290565b81528154600160581b90046002165f036113f157856001600160a01b0316876001600160a01b0316036113be57805160808201510360a08201525b6113eb670de0b6b3a76400008260600151816113dc576113dc611bde565b048260a0015180821191030290565b60208201525b5f6114388260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b82519091501561152d576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b808304821684900382160263ffffffff60401b199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b5f1991909101600381901c5f90815260208490526040812054919291600584901b60e0161c63ffffffff1690506114e889600701825f80611805565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b176001178352910190528082036114ac575050505b60208201511561168e576001600160a01b0387165f9081526006860160209081526040822060a08501519185015190929082019061156b878c611178565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491640100000000909104165b6115e98b60070161086c8360011b90565b63ffffffff16156116085760010181811115611603575060015b6115d8565b611613868683611218565b6116288b600701828588806001019950611805565b611651878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010181811115611660575060015b8385036115d8578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b805151156116af5760018501546116af9082906001600160a01b0316611849565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516116f591815260200190565b60405180910390a350505050505050565b5f6117108361110d565b8054909150600160581b900460021615158215151461174b57805460ff600160581b80830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611788911515815260200190565b60405180910390a2505050565b638b78c6d819543314610f22576382b429005f526004601cfd5b5f385f3847855af1610f0e5763b12d13eb5f526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b8163ffffffff168160201b17846020528360021c5f5260405f206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84015f875af1600182511416611880575f81fd5b50505050565b5f6020808352835180828501525f5b818110156118b157858101830151858201604001528201611895565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146118e7575f80fd5b919050565b5f80604083850312156118fd575f80fd5b611906836118d1565b946020939093013593505050565b5f805f60608486031215611926575f80fd5b61192f846118d1565b925061193d602085016118d1565b9150604084013590509250925092565b5f6020828403121561195d575f80fd5b610eea826118d1565b5f60208284031215611976575f80fd5b81358015158114610eea575f80fd5b5f8060208385031215611996575f80fd5b823567ffffffffffffffff808211156119ad575f80fd5b818501915085601f8301126119c0575f80fd5b8135818111156119ce575f80fd5b8660208285010111156119df575f80fd5b60209290920196919550909350505050565b5f60208284031215611a01575f80fd5b5035919050565b5f8060408385031215611a19575f80fd5b611a22836118d1565b9150611a30602084016118d1565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b6001600160601b0382811682821603908082111561121157611211611a39565b600181811c90821680611a8157607f821691505b60208210810361117257634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610f72575f81815260208120601f850160051c81016020861015611ad95750805b601f850160051c820191505b81811015611af857828155600101611ae5565b505050505050565b67ffffffffffffffff831115611b1857611b18611a9f565b611b2c83611b268354611a6d565b83611ab3565b5f601f841160018114611b5d575f8515611b465750838201355b5f19600387901b1c1916600186901b178355611bb5565b5f83815260209020601f19861690835b82811015611b8d5786850135825560209485019460019092019101611b6d565b5086821015611ba9575f1960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b5f63ffffffff808316818103611bd457611bd4611a39565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea2646970667358221220c347f82dd216fa12cf1dea10325e864f5a60d5968a0f5e1584e459168235b05264736f6c63430008140033608060405234801561000f575f80fd5b50604051610e97380380610e9783398101604081905261002e9161009b565b683602298b8c10b0123180546001600160a01b0319166001600160a01b03831617905561005a81610060565b506100c8565b6001600160a01b0316638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b5f602082840312156100ab575f80fd5b81516001600160a01b03811681146100c1575f80fd5b9392505050565b610dc2806100d55f395ff3fe608060405260043610610138575f3560e01c8063715018a6116100aa578063b88d4fde1161006e578063b88d4fde14610471578063c87b56dd14610490578063e985e9c5146104af578063f04e283e146104ce578063f2fde38b146104e1578063fee81cf4146104f45761013f565b8063715018a61461040a5780638da5cb5b1461041257806395d89b411461042a57806397e5311c1461043e578063a22cb465146104525761013f565b806323b872dd116100fc57806323b872dd1461038a57806325692962146103a957806342842e0e146103b157806354d1f13d146103c45780636352211e146103cc57806370a08231146103eb5761013f565b806301ffc9a7146102a057806306fdde03146102f1578063081812fc14610312578063095ea7b31461034957806318160ddd146103685761013f565b3661013f57005b683602298b8c10b012305f3560e01c63263c69d68190036102045781546001600160a01b0316331461018457604051631b1e598960e11b815260040160405180910390fd5b602036103d5f3e6004356024018036103d5f3e602081033560051b81018036103d5f3e5b8082146101f95781358060601c816001168260a01b60a81c811583028284027fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f38a45050508160200191506101a8565b505060015f5260205ff35b80630f4599e50361029e5760018201546001600160a01b03161561025a5760018201546001600160a01b03166004356001600160a01b03161461025a576040516362cf623d60e11b815260040160405180910390fd5b81546001600160a01b03161561028357604051635fb2b52360e11b815260040160405180910390fd5b81546001600160a01b0319163317825560015f908152602090f35b005b3480156102ab575f80fd5b506102dc6102ba366004610b6a565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020015b60405180910390f35b3480156102fc575f80fd5b50610305610525565b6040516102e89190610b98565b34801561031d575f80fd5b5061033161032c366004610be3565b610578565b6040516001600160a01b0390911681526020016102e8565b348015610354575f80fd5b5061029e610363366004610c15565b6105bb565b348015610373575f80fd5b5061037c61063b565b6040519081526020016102e8565b348015610395575f80fd5b5061029e6103a4366004610c3d565b610674565b61029e610700565b61029e6103bf366004610c3d565b61074d565b61029e61077e565b3480156103d7575f80fd5b506103316103e6366004610be3565b6107b7565b3480156103f6575f80fd5b5061037c610405366004610c76565b6107ed565b61029e610832565b34801561041d575f80fd5b50638b78c6d81954610331565b348015610435575f80fd5b50610305610845565b348015610449575f80fd5b50610331610873565b34801561045d575f80fd5b5061029e61046c366004610c8f565b6108a8565b34801561047c575f80fd5b5061029e61048b366004610cc8565b610925565b34801561049b575f80fd5b506103056104aa366004610be3565b61097f565b3480156104ba575f80fd5b506102dc6104c9366004610d5b565b6109d8565b61029e6104dc366004610c76565b610a27565b61029e6104ef366004610c76565b610a64565b3480156104ff575f80fd5b5061037c61050e366004610c76565b63389a75e1600c9081525f91909152602090205490565b60605f610530610873565b905060405191506306fdde035f525f806004601c845afa610553573d5f833e3d82fd5b60205f803e60205f51833e815160205f5101602084013e815160208301016040525090565b5f80610582610873565b905063081812fc5f528260205260205f6024601c845afa601f3d11166105ae573d5f6040513e3d604051fd5b5050600c5160601c919050565b5f6105c4610873565b90508260601b60601c925060405163d10b6e0c5f5283602052826040523360605260205f6064601c34865af1601f3d1116610601573d5f823e3d81fd5b80604052505f6060528183600c5160601c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f38a4505050565b5f80610645610873565b905063e2c792815f5260205f6004601c845afa601f3d111661066d573d5f6040513e3d604051fd5b50505f5190565b5f61067d610873565b90508360601b60601c93508260601b60601c925060405163e5eb36c881528460208201528360408201528260608201523360808201526020816084601c840134865af16001825114166106d2573d5f823e3d81fd5b508183857fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f38a450505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b610758838383610674565b813b156107795761077983838360405180602001604052805f815250610a8a565b505050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b5f806107c1610873565b9050636352211e5f528260205260205f6024601c845afa601f3d11166105ae573d5f6040513e3d604051fd5b5f806107f7610873565b90508260601b60601c60205263f5b100ea5f5260205f6024601c845afa601f3d1116610829573d5f6040513e3d604051fd5b50505f51919050565b61083a610b13565b6108435f610b2d565b565b60605f610850610873565b905060405191506395d89b415f525f806004601c845afa610553573d5f833e3d82fd5b683602298b8c10b01230546001600160a01b0316806108a557604051632d9523d760e11b815260040160405180910390fd5b90565b5f6108b1610873565b90508260601b60601c925060405163813500fc5f52836020528215156040523360605260205f6064601c34865af160015f5114166108f1573d5f823e3d81fd5b83337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206040a360405250505f60605250565b610930858585610674565b833b156109785761097885858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250610a8a92505050565b5050505050565b60605f61098a610873565b905060405191508260205263c87b56dd5f525f806024601c845afa6109b1573d5f833e3d82fd5b60205f803e60205f51833e815160205f5101602084013e8151602083010160405250919050565b5f806109e2610873565b9050604051836040528460601b602c5263e985e9c560601b600c5260205f6044601c855afa601f3d1116610a18573d5f823e3d81fd5b60405250505f51151592915050565b610a2f610b13565b63389a75e1600c52805f526020600c208054421115610a5557636f5e88185f526004601cfd5b5f9055610a6181610b2d565b50565b610a6c610b13565b8060601b610a8157637448fbae5f526004601cfd5b610a6181610b2d565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015610ad1578060c08401826020870160045afa505b60208360a48301601c86015f8a5af1610af2573d15610af2573d5f843e3d83fd5b508060e01b825114610b0b5763d1a57ed65f526004601cfd5b505050505050565b638b78c6d819543314610843576382b429005f526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f60208284031215610b7a575f80fd5b81356001600160e01b031981168114610b91575f80fd5b9392505050565b5f6020808352835180828501525f5b81811015610bc357858101830151858201604001528201610ba7565b505f604082860101526040601f19601f8301168501019250505092915050565b5f60208284031215610bf3575f80fd5b5035919050565b80356001600160a01b0381168114610c10575f80fd5b919050565b5f8060408385031215610c26575f80fd5b610c2f83610bfa565b946020939093013593505050565b5f805f60608486031215610c4f575f80fd5b610c5884610bfa565b9250610c6660208501610bfa565b9150604084013590509250925092565b5f60208284031215610c86575f80fd5b610b9182610bfa565b5f8060408385031215610ca0575f80fd5b610ca983610bfa565b915060208301358015158114610cbd575f80fd5b809150509250929050565b5f805f805f60808688031215610cdc575f80fd5b610ce586610bfa565b9450610cf360208701610bfa565b935060408601359250606086013567ffffffffffffffff80821115610d16575f80fd5b818801915088601f830112610d29575f80fd5b813581811115610d37575f80fd5b896020828501011115610d48575f80fd5b9699959850939650602001949392505050565b5f8060408385031215610d6c575f80fd5b610d7583610bfa565b9150610d8360208401610bfa565b9050925092905056fea264697066735822122014132e2dba0057e1e9509430b17f78c07e06c5e3699bd2b2f59ca5ce52d1254f64736f6c6343000814003368747470733a2f2f697066732e676174657761792e66617473616c652e66696e616e63652f697066732f516d647962775738484a6747686e4334366e4a4b5a68326844366a573436664164544c51727a795271374d786f50000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000001730519d7a006682e1cd3757d1ba62ac00f9efaa0000000000000000000000000000000000000000000000000000000000000006343034444f4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006343034444f470000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405260043610610138575f3560e01c806355f804b3116100aa578063a9059cbb1161006e578063a9059cbb14610705578063c87b56dd14610724578063dd62ed3e14610743578063f04e283e1461078f578063f2fde38b146107a2578063fee81cf4146107b55761013f565b806355f804b31461066657806370a0823114610685578063715018a6146106d15780638da5cb5b146106d957806395d89b41146106f15761013f565b8063274e430b116100fc578063274e430b146105b85780632a6a935d146105d7578063313ce567146105f65780633ccfd60b146106115780634ef41efc1461062557806354d1f13d1461065e5761013f565b806306fdde0314610502578063095ea7b31461052c57806318160ddd1461055b57806323b872dd1461059157806325692962146105b05761013f565b3661013f57005b68a20d6e21d0e52553085f3560e01c63e985e9c58190036101e15760018201546001600160a01b031633146101875760405163ce5a776b60e01b815260040160405180910390fd5b6044361015610194575f80fd5b6004356001600160a01b038181165f908152600385016020908152604080832060243594851684529091529020546101de9060ff166101d3575f6101d6565b60015b60ff166107e6565b50505b80636352211e036102455760018201546001600160a01b031633146102195760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610226575f80fd5b600435610243610235826107ee565b6001600160a01b03166107e6565b505b8063e5eb36c8036102b15760018201546001600160a01b0316331461027d5760405163ce5a776b60e01b815260040160405180910390fd5b608436101561028a575f80fd5b6004356024356044356064356102a284848484610824565b6102ac60016107e6565b505050505b8063813500fc036103495760018201546001600160a01b031633146102e95760405163ce5a776b60e01b815260040160405180910390fd5b60643610156102f6575f80fd5b6001600160a01b036044358181165f90815268a20d6e21d0e525530b6020908152604080832060043595861684529091529020805460ff191660243515159081179091559061034560016107e6565b5050505b8063d10b6e0c036103a95760018201546001600160a01b031633146103815760405163ce5a776b60e01b815260040160405180910390fd5b606436101561038e575f80fd5b6004356024356044356103a5610235848484610ba7565b5050505b8063081812fc036103ff5760018201546001600160a01b031633146103e15760405163ce5a776b60e01b815260040160405180910390fd5b60243610156103ee575f80fd5b6004356103fd61023582610c7c565b505b8063f5b100ea036104855760018201546001600160a01b031633146104375760405163ce5a776b60e01b815260040160405180910390fd5b6024361015610444575f80fd5b60043561048361047e826001600160a01b03165f90815268a20d6e21d0e5255310602052604090205463ffffffff600160801b9091041690565b6107e6565b505b8063e2c79281036104eb5760018201546001600160a01b031633146104bd5760405163ce5a776b60e01b815260040160405180910390fd5b60043610156104ca575f80fd5b68a20d6e21d0e5255308546104eb90600160401b900463ffffffff166107e6565b8063b7a94eb8036105005761050060016107e6565b005b34801561050d575f80fd5b50610516610cc6565b6040516105239190611886565b60405180910390f35b348015610537575f80fd5b5061054b6105463660046118ec565b610d55565b6040519015158152602001610523565b348015610566575f80fd5b5068a20d6e21d0e525530854600160601b90046001600160601b03165b604051908152602001610523565b34801561059c575f80fd5b5061054b6105ab366004611914565b610dc9565b610500610e69565b3480156105c3575f80fd5b5061054b6105d236600461194d565b610eb6565b3480156105e2575f80fd5b506105006105f1366004611966565b610f04565b348015610601575f80fd5b5060405160128152602001610523565b34801561061c575f80fd5b50610500610f11565b348015610630575f80fd5b5068a20d6e21d0e5255309546001600160a01b03165b6040516001600160a01b039091168152602001610523565b610500610f24565b348015610671575f80fd5b50610500610680366004611985565b610f5d565b348015610690575f80fd5b5061058361069f36600461194d565b6001600160a01b03165f90815268a20d6e21d0e52553106020526040902054600160a01b90046001600160601b031690565b610500610f77565b3480156106e4575f80fd5b50638b78c6d81954610646565b3480156106fc575f80fd5b50610516610f88565b348015610710575f80fd5b5061054b61071f3660046118ec565b610f97565b34801561072f575f80fd5b5061051661073e3660046119f1565b610fac565b34801561074e575f80fd5b5061058361075d366004611a08565b6001600160a01b039182165f90815268a20d6e21d0e525530d6020908152604080832093909416825291909152205490565b61050061079d36600461194d565b61103e565b6105006107b036600461194d565b611078565b3480156107c0575f80fd5b506105836107cf36600461194d565b63389a75e1600c9081525f91909152602090205490565b805f5260205ff35b5f6107f88261109e565b6108155760405163677510db60e11b815260040160405180910390fd5b61081e826110ba565b92915050565b68a20d6e21d0e52553086001600160a01b03841661085557604051633a954ecd60e21b815260040160405180910390fd5b5f816002015f61088e8460070161086c8860011b90565b600381901c5f90815260209290925260409091205460059190911b60e0161c90565b63ffffffff16815260208101919091526040015f20546001600160a01b039081169150861681146108d15760405162a1148160e81b815260040160405180910390fd5b856001600160a01b0316836001600160a01b031614610953576001600160a01b038087165f90815260038401602090815260408083209387168352929052205460ff16610953575f8481526004830160205260409020546001600160a01b0384811691161461095357604051632ce44b5f60e11b815260040160405180910390fd5b5f61095d8761110d565b90505f6109698761110d565b8254909150670de0b6b3a7640000908390601490610998908490600160a01b90046001600160601b0316611a4d565b82546101009290920a6001600160601b0381810219909316918316021790915582546001600160a01b038116670de0b6b3a7640000600160a01b9283900484160190921602178255506109fc60078501600188901b6109f7848b611178565b611218565b5f868152600485016020908152604080832080546001600160a01b03191690556001600160a01b038b168352600687018252808320855463ffffffff60801b198116600160801b9182900463ffffffff9081165f1901908116909202178755631fffffff600382901c168552925282205460059190911b60e0161c6001600160a01b038a165f908152600687016020526040902063ffffffff919091169150610abd90610ab16007880160018b811b0161086c565b63ffffffff1683611218565b8154600163ffffffff600160801b80840482169283019091160263ffffffff60801b19909216919091178355610b0f60078701610afd84600190811b0190565b6109f760078a0160018d811b0161086c565b6001600160a01b0389165f9081526006870160205260409020610b3390828a611218565b610b466007870160018a811b0183611218565b5050866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a7640000604051610b9591815260200190565b60405180910390a35050505050505050565b5f68a20d6e21d0e52553088168a20d6e21d0e525530a81610bd568a20d6e21d0e525530f600189901b61086c565b63ffffffff16815260208101919091526040015f20546001600160a01b03908116915084168114610c47576001600160a01b038082165f90815260038401602090815260408083209388168352929052205460ff16610c47576040516367d9dca160e11b815260040160405180910390fd5b5f8581526004909201602052604090912080546001600160a01b0387166001600160a01b031990911617905590509392505050565b5f610c868261109e565b610ca35760405163677510db60e11b815260040160405180910390fd5b505f90815268a20d6e21d0e525530c60205260409020546001600160a01b031690565b60605f8054610cd490611a6d565b80601f0160208091040260200160405190810160405280929190818152602001828054610d0090611a6d565b8015610d4b5780601f10610d2257610100808354040283529160200191610d4b565b820191905f5260205f20905b815481529060010190602001808311610d2e57829003601f168201915b5050505050905090565b5f8068a20d6e21d0e5255308335f81815260058301602090815260408083206001600160a01b038a16808552908352928190208890555187815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060019392505050565b6001600160a01b0383165f90815268a20d6e21d0e525530d6020908152604080832033845290915281205468a20d6e21d0e5255308905f198114610e525780841115610e28576040516313be252b60e01b815260040160405180910390fd5b6001600160a01b0386165f9081526005830160209081526040808320338452909152902084820390555b610e5d86868661124a565b50600195945050505050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054600160581b90046001168203610ef157823b5b9392505050565b54600160581b9004600216151592915050565b610f0e3382611706565b50565b610f19611795565b610f22336117af565b565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f65611795565b6002610f72828483611b00565b505050565b610f7f611795565b610f225f6117c8565b606060018054610cd490611a6d565b5f610fa333848461124a565b50600192915050565b606060028054610fbb90611a6d565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe790611a6d565b80156110325780601f1061100957610100808354040283529160200191611032565b820191905f5260205f20905b81548152906001019060200180831161101557829003601f168201915b50505050509050919050565b611046611795565b63389a75e1600c52805f526020600c20805442111561106c57636f5e88185f526004601cfd5b5f9055610f0e816117c8565b611080611795565b8060601b61109557637448fbae5f526004601cfd5b610f0e816117c8565b5f806110a9836110ba565b6001600160a01b0316141592915050565b5f68a20d6e21d0e525530868a20d6e21d0e525530a826110e768a20d6e21d0e525530f600187901b61086c565b63ffffffff16815260208101919091526040015f20546001600160a01b03169392505050565b6001600160a01b0381165f90815268a20d6e21d0e5255310602052604081208054909168a20d6e21d0e525530891600160581b90046001169003611172576001833b15611158576002175b825460ff909116600160581b0260ff60581b199091161782555b50919050565b8154600160601b900463ffffffff1668a20d6e21d0e52553085f82900361121157805481905f906111ae9063ffffffff16611bbc565b825463ffffffff8083166101009490940a848102910219909116179092558554600160601b820263ffffffff60601b199091161786555f908152600283016020526040902080546001600160a01b0386166001600160a01b031990911617905591505b5092915050565b826020528160031c5f5260405f206007831660051b815463ffffffff8482841c188116831b8218845550505050505050565b6001600160a01b03821661127157604051633a954ecd60e21b815260040160405180910390fd5b68a20d6e21d0e52553085f6112858561110d565b90505f6112918561110d565b90506112c66040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b825463ffffffff600160801b808304821660808501528454041660a08301526001600160601b03600160a01b909104166040820181905285111561131d57604051631e9acf1760e31b815260040160405180910390fd5b6040810180518690039081905283546001600160601b03808316600160a01b9081026001600160a01b03938416178755855481810483168a0160608701819052909216029116178355608082015161138391670de0b6b3a7640000900480821191030290565b81528154600160581b90046002165f036113f157856001600160a01b0316876001600160a01b0316036113be57805160808201510360a08201525b6113eb670de0b6b3a76400008260600151816113dc576113dc611bde565b048260a0015180821191030290565b60208201525b5f6114388260200151835f01510160408051808201909152606081525f60208201526040805101828152806020018360051b81016040528183528083602001525050919050565b82519091501561152d576001600160a01b0388165f908152600686016020526040902060808301518351875463ffffffff600160401b808304821684900382160263ffffffff60401b199092169190911789558754918303908116600160801b0263ffffffff60801b199092169190911787555b5f1991909101600381901c5f90815260208490526040812054919291600584901b60e0161c63ffffffff1690506114e889600701825f80611805565b5f81815260048a016020908152604090912080546001600160a01b0319169055858101805160089390931b60608f901b176001178352910190528082036114ac575050505b60208201511561168e576001600160a01b0387165f9081526006860160209081526040822060a08501519185015190929082019061156b878c611178565b8954602088015163ffffffff60401b19821663ffffffff600160401b80850482169093018116909202178c55895463ffffffff60801b1916600160801b86831602178a55919250670de0b6b3a7640000600160601b82046001600160601b03160491640100000000909104165b6115e98b60070161086c8360011b90565b63ffffffff16156116085760010181811115611603575060015b6115d8565b611613868683611218565b6116288b600701828588806001019950611805565b611651878e835f8360200151818360081b8560601b171781526020810185602001525050505050565b60010181811115611660575060015b8385036115d8578a5463ffffffff9091166401000000000267ffffffff0000000019909116178a5550505050505b805151156116af5760018501546116af9082906001600160a01b0316611849565b50856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516116f591815260200190565b60405180910390a350505050505050565b5f6117108361110d565b8054909150600160581b900460021615158215151461174b57805460ff600160581b80830482166002189091160260ff60581b199091161781555b826001600160a01b03167fb5a1de456fff688115a4f75380060c23c8532d14ff85f687cc871456d642039383604051611788911515815260200190565b60405180910390a2505050565b638b78c6d819543314610f22576382b429005f526004601cfd5b5f385f3847855af1610f0e5763b12d13eb5f526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b8163ffffffff168160201b17846020528360021c5f5260405f206003851660061b815467ffffffffffffffff8482841c188116831b82188455505050505050505050565b81516040810363263c69d68152602080820152815160051b604401915060208183601c84015f875af1600182511416611880575f81fd5b50505050565b5f6020808352835180828501525f5b818110156118b157858101830151858201604001528201611895565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146118e7575f80fd5b919050565b5f80604083850312156118fd575f80fd5b611906836118d1565b946020939093013593505050565b5f805f60608486031215611926575f80fd5b61192f846118d1565b925061193d602085016118d1565b9150604084013590509250925092565b5f6020828403121561195d575f80fd5b610eea826118d1565b5f60208284031215611976575f80fd5b81358015158114610eea575f80fd5b5f8060208385031215611996575f80fd5b823567ffffffffffffffff808211156119ad575f80fd5b818501915085601f8301126119c0575f80fd5b8135818111156119ce575f80fd5b8660208285010111156119df575f80fd5b60209290920196919550909350505050565b5f60208284031215611a01575f80fd5b5035919050565b5f8060408385031215611a19575f80fd5b611a22836118d1565b9150611a30602084016118d1565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b6001600160601b0382811682821603908082111561121157611211611a39565b600181811c90821680611a8157607f821691505b60208210810361117257634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b601f821115610f72575f81815260208120601f850160051c81016020861015611ad95750805b601f850160051c820191505b81811015611af857828155600101611ae5565b505050505050565b67ffffffffffffffff831115611b1857611b18611a9f565b611b2c83611b268354611a6d565b83611ab3565b5f601f841160018114611b5d575f8515611b465750838201355b5f19600387901b1c1916600186901b178355611bb5565b5f83815260209020601f19861690835b82811015611b8d5786850135825560209485019460019092019101611b6d565b5086821015611ba9575f1960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b5f63ffffffff808316818103611bd457611bd4611a39565b6001019392505050565b634e487b7160e01b5f52601260045260245ffdfea2646970667358221220c347f82dd216fa12cf1dea10325e864f5a60d5968a0f5e1584e459168235b05264736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000001730519d7a006682e1cd3757d1ba62ac00f9efaa0000000000000000000000000000000000000000000000000000000000000006343034444f4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006343034444f470000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): 404DOG
Arg [1] : symbol_ (string): 404DOG
Arg [2] : initialTokenSupply (uint96): 1000000000000000000000
Arg [3] : initialSupplyOwner (address): 0x1730519d7A006682E1CD3757D1ba62Ac00f9eFaa
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 00000000000000000000000000000000000000000000003635c9adc5dea00000
Arg [3] : 0000000000000000000000001730519d7a006682e1cd3757d1ba62ac00f9efaa
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [5] : 343034444f470000000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [7] : 343034444f470000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
124645:1458:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;95795:20;116720:22;122415:20;116814:3;116791:26;116885:10;116871:24;;;116867:326;;116921:14;;;;-1:-1:-1;;;;;116921:14:0;116907:10;:28;116903:58;;116944:17;;-1:-1:-1;;;116944:17:0;;;;;;;;;;;116903:58;116989:4;116971:8;:22;116967:36;;;116995:8;;;116967:36;117057:4;122415:20;-1:-1:-1;;;;;117142:26:0;;;117011:13;117142:26;;;:19;;;:26;;;;;;;;117119:4;122415:20;117142:36;;;;;;;;;;;117134:53;;117142:36;;:44;;117185:1;117142:44;;;117181:1;117142:44;117134:53;;:7;:53::i;:::-;116897:296;;116867:326;117227:10;117241;117227:24;117223:220;;117277:14;;;;-1:-1:-1;;;;;117277:14:0;117263:10;:28;117259:58;;117300:17;;-1:-1:-1;;;117300:17:0;;;;;;;;;;;117259:58;117345:4;117327:8;:22;117323:36;;;117351:8;;;117323:36;117394:4;122415:20;117407:30;117423:12;122415:20;117423:8;:12::i;:::-;-1:-1:-1;;;;;117407:30:0;:7;:30::i;:::-;117253:190;117223:220;117509:10;117523;117509:24;117505:424;;117559:14;;;;-1:-1:-1;;;;;117559:14:0;117545:10;:28;117541:58;;117582:17;;-1:-1:-1;;;117582:17:0;;;;;;;;;;;117541:58;117627:4;117609:8;:22;117605:36;;;117633:8;;;117605:36;117694:4;122415:20;117750:4;122415:20;117790:4;122415:20;117851:4;122415:20;117866:41;122415:20;;;;117866:16;:41::i;:::-;117913:10;117921:1;117913:7;:10::i;:::-;117535:394;;;;117505:424;117986:10;118000;117986:24;117982:382;;118036:14;;;;-1:-1:-1;;;;;118036:14:0;118022:10;:28;118018:58;;118059:17;;-1:-1:-1;;;118059:17:0;;;;;;;;;;;118018:58;118104:4;118086:8;:22;118082:36;;;118110:8;;;118082:36;-1:-1:-1;;;;;118281:4:0;122415:20;115951:47;;;;;;;:36;:47;;;;;;;;118174:4;122415:20;115951:57;;;;;;;;;;:68;;-1:-1:-1;;115951:68:0;118215:4;122415:20;118201:24;;115951:68;;;;;;118201:24;118348:10;118356:1;118348:7;:10::i;:::-;118012:352;;;117982:382;118417:10;118431;118417:24;118413:367;;118467:14;;;;-1:-1:-1;;;;;118467:14:0;118453:10;:28;118449:58;;118490:17;;-1:-1:-1;;;118490:17:0;;;;;;;;;;;118449:58;118535:4;118517:8;:22;118513:36;;;118541:8;;;118513:36;118605:4;122415:20;118645:4;122415:20;118706:4;122415:20;118721:53;118737:35;122415:20;;;118737:11;:35::i;118721:53::-;118443:337;;;118413:367;118818:10;118832;118818:24;118814:224;;118868:14;;;;-1:-1:-1;;;;;118868:14:0;118854:10;:28;118850:58;;118891:17;;-1:-1:-1;;;118891:17:0;;;;;;;;;;;118850:58;118936:4;118918:8;:22;118914:36;;;118942:8;;;118914:36;118985:4;122415:20;118998:34;119014:16;122415:20;119014:12;:16::i;118998:34::-;118844:194;118814:224;119077:10;119091;119077:24;119073:240;;119127:14;;;;-1:-1:-1;;;;;119127:14:0;119113:10;:28;119109:58;;119150:17;;-1:-1:-1;;;119150:17:0;;;;;;;;;;;119109:58;119195:4;119177:8;:22;119173:36;;;119201:8;;;119173:36;119263:4;122415:20;119278:29;119286:20;122415;-1:-1:-1;;;;;114004:37:0;113983:7;114004:37;;;:30;:37;;;;;:49;;-1:-1:-1;;;114004:49:0;;;;;113914:144;119286:20;119278:7;:29::i;:::-;119103:210;119073:240;119347:10;119361;119347:24;119343:176;;119397:14;;;;-1:-1:-1;;;;;119397:14:0;119383:10;:28;119379:58;;119420:17;;-1:-1:-1;;;119420:17:0;;;;;;;;;;;119379:58;119465:4;119447:8;:22;119443:36;;;119471:8;;;119443:36;95795:20;113831:33;119487:26;;-1:-1:-1;;;113831:33:0;;;;119278:7;:29::i;119487:26::-;119554:10;119568;119554:24;119550:52;;119586:10;119594:1;119586:7;:10::i;:::-;116715:2897;125196:83;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;98926:248;;;;;;;;;;-1:-1:-1;98926:248:0;;;;;:::i;:::-;;:::i;:::-;;;1169:14:1;;1162:22;1144:41;;1132:2;1117:18;98926:248:0;1004:187:1;98254:117:0;;;;;;;;;;-1:-1:-1;95795:20:0;98335:30;-1:-1:-1;;;98335:30:0;;-1:-1:-1;;;;;98335:30:0;98254:117;;;1342:25:1;;;1330:2;1315:18;98254:117:0;1196:177:1;100426:434:0;;;;;;;;;;-1:-1:-1;100426:434:0;;;;;:::i;:::-;;:::i;67465:507::-;;;:::i;111303:261::-;;;;;;;;;;-1:-1:-1;111303:261:0;;;;;:::i;:::-;;:::i;111664:91::-;;;;;;;;;;-1:-1:-1;111664:91:0;;;;;:::i;:::-;;:::i;98128:67::-;;;;;;;;;;-1:-1:-1;98128:67:0;;98188:2;2322:36:1;;2310:2;2295:18;98128:67:0;2180:184:1;126007:93:0;;;;;;;;;;;;;:::i;113596:110::-;;;;;;;;;;-1:-1:-1;113670:31:0;;-1:-1:-1;;;;;113670:31:0;113596:110;;;-1:-1:-1;;;;;2533:32:1;;;2515:51;;2503:2;2488:18;113596:110:0;2369:203:1;68051:391:0;;;:::i;125910:92::-;;;;;;;;;;-1:-1:-1;125910:92:0;;;;;:::i;:::-;;:::i;98434:134::-;;;;;;;;;;-1:-1:-1;98434:134:0;;;;;:::i;:::-;-1:-1:-1;;;;;98518:37:0;98497:7;98518:37;;;:30;:37;;;;;:45;-1:-1:-1;;;98518:45:0;;-1:-1:-1;;;;;98518:45:0;;98434:134;67218:93;;;:::i;69545:157::-;;;;;;;;;;-1:-1:-1;;;69675:18:0;69545:157;;125284:87;;;;;;;;;;;;;:::i;99645:135::-;;;;;;;;;;-1:-1:-1;99645:135:0;;;;;:::i;:::-;;:::i;125376:365::-;;;;;;;;;;-1:-1:-1;125376:365:0;;;;;:::i;:::-;;:::i;98660:142::-;;;;;;;;;;-1:-1:-1;98660:142:0;;;;;:::i;:::-;-1:-1:-1;;;;;98753:35:0;;;98732:7;98753:35;;;:28;:35;;;;;;;;:44;;;;;;;;;;;;;98660:142;68624:592;;;;;;:::i;:::-;;:::i;66867:289::-;;;;;;:::i;:::-;;:::i;69802:356::-;;;;;;;;;;-1:-1:-1;69802:356:0;;;;;:::i;:::-;70024:19;70018:4;70011:33;;;69901:14;70049:26;;;;70143:4;70127:21;;70121:28;;69802:356;122531:146;122643:1;122637:4;122630:15;122663:4;122657;122650:18;114478:148;114539:7;114558:11;114566:2;114558:7;:11::i;:::-;114553:44;;114578:19;;-1:-1:-1;;;114578:19:0;;;;;;;;;;;114553:44;114609:12;114618:2;114609:8;:12::i;:::-;114602:19;114478:148;-1:-1:-1;;114478:148:0:o;108590:1279::-;95795:20;-1:-1:-1;;;;;108757:16:0;;108753:52;;108782:23;;-1:-1:-1;;;108782:23:0;;;;;;;;;;;108753:52;108812:13;108828:1;:16;;:49;108845:31;108850:1;:4;;108856:19;108872:2;123010:1;123005:6;;122926:90;108856:19;123358:1;123349:10;;;123305:13;123341:19;;;;;;;;;;;;;123380:1;123365:16;;;;;;123341:41;;123231:157;108845:31;108828:49;;;;;;;;;;;;;-1:-1:-1;108828:49:0;;-1:-1:-1;;;;;108828:49:0;;;;-1:-1:-1;108888:13:0;;;;108884:54;;108910:28;;-1:-1:-1;;;108910:28:0;;;;;;;;;;;108884:54;108962:4;-1:-1:-1;;;;;108949:17:0;:9;-1:-1:-1;;;;;108949:17:0;;108945:187;;-1:-1:-1;;;;;108979:25:0;;;;;;;:19;;;:25;;;;;;;;:36;;;;;;;;;;;;108974:153;;109041:20;;;;:16;;;:20;;;;;;-1:-1:-1;;;;;109028:33:0;;;109041:20;;109028:33;109024:97;;109078:35;;-1:-1:-1;;;109078:35:0;;;;;;;;;;;109024:97;109138:35;109176:18;109189:4;109176:12;:18::i;:::-;109138:56;;109199:33;109235:16;109248:2;109235:12;:16::i;:::-;109258:39;;109199:52;;-1:-1:-1;93158:8:0;;109258:39;;:23;;:39;;93158:8;;-1:-1:-1;;;109258:39:0;;-1:-1:-1;;;;;109258:39:0;;:::i;:::-;;;;;;;;-1:-1:-1;;;;;109258:39:0;;;;;;;;;;;;;;;109320:37;;-1:-1:-1;;;;;109320:37:0;;93158:8;-1:-1:-1;;;109320:37:0;;;;;;;;;;;;;;-1:-1:-1;109365:76:0;109370:4;;;-1:-1:-1;123005:6:0;;;109397:43;109422:13;109437:2;109397:24;:43::i;:::-;109365:4;:76::i;:::-;109454:20;;;;:16;;;:20;;;;;;;;109447:27;;-1:-1:-1;;;;;;109447:27:0;;;-1:-1:-1;;;;;109507:13:0;;;;:7;;;:13;;;;;109522:29;;-1:-1:-1;;;;109522:29:0;;-1:-1:-1;;;109522:29:0;;;;;;;;-1:-1:-1;;109522:29:0;;;;;;;;;;123349:10;123358:1;123349:10;;;;123341:19;;;;;;;123380:1;123365:16;;;;;;123341:41;-1:-1:-1;;;;;109563:13:0;;;;;;:7;;;:13;;;;;109482:70;;;;;;-1:-1:-1;109558:67:0;;109578:27;109583:4;;;123153:1;123148:6;;;123147:12;109589:15;123056:113;109578:27;109558:67;;109614:9;109558:4;:67::i;:::-;109645:27;;;;-1:-1:-1;;;109645:27:0;;;;;;;;;;;;-1:-1:-1;;;;109645:27:0;;;;;;;;;109678:63;109683:4;;;109689:22;109701:9;123153:1;123148:6;;;123147:12;;123056:113;109689:22;109713:27;109718:4;;;123153:1;123148:6;;;123147:12;109724:15;123056:113;109678:63;-1:-1:-1;;;;;109752:11:0;;;;;;:7;;;:11;;;;;109747:32;;109765:1;109775:2;109747:4;:32::i;:::-;109785:38;109790:4;;;123153:1;123148:6;;;123147:12;109820:1;109785:4;:38::i;:::-;109304:525;;109855:2;-1:-1:-1;;;;;109840:24:0;109849:4;-1:-1:-1;;;;;109840:24:0;;93158:8;109840:24;;;;1342:25:1;;1330:2;1315:18;;1196:177;109840:24:0;;;;;;;;108698:1171;;;;108590:1279;;;;:::o;115287:437::-;115391:7;95795:20;115391:7;115473:16;115391:7;115490:31;115495:4;123010:1;123005:6;;;115501:19;122926:90;115490:31;115473:49;;;;;;;;;;;;;-1:-1:-1;115473:49:0;;-1:-1:-1;;;;;115473:49:0;;;;-1:-1:-1;115533:18:0;;;;115529:135;;-1:-1:-1;;;;;115564:26:0;;;;;;;:19;;;:26;;;;;;;;:37;;;;;;;;;;;;115559:100;;115617:35;;-1:-1:-1;;;115617:35:0;;;;;;;;;;;115559:100;115670:20;;;;:16;;;;:20;;;;;;:30;;-1:-1:-1;;;;;115670:30:0;;-1:-1:-1;;;;;;115670:30:0;;;;;;115714:5;-1:-1:-1;115287:437:0;;;;;:::o;114905:177::-;114970:7;114989:11;114997:2;114989:7;:11::i;:::-;114984:44;;115009:19;;-1:-1:-1;;;115009:19:0;;;;;;;;;;;114984:44;-1:-1:-1;115040:37:0;;;;:33;:37;;;;;;-1:-1:-1;;;;;115040:37:0;;114905:177::o;125196:83::-;125242:13;125269:5;125262:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;125196:83;:::o;98926:248::-;99000:4;;95795:20;99073:10;99061:23;;;;:11;;;:23;;;;;;;;-1:-1:-1;;;;;99061:32:0;;;;;;;;;;;;:41;;;99114:37;1342:25:1;;;99061:11:0;;-1:-1:-1;99061:32:0;;99114:37;;1315:18:1;99114:37:0;;;;;;;-1:-1:-1;99165:4:0;;98926:248;-1:-1:-1;;;98926:248:0:o;100426:434::-;-1:-1:-1;;;;;100593:17:0;;100514:4;100593:17;;;:11;:17;;;;;;;;100611:10;100593:29;;;;;;;;95795:20;;-1:-1:-1;;100633:28:0;;100629:175;;100682:7;100673:6;:16;100669:52;;;100698:23;;-1:-1:-1;;;100698:23:0;;;;;;;;;;;100669:52;-1:-1:-1;;;;;100744:17:0;;;;;;:11;;;:17;;;;;;;;100762:10;100744:29;;;;;;;100776:16;;;100744:48;;100629:175;100810:27;100820:4;100826:2;100830:6;100810:9;:27::i;:::-;-1:-1:-1;100851:4:0;;100426:434;-1:-1:-1;;;;;100426:434:0:o;67465:507::-;67545:15;66501:9;67563:46;;:15;:46;67545:64;;67739:19;67733:4;67726:33;67778:8;67772:4;67765:22;67823:7;67816:4;67810;67800:21;67793:38;67948:8;67901:45;67898:1;67895;67890:67;67663:300;67465:507::o;111303:261::-;-1:-1:-1;;;;;111398:33:0;;111363:4;111398:33;;;:30;:33;;;;;111440:7;;-1:-1:-1;;;111440:7:0;;93524:6;111440:40;:45;;111436:69;;122161:14;;111494:11;111487:18;111303:261;-1:-1:-1;;;111303:261:0:o;111436:69::-;111517:7;-1:-1:-1;;;111517:7:0;;93655:6;111517:37;:42;;;111303:261;-1:-1:-1;;111303:261:0:o;111664:91::-;111718:32;111730:10;111742:7;111718:11;:32::i;:::-;111664:91;:::o;126007:93::-;70534:13;:11;:13::i;:::-;126049:46:::1;126084:10;126049:34;:46::i;:::-;126007:93::o:0;68051:391::-;68227:19;68221:4;68214:33;68265:8;68259:4;68252:22;68309:1;68302:4;68296;68286:21;68279:32;68424:8;68378:44;68375:1;68372;68367:66;68051:391::o;125910:92::-;70534:13;:11;:13::i;:::-;125978:8:::1;:19;125989:8:::0;;125978;:19:::1;:::i;:::-;;125910:92:::0;;:::o;67218:93::-;70534:13;:11;:13::i;:::-;67285:21:::1;67303:1;67285:9;:21::i;125284:87::-:0;125332:13;125359:7;125352:14;;;;;:::i;99645:135::-;99715:4;99726:33;99736:10;99748:2;99752:6;99726:9;:33::i;:::-;-1:-1:-1;99771:4:0;99645:135;;;;:::o;125376:365::-;125441:20;125509:8;125502:15;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;125376:365;;;:::o;68624:592::-;70534:13;:11;:13::i;:::-;68832:19:::1;68826:4;68819:33;68870:12;68864:4;68857:26;68924:4;68918;68908:21;69014:12;69008:19;68995:11;68992:36;68989:127;;;69049:10;69043:4;69036:24;69105:4;69099;69092:18;68989:127;69177:1;69156:23:::0;;69188::::1;69198:12:::0;69188:9:::1;:23::i;66867:289::-:0;70534:13;:11;:13::i;:::-;67021:8:::1;67017:2;67013:17;67003:120;;67052:10;67046:4;67039:24;67112:4;67106;67099:18;67003:120;67132:19;67142:8;67132:9;:19::i;114672:109::-:0;114732:4;;114750:12;114759:2;114750:8;:12::i;:::-;-1:-1:-1;;;;;114750:26:0;;;;114672:109;-1:-1:-1;;114672:109:0:o;114188:184::-;114249:7;95795:20;114318:16;114249:7;114335:31;114340:4;123010:1;123005:6;;;114346:19;122926:90;114335:31;114318:49;;;;;;;;;;;;;-1:-1:-1;114318:49:0;;-1:-1:-1;;;;;114318:49:0;;114188:184;-1:-1:-1;;;114188:184:0:o;112368:353::-;-1:-1:-1;;;;;112507:16:0;;112427:21;112507:16;;;:13;:16;;;;;112534:7;;112507:16;;95795:20;;-1:-1:-1;;;112534:7:0;;93524:6;112534:40;:45;;112530:187;;93524:6;122161:14;;112637:53;;;93655:6;112654:36;112637:53;112696:15;;;;;;-1:-1:-1;;;112696:15:0;-1:-1:-1;;;;112696:15:0;;;;;;112530:187;112450:271;112368:353;;;:::o;112875:394::-;113082:26;;-1:-1:-1;;;113082:26:0;;;;95795:20;112991:19;113117:17;;;113113:152;;113157:14;;113159:1;;:12;;113157:14;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;113177:41;;-1:-1:-1;;;113177:41:0;;-1:-1:-1;;;;113177:41:0;;;;;;-1:-1:-1;113224:30:0;;;:16;;;:30;;;;;:35;;-1:-1:-1;;;;;113224:35:0;;-1:-1:-1;;;;;;113224:35:0;;;;;;113157:14;-1:-1:-1;113113:152:0;113014:255;112875:394;;;;:::o;123450:458::-;123595:8;123589:4;123582:22;123629:5;123626:1;123622:13;123616:4;123609:27;123666:4;123660;123650:21;123720:1;123713:5;123709:13;123706:1;123702:21;123774:1;123768:8;123813:10;123889:5;123885:1;123882;123878:9;123874:21;123871:1;123867:29;123864:1;123860:37;123857:1;123853:45;123850:1;123843:56;;;;;123450:458;;;:::o;105569:2632::-;-1:-1:-1;;;;;105656:16:0;;105652:52;;105681:23;;-1:-1:-1;;;105681:23:0;;;;;;;;;;;105652:52;95795:20;105711:22;105799:18;105812:4;105799:12;:18::i;:::-;105761:56;;105822:33;105858:16;105871:2;105858:12;:16::i;:::-;105822:52;;105881:23;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;105881:23:0;105929:27;;;-1:-1:-1;;;105929:27:0;;;;;105909:17;;;:47;105979:25;;;;105961:15;;;:43;-1:-1:-1;;;;;;;;106025:23:0;;;;106009:13;;;:39;;;106059:22;;106055:56;;;106090:21;;-1:-1:-1;;;106090:21:0;;;;;;;;;;;106055:56;106134:13;;;:23;;;;;;;;;106163:47;;-1:-1:-1;;;;;106163:47:0;;;-1:-1:-1;;;106163:47:0;;;-1:-1:-1;;;;;106163:47:0;;;;;;106261:21;;;;;;;:30;;106247:11;;;:44;;;106216:76;;;;;;;;;106334:17;;;;106320:54;;93158:8;;106353:20;122863:8;;;122873:9;;122859:24;;122718:174;106320:54;106300:74;;106386:19;;-1:-1:-1;;;106386:19:0;;93655:6;106386:49;106300:17;106386:54;106382:222;;106461:2;-1:-1:-1;;;;;106453:10:0;:4;-1:-1:-1;;;;;106453:10:0;;106449:71;;106503:17;;106483;;;;:37;106465:15;;;:55;106449:71;106547:50;93158:8;106561:1;:11;;;:18;;;;;:::i;:::-;;106581:1;:15;;;122863:8;;;122873:9;;122859:24;;122718:174;106547:50;106527:17;;;:70;106382:222;106611:29;106643:56;106681:1;:17;;;106661:1;:17;;;:37;-1:-1:-1;;;;;;;;;;;;;;;;;120470:4:0;120463;120457:11;120453:22;120537:1;120531:4;120524:15;120568:4;120562;120558:15;120610:1;120607;120603:9;120595:6;120591:22;120585:4;120578:36;120629:4;120626:1;120619:15;120660:6;120656:1;120650:4;120646:12;120639:28;;;120301:375;;;;106643:56;106711:17;;106611:88;;-1:-1:-1;106711:22:0;106707:538;;-1:-1:-1;;;;;106772:13:0;;106742:27;106772:13;;;:7;;;:13;;;;;106812:17;;;;106866;;106890:45;;;-1:-1:-1;;;106890:45:0;;;;;;;;;;;-1:-1:-1;;;;106890:45:0;;;;;;;;;106942;;106854:29;;;106942:45;;;-1:-1:-1;;;106942:45:0;-1:-1:-1;;;;106942:45:0;;;;;;;;;107013:226;-1:-1:-1;;107053:11:0;;;;123358:1;123349:10;;;107024;123341:19;;;;;;;;;;;107053:11;;;123380:1;123365:16;;;;;123341:41;107024;;;;107073:43;107101:1;:4;;107107:2;107111:1;107114;107073:27;:43::i;:::-;107131:20;;;;:16;;;:20;;;;;;;;107124:27;;-1:-1:-1;;;;;;107124:27:0;;;120964:12;;;120958:19;;121019:1;121015:10;;;;121007:2;121003:10;;;121000:26;-1:-1:-1;120997:39:0;120982:55;;121063:17;;121042:39;;107217:20;;;107013:226;;106735:510;;;106707:538;107256:17;;;;:22;107252:807;;-1:-1:-1;;;;;107315:11:0;;107287:25;107315:11;;;:7;;;:11;;;;;;;107351:15;;;;107399:17;;;;107315:11;;107389:27;;;;107440:43;107465:13;107323:2;107440:24;:43::i;:::-;107509:13;;107596:17;;;;-1:-1:-1;;;;107569:45:0;;107549:13;-1:-1:-1;;;107569:45:0;;;;;;;;;;;;;;;;107621:41;;-1:-1:-1;;;;107621:41:0;-1:-1:-1;;;107621:41:0;;;;;;;107423:60;;-1:-1:-1;93158:8:0;-1:-1:-1;;;107509:13:0;;-1:-1:-1;;;;;107509:13:0;:20;;107549:13;;;;;107688:332;107706:31;107711:1;:4;;107717:19;107733:2;123010:1;123005:6;;122926:90;107706:31;:36;;;107699:90;;107757:4;;:15;;;107753:27;;;-1:-1:-1;107779:1:0;107753:27;107699:90;;;107796:34;107801:7;107810;107826:2;107796:4;:34::i;:::-;107838:65;107866:1;:4;;107872:2;107876:7;107892:9;;;;;;107838:27;:65::i;:::-;107911:40;107929:10;107941:2;107945;107949:1;120974;120968:4;120964:12;120958:19;121028:7;121022:2;121019:1;121015:10;121011:1;121007:2;121003:10;121000:26;120997:39;120989:6;120982:55;121075:4;121067:6;121063:17;121059:1;121053:4;121049:12;121042:39;;120776:314;;;;;107911:40;107963:4;;:15;;;107959:27;;;-1:-1:-1;107985:1:0;107959:27;108013:5;108002:7;:16;107688:332;;108026:26;;;;;;;;-1:-1:-1;;108026:26:0;;;;;;-1:-1:-1;;;;;107252:807:0;108070:15;;:22;:27;108066:90;;108134:14;;;;108106:43;;108122:10;;-1:-1:-1;;;;;108134:14:0;108106:15;:43::i;:::-;106118:2043;108185:2;-1:-1:-1;;;;;108170:26:0;108179:4;-1:-1:-1;;;;;108170:26:0;;108189:6;108170:26;;;;1342:25:1;;1330:2;1315:18;;1196:177;108170:26:0;;;;;;;;105647:2554;;;;105569:2632;;;:::o;111956:253::-;112022:21;112046:15;112059:1;112046:12;:15::i;:::-;112071:7;;112022:39;;-1:-1:-1;;;;112071:7:0;;93655:6;112071:37;:42;;112070:53;;;;112066:109;;112131:38;;;-1:-1:-1;;;112131:38:0;;;;;93655:6;112131:38;;;;;-1:-1:-1;;;;112131:38:0;;;;;;112066:109;112195:1;-1:-1:-1;;;;;112184:20:0;;112198:5;112184:20;;;;1169:14:1;1162:22;1144:41;;1132:2;1117:18;;1004:187;112184:20:0;;;;;;;;112017:192;111956:253;;:::o;65896:292::-;-1:-1:-1;;66076:18:0;66066:8;66063:32;66053:126;;66117:10;66111:4;66104:24;66168:4;66162;66155:18;3485:343;3725:4;3713:10;3707:4;3695:10;3680:13;3676:2;3669:5;3664:66;3654:165;;3752:10;3746:4;3739:24;3808:4;3802;3795:18;64971:870;-1:-1:-1;;65737:16:0;;-1:-1:-1;;;;;65607:26:0;;;;;;65697:38;65694:1;;65686:78;65799:27;64971:870::o;123975:588::-;124219:9;124207:10;124203:26;124190:10;124186:2;124182:19;124179:51;124248:8;124242:4;124235:22;124282:2;124279:1;124275:10;124269:4;124262:24;124316:4;124310;124300:21;124367:1;124363:2;124359:10;124356:1;124352:18;124421:1;124415:8;124460:18;124544:5;124540:1;124537;124533:9;124529:21;124526:1;124522:29;124519:1;124515:37;124512:1;124508:45;124505:1;124498:56;;;;;;123975:588;;;;:::o;121183:538::-;121330:1;121324:8;121356:4;121350;121346:15;121406:10;121403:1;121396:21;121472:4;121465;121462:1;121458:12;121451:26;121559:4;121553:11;121550:1;121546:19;121540:4;121536:30;121527:39;;121676:4;121673:1;121670;121663:4;121660:1;121656:12;121653:1;121645:6;121638:5;121633:48;121629:1;121625;121619:8;121616:15;121612:70;121602:110;;121701:4;121698:1;121691:15;121602:110;;;121183:538;;:::o;14:548:1:-;126:4;155:2;184;173:9;166:21;216:6;210:13;259:6;254:2;243:9;239:18;232:34;284:1;294:140;308:6;305:1;302:13;294:140;;;403:14;;;399:23;;393:30;369:17;;;388:2;365:26;358:66;323:10;;294:140;;;298:3;483:1;478:2;469:6;458:9;454:22;450:31;443:42;553:2;546;542:7;537:2;529:6;525:15;521:29;510:9;506:45;502:54;494:62;;;;14:548;;;;:::o;567:173::-;635:20;;-1:-1:-1;;;;;684:31:1;;674:42;;664:70;;730:1;727;720:12;664:70;567:173;;;:::o;745:254::-;813:6;821;874:2;862:9;853:7;849:23;845:32;842:52;;;890:1;887;880:12;842:52;913:29;932:9;913:29;:::i;:::-;903:39;989:2;974:18;;;;961:32;;-1:-1:-1;;;745:254:1:o;1378:328::-;1455:6;1463;1471;1524:2;1512:9;1503:7;1499:23;1495:32;1492:52;;;1540:1;1537;1530:12;1492:52;1563:29;1582:9;1563:29;:::i;:::-;1553:39;;1611:38;1645:2;1634:9;1630:18;1611:38;:::i;:::-;1601:48;;1696:2;1685:9;1681:18;1668:32;1658:42;;1378:328;;;;;:::o;1711:186::-;1770:6;1823:2;1811:9;1802:7;1798:23;1794:32;1791:52;;;1839:1;1836;1829:12;1791:52;1862:29;1881:9;1862:29;:::i;1902:273::-;1958:6;2011:2;1999:9;1990:7;1986:23;1982:32;1979:52;;;2027:1;2024;2017:12;1979:52;2066:9;2053:23;2119:5;2112:13;2105:21;2098:5;2095:32;2085:60;;2141:1;2138;2131:12;2577:592;2648:6;2656;2709:2;2697:9;2688:7;2684:23;2680:32;2677:52;;;2725:1;2722;2715:12;2677:52;2765:9;2752:23;2794:18;2835:2;2827:6;2824:14;2821:34;;;2851:1;2848;2841:12;2821:34;2889:6;2878:9;2874:22;2864:32;;2934:7;2927:4;2923:2;2919:13;2915:27;2905:55;;2956:1;2953;2946:12;2905:55;2996:2;2983:16;3022:2;3014:6;3011:14;3008:34;;;3038:1;3035;3028:12;3008:34;3083:7;3078:2;3069:6;3065:2;3061:15;3057:24;3054:37;3051:57;;;3104:1;3101;3094:12;3051:57;3135:2;3127:11;;;;;3157:6;;-1:-1:-1;2577:592:1;;-1:-1:-1;;;;2577:592:1:o;3174:180::-;3233:6;3286:2;3274:9;3265:7;3261:23;3257:32;3254:52;;;3302:1;3299;3292:12;3254:52;-1:-1:-1;3325:23:1;;3174:180;-1:-1:-1;3174:180:1:o;3359:260::-;3427:6;3435;3488:2;3476:9;3467:7;3463:23;3459:32;3456:52;;;3504:1;3501;3494:12;3456:52;3527:29;3546:9;3527:29;:::i;:::-;3517:39;;3575:38;3609:2;3598:9;3594:18;3575:38;:::i;:::-;3565:48;;3359:260;;;;;:::o;3624:127::-;3685:10;3680:3;3676:20;3673:1;3666:31;3716:4;3713:1;3706:15;3740:4;3737:1;3730:15;3756:191;-1:-1:-1;;;;;3883:10:1;;;3871;;;3867:27;;3906:12;;;3903:38;;;3921:18;;:::i;3952:380::-;4031:1;4027:12;;;;4074;;;4095:61;;4149:4;4141:6;4137:17;4127:27;;4095:61;4202:2;4194:6;4191:14;4171:18;4168:38;4165:161;;4248:10;4243:3;4239:20;4236:1;4229:31;4283:4;4280:1;4273:15;4311:4;4308:1;4301:15;4337:127;4398:10;4393:3;4389:20;4386:1;4379:31;4429:4;4426:1;4419:15;4453:4;4450:1;4443:15;4595:545;4697:2;4692:3;4689:11;4686:448;;;4733:1;4758:5;4754:2;4747:17;4803:4;4799:2;4789:19;4873:2;4861:10;4857:19;4854:1;4850:27;4844:4;4840:38;4909:4;4897:10;4894:20;4891:47;;;-1:-1:-1;4932:4:1;4891:47;4987:2;4982:3;4978:12;4975:1;4971:20;4965:4;4961:31;4951:41;;5042:82;5060:2;5053:5;5050:13;5042:82;;;5105:17;;;5086:1;5075:13;5042:82;;;5046:3;;;4595:545;;;:::o;5316:1206::-;5440:18;5435:3;5432:27;5429:53;;;5462:18;;:::i;:::-;5491:94;5581:3;5541:38;5573:4;5567:11;5541:38;:::i;:::-;5535:4;5491:94;:::i;:::-;5611:1;5636:2;5631:3;5628:11;5653:1;5648:616;;;;6308:1;6325:3;6322:93;;;-1:-1:-1;6381:19:1;;;6368:33;6322:93;-1:-1:-1;;5273:1:1;5269:11;;;5265:24;5261:29;5251:40;5297:1;5293:11;;;5248:57;6428:78;;5621:895;;5648:616;4542:1;4535:14;;;4579:4;4566:18;;-1:-1:-1;;5684:17:1;;;5785:9;5807:229;5821:7;5818:1;5815:14;5807:229;;;5910:19;;;5897:33;5882:49;;6017:4;6002:20;;;;5970:1;5958:14;;;;5837:12;5807:229;;;5811:3;6064;6055:7;6052:16;6049:159;;;6188:1;6184:6;6178:3;6172;6169:1;6165:11;6161:21;6157:34;6153:39;6140:9;6135:3;6131:19;6118:33;6114:79;6106:6;6099:95;6049:159;;;6251:1;6245:3;6242:1;6238:11;6234:19;6228:4;6221:33;5621:895;;;5316:1206;;;:::o;6527:201::-;6565:3;6593:10;6638:2;6631:5;6627:14;6665:2;6656:7;6653:15;6650:41;;6671:18;;:::i;:::-;6720:1;6707:15;;6527:201;-1:-1:-1;;;6527:201:1:o;6733:127::-;6794:10;6789:3;6785:20;6782:1;6775:31;6825:4;6822:1;6815:15;6849:4;6846:1;6839:15
Swarm Source
ipfs://14132e2dba0057e1e9509430b17f78c07e06c5e3699bd2b2f59ca5ce52d1254f
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.