ERC-1155
Overview
Max Total Supply
0 DROPS
Holders
501
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
BearishDrops
Compiler Version
v0.8.28+commit.7893614a
ZkSolc Version
v1.5.10
Optimization Enabled:
Yes with Mode 3
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; import {ERC1155} from "solady/src/tokens/ext/zksync/ERC1155.sol"; import {Ownable} from "solady/src/auth/Ownable.sol"; import {Base64} from "solady/src/utils/Base64.sol"; import {LibString} from "solady/src/utils/LibString.sol"; /** * @title BearishDrops * @author * @notice A soulbound ERC1155 using Solady, with on-chain JSON metadata (IPFS for images). * This contract is used to manage drops of Bearish RWA tokens. They can be soulbound or not. */ contract BearishDrops is ERC1155, Ownable { using LibString for uint256; // ------------------------------------------------------------------- // Errors // ------------------------------------------------------------------- error Soulbound(); // Thrown when attempting user-to-user transfer of a soulbound token error NotRWAManager(); // Thrown if caller is neither owner nor RWA manager error InvalidLengths(); // Thrown if batch arrays mismatch error ZeroAddress(); // Thrown on invalid zero address parameter // ------------------------------------------------------------------- // RWA Manager Role // ------------------------------------------------------------------- mapping(address => bool) public rwaManagers; /** * @dev Grants or revokes the RWA_MANAGER role for `_manager`. * Only the contract owner can call this. */ function setRwaManager(address _manager, bool _status) external onlyOwner { if (_manager == address(0)) revert ZeroAddress(); rwaManagers[_manager] = _status; } /** * @dev Modifier that checks msg.sender is the owner OR an RWA manager. */ modifier onlyOwnerOrRwaManager() { if (msg.sender != owner() && !rwaManagers[msg.sender]) { revert NotRWAManager(); } _; } // ------------------------------------------------------------------- // Metadata Storage // ------------------------------------------------------------------- struct OnChainMetadata { string name; string description; string imageIpfsHash; bool soulbound; } string public name; string public symbol; /// @dev Each tokenId => on-chain metadata mapping(uint256 => OnChainMetadata) private _tokenMetadata; // ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- constructor() { _initializeOwner(msg.sender); name = "Bearish Drops"; symbol = "DROPS"; // Owner is also a default RWA manager rwaManagers[msg.sender] = true; } // ------------------------------------------------------------------- // Soulbound Overrides (No Transfers Except Mint/Burn) // ------------------------------------------------------------------- /** * @notice Forbids normal transfers of soulbound tokens: only mint (from == 0) or burn (to == 0) is allowed. * Reverts with Soulbound() if `from` and `to` are both non-zero and `soulbound[id] == true`. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) public virtual override { if (_tokenMetadata[id].soulbound) { if (from != address(0) && to != address(0)) { revert Soulbound(); } } super.safeTransferFrom(from, to, id, amount, data); } function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) public virtual override { for (uint256 i = 0; i < ids.length; i++) { if (_tokenMetadata[ids[i]].soulbound) { if (from != address(0) && to != address(0)) { revert Soulbound(); } } } super.safeBatchTransferFrom(from, to, ids, amounts, data); } // ------------------------------------------------------------------- // Mint & Burn (Owner / RWA_MANAGER) // ------------------------------------------------------------------- function mint( address to, uint256 id, uint256 amount, bytes calldata data ) external onlyOwnerOrRwaManager { if (to == address(0)) revert ZeroAddress(); _mint(to, id, amount, data); } function burn( address from, uint256 id, uint256 amount ) external onlyOwnerOrRwaManager { _burn(from, id, amount); } function mintBatch( address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external onlyOwnerOrRwaManager { if (to == address(0)) revert ZeroAddress(); if (ids.length != amounts.length) revert InvalidLengths(); _batchMint(to, ids, amounts, data); } function burnBatch( address from, uint256[] calldata ids, uint256[] calldata amounts ) external onlyOwnerOrRwaManager { if (ids.length != amounts.length) revert InvalidLengths(); _batchBurn(from, ids, amounts); } // ------------------------------------------------------------------- // On-Chain Metadata // ------------------------------------------------------------------- /** * @notice Sets the on-chain metadata for a given tokenId. */ function setTokenMetadata( uint256 tokenId, string calldata _name, string calldata _description, string calldata _ipfsHash, bool _soulbound ) external onlyOwnerOrRwaManager { _tokenMetadata[tokenId] = OnChainMetadata({ name: _name, description: _description, imageIpfsHash: _ipfsHash, soulbound: _soulbound }); } /** * @notice Returns Base64-encoded JSON metadata for `tokenId`. * Format: data:application/json;base64,<base64-encoded-json> * * We also demonstrate JSON string escaping for name, description, * and image, in case they contain special characters or quotes. */ function uri( uint256 tokenId ) public view virtual override returns (string memory) { OnChainMetadata memory meta = _tokenMetadata[tokenId]; // Fallback if name or desc is unset string memory name_ = bytes(meta.name).length > 0 ? meta.name : string(abi.encodePacked("Token #", tokenId.toString())); string memory desc_ = bytes(meta.description).length > 0 ? meta.description : "No description set."; string memory image_ = bytes(meta.imageIpfsHash).length > 0 ? string(abi.encodePacked("ipfs://", meta.imageIpfsHash)) : ""; string memory nameEsc = LibString.escapeJSON(name_, false); string memory descEsc = LibString.escapeJSON(desc_, false); string memory imageEsc = LibString.escapeJSON(image_, false); string memory json = string( abi.encodePacked( "{", '"name":"', nameEsc, '","description":"', descEsc, '","image":"', imageEsc, '","soulbound":"', meta.soulbound ? "YES" : "NO", '"}' ) ); return string( abi.encodePacked( "data:application/json;base64,", Base64.encode(bytes(json)) ) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {LibBytes} from "./LibBytes.sol"; /// @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 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STRUCTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Goated string storage struct that totally MOGs, no cap, fr. /// Uses less gas and bytecode than Solidity's native string storage. It's meta af. /// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. struct StringStorage { bytes32 _spacer; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* 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(); /// @dev The input string must be a 7-bit ASCII. error StringNot7BitASCII(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the string. uint256 internal constant NOT_FOUND = type(uint256).max; /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant ALPHANUMERIC_7_BIT_ASCII = 0x7fffffe07fffffe03ff000000000000; /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant LETTERS_7_BIT_ASCII = 0x7fffffe07fffffe0000000000000000; /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyz'. uint128 internal constant LOWERCASE_7_BIT_ASCII = 0x7fffffe000000000000000000000000; /// @dev Lookup for 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant UPPERCASE_7_BIT_ASCII = 0x7fffffe0000000000000000; /// @dev Lookup for '0123456789'. uint128 internal constant DIGITS_7_BIT_ASCII = 0x3ff000000000000; /// @dev Lookup for '0123456789abcdefABCDEF'. uint128 internal constant HEXDIGITS_7_BIT_ASCII = 0x7e0000007e03ff000000000000; /// @dev Lookup for '01234567'. uint128 internal constant OCTDIGITS_7_BIT_ASCII = 0xff000000000000; /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'. uint128 internal constant PRINTABLE_7_BIT_ASCII = 0x7fffffffffffffffffffffff00003e00; /// @dev Lookup for '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'. uint128 internal constant PUNCTUATION_7_BIT_ASCII = 0x78000001f8000001fc00fffe00000000; /// @dev Lookup for ' \t\n\r\x0b\x0c'. uint128 internal constant WHITESPACE_7_BIT_ASCII = 0x100003e00; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STRING STORAGE OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sets the value of the string storage `$` to `s`. function set(StringStorage storage $, string memory s) internal { LibBytes.set(bytesStorage($), bytes(s)); } /// @dev Sets the value of the string storage `$` to `s`. function setCalldata(StringStorage storage $, string calldata s) internal { LibBytes.setCalldata(bytesStorage($), bytes(s)); } /// @dev Sets the value of the string storage `$` to the empty string. function clear(StringStorage storage $) internal { delete $._spacer; } /// @dev Returns whether the value stored is `$` is the empty string "". function isEmpty(StringStorage storage $) internal view returns (bool) { return uint256($._spacer) & 0xff == uint256(0); } /// @dev Returns the length of the value stored in `$`. function length(StringStorage storage $) internal view returns (uint256) { return LibBytes.length(bytesStorage($)); } /// @dev Returns the value stored in `$`. function get(StringStorage storage $) internal view returns (string memory) { return string(LibBytes.get(bytesStorage($))); } /// @dev Helper to cast `$` to a `BytesStorage`. function bytesStorage(StringStorage storage $) internal pure returns (LibBytes.BytesStorage storage casted) { /// @solidity memory-safe-assembly assembly { casted.slot := $.slot } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the base 10 decimal representation of `value`. function toString(uint256 value) internal pure returns (string memory result) { /// @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. result := add(mload(0x40), 0x80) mstore(0x40, add(result, 0x20)) // Allocate memory. mstore(result, 0) // Zeroize the slot after the string. let end := result // Cache the end of the memory to calculate the length later. 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 {} { result := add(result, w) // `sub(result, 1)`. // Store the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(result, add(48, mod(temp, 10))) temp := div(temp, 10) // Keep dividing `temp` until zero. if iszero(temp) { break } } let n := sub(end, result) result := sub(result, 0x20) // Move the pointer 32 bytes back to make room for the length. mstore(result, n) // Store the length. } } /// @dev Returns the base 10 decimal representation of `value`. function toString(int256 value) internal pure returns (string memory result) { if (value >= 0) return toString(uint256(value)); unchecked { result = 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 n := mload(result) // Load the string length. mstore(result, 0x2d) // Store the '-' character. result := sub(result, 1) // Move back the string pointer by a byte. mstore(result, add(n, 1)) // Update the string length. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HEXADECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `byteCount` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `byteCount * 2 + 2` bytes. /// Reverts if `byteCount` is too small for the output to contain all the digits. function toHexString(uint256 value, uint256 byteCount) internal pure returns (string memory result) { result = toHexStringNoPrefix(value, byteCount); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store the length. } } /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `byteCount` bytes. /// The output is not prefixed with "0x" and is encoded using 2 hexadecimal digits per byte, /// giving a total length of `byteCount * 2` bytes. /// Reverts if `byteCount` is too small for the output to contain all the digits. function toHexStringNoPrefix(uint256 value, uint256 byteCount) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, `byteCount * 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. result := add(mload(0x40), and(add(shl(1, byteCount), 0x42), not(0x1f))) mstore(0x40, add(result, 0x20)) // Allocate memory. mstore(result, 0) // Zeroize the slot after the string. let end := result // Cache the end to calculate the length later. // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let start := sub(result, add(byteCount, byteCount)) 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 {} { result := add(result, w) // `sub(result, 2)`. mstore8(add(result, 1), mload(and(temp, 15))) mstore8(result, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(xor(result, start)) { break } } if temp { mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`. revert(0x1c, 0x04) } let n := sub(end, result) result := sub(result, 0x20) mstore(result, n) // Store the length. } } /// @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 result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store 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 result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. let n := add(mload(result), 2) // Compute the length. mstore(add(result, o), 0x3078) // Store the "0x" prefix, accounting for leading zero. result := sub(add(result, o), 2) // Move the pointer, accounting for leading zero. mstore(result, sub(n, o)) // Store 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 result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. let n := mload(result) // Get the length. result := add(result, o) // Move the pointer, accounting for leading zero. mstore(result, sub(n, o)) // Store 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 result) { /// @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. result := add(mload(0x40), 0x80) mstore(0x40, add(result, 0x20)) // Allocate memory. mstore(result, 0) // Zeroize the slot after the string. let end := result // Cache the end to calculate the length later. mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. 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 {} { result := add(result, w) // `sub(result, 2)`. mstore8(add(result, 1), mload(and(temp, 15))) mstore8(result, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(temp) { break } } let n := sub(end, result) result := sub(result, 0x20) mstore(result, n) // Store the length. } } /// @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 result) { result = toHexString(value); /// @solidity memory-safe-assembly assembly { let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...` let o := add(result, 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 result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store 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 result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) // Allocate 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(result, 0x80)) mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. result := add(result, 2) mstore(result, 40) // Store the length. let o := add(result, 0x20) mstore(add(o, 40), 0) // Zeroize the slot after the string. 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 result) { result = toHexStringNoPrefix(raw); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store 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 result) { /// @solidity memory-safe-assembly assembly { let n := mload(raw) result := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix. mstore(result, add(n, n)) // Store the length of the output. mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. let o := add(result, 0x20) let end := add(raw, n) 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 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 { result := 1 let mask := shl(7, div(not(0), 255)) 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) } } } /// @dev Returns if this string is a 7-bit ASCII string, /// AND all characters are in the `allowed` lookup. /// Note: If `s` is empty, returns true regardless of `allowed`. function is7BitASCII(string memory s, uint128 allowed) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := 1 if mload(s) { let allowed_ := shr(128, shl(128, allowed)) let o := add(s, 0x20) for { let end := add(o, mload(s)) } 1 {} { result := and(result, shr(byte(0, mload(o)), allowed_)) o := add(o, 1) if iszero(and(result, lt(o, end))) { break } } } } } /// @dev Converts the bytes in the 7-bit ASCII string `s` to /// an allowed lookup for use in `is7BitASCII(s, allowed)`. /// To save runtime gas, you can cache the result in an immutable variable. function to7BitASCIIAllowedLookup(string memory s) internal pure returns (uint128 result) { /// @solidity memory-safe-assembly assembly { if mload(s) { let o := add(s, 0x20) for { let end := add(o, mload(s)) } 1 {} { result := or(result, shl(byte(0, mload(o)), 1)) o := add(o, 1) if iszero(lt(o, end)) { break } } if shr(128, result) { mstore(0x00, 0xc9807e0d) // `StringNot7BitASCII()`. revert(0x1c, 0x04) } } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* 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 `needle` replaced with `replacement`. function replace(string memory subject, string memory needle, string memory replacement) internal pure returns (string memory) { return string(LibBytes.replace(bytes(subject), bytes(needle), bytes(replacement))); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from left to right, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(string memory subject, string memory needle, uint256 from) internal pure returns (uint256) { return LibBytes.indexOf(bytes(subject), bytes(needle), from); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from left to right. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(string memory subject, string memory needle) internal pure returns (uint256) { return LibBytes.indexOf(bytes(subject), bytes(needle), 0); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from right to left, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(string memory subject, string memory needle, uint256 from) internal pure returns (uint256) { return LibBytes.lastIndexOf(bytes(subject), bytes(needle), from); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from right to left. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(string memory subject, string memory needle) internal pure returns (uint256) { return LibBytes.lastIndexOf(bytes(subject), bytes(needle), type(uint256).max); } /// @dev Returns true if `needle` is found in `subject`, false otherwise. function contains(string memory subject, string memory needle) internal pure returns (bool) { return LibBytes.contains(bytes(subject), bytes(needle)); } /// @dev Returns whether `subject` starts with `needle`. function startsWith(string memory subject, string memory needle) internal pure returns (bool) { return LibBytes.startsWith(bytes(subject), bytes(needle)); } /// @dev Returns whether `subject` ends with `needle`. function endsWith(string memory subject, string memory needle) internal pure returns (bool) { return LibBytes.endsWith(bytes(subject), bytes(needle)); } /// @dev Returns `subject` repeated `times`. function repeat(string memory subject, uint256 times) internal pure returns (string memory) { return string(LibBytes.repeat(bytes(subject), times)); } /// @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) { return string(LibBytes.slice(bytes(subject), start, end)); } /// @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) { return string(LibBytes.slice(bytes(subject), start, type(uint256).max)); } /// @dev Returns all the indices of `needle` in `subject`. /// The indices are byte offsets. function indicesOf(string memory subject, string memory needle) internal pure returns (uint256[] memory) { return LibBytes.indicesOf(bytes(subject), bytes(needle)); } /// @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) { bytes[] memory a = LibBytes.split(bytes(subject), bytes(delimiter)); /// @solidity memory-safe-assembly assembly { result := a } } /// @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) { return string(LibBytes.concat(bytes(a), bytes(b))); } /// @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 n := mload(subject) if n { result := mload(0x40) let o := add(result, 0x20) let d := sub(subject, result) let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff) for { let end := add(o, n) } 1 {} { let b := byte(0, mload(add(d, o))) mstore8(o, xor(and(shr(b, flags), 0x20), b)) o := add(o, 1) if eq(o, end) { break } } mstore(result, n) // Store the length. mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate 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) // Store the length. let o := add(result, 0x20) mstore(o, s) // Store the bytes of the string. mstore(add(o, n), 0) // Zeroize the slot after the string. mstore(0x40, add(result, 0x40)) // Allocate memory. } } /// @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 { result := mload(0x40) let end := add(s, mload(s)) let o := add(result, 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(o, c) o := add(o, 1) continue } let t := shr(248, mload(c)) mstore(o, mload(and(t, 0x1f))) o := add(o, shr(5, t)) } mstore(o, 0) // Zeroize the slot after the string. mstore(result, sub(o, add(result, 0x20))) // Store the length. mstore(0x40, add(o, 0x20)) // Allocate 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 { result := mload(0x40) let o := add(result, 0x20) if addDoubleQuotes { mstore8(o, 34) o := add(1, o) } // 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 { let end := add(s, mload(s)) } 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(o, c) o := add(o, 1) continue } mstore8(o, 0x5c) // "\\". mstore8(add(o, 1), c) o := add(o, 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(o, mload(0x19)) // "\\u00XX". o := add(o, 6) continue } mstore8(o, 0x5c) // "\\". mstore8(add(o, 1), mload(add(c, 8))) o := add(o, 2) } if addDoubleQuotes { mstore8(o, 34) o := add(1, o) } mstore(o, 0) // Zeroize the slot after the string. mstore(result, sub(o, add(result, 0x20))) // Store the length. mstore(0x40, add(o, 0x20)) // Allocate 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 Encodes `s` so that it can be safely used in a URI, /// just like `encodeURIComponent` in JavaScript. /// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent /// See: https://datatracker.ietf.org/doc/html/rfc2396 /// See: https://datatracker.ietf.org/doc/html/rfc3986 function encodeURIComponent(string memory s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) // Store "0123456789ABCDEF" in scratch space. // Uppercased to be consistent with JavaScript's implementation. mstore(0x0f, 0x30313233343536373839414243444546) let o := add(result, 0x20) for { let end := add(s, mload(s)) } iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) // If not in `[0-9A-Z-a-z-_.!~*'()]`. if iszero(and(1, shr(c, 0x47fffffe87fffffe03ff678200000000))) { mstore8(o, 0x25) // '%'. mstore8(add(o, 1), mload(and(shr(4, c), 15))) mstore8(add(o, 2), mload(and(c, 15))) o := add(o, 3) continue } mstore8(o, c) o := add(o, 1) } mstore(result, sub(o, add(result, 0x20))) // Store the length. mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate memory. } } /// @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 Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. function cmp(string memory a, string memory b) internal pure returns (int256) { return LibBytes.cmp(bytes(a), bytes(b)); } /// @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 { result := mload(0x40) // Grab the free memory pointer. mstore(0x40, add(result, 0x40)) // Allocate 2 words (1 for the length, 1 for the bytes). mstore(result, 0) // Zeroize the length slot. mstore(add(result, 0x1f), packed) // Store the length and bytes. mstore(add(add(result, 0x20), mload(result)), 0) // Right pad with zeroes. } } /// @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 aLen := mload(a) // We don't need to zero right pad the strings, // since this is our own custom non-standard packing scheme. result := mul( or( // Load the length and the bytes of `a` and `b`. shl(shl(3, sub(0x1f, aLen)), mload(add(a, aLen))), mload(sub(add(b, 0x1e), aLen))), // `totalLen != 0 && totalLen < 31`. Abuses underflow. // Assumes that the lengths are valid and within the block gas limit. lt(sub(add(aLen, 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 { resultA := mload(0x40) // Grab the free memory pointer. 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 retUnpaddedSize := 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, retUnpaddedSize), 0) mstore(retStart, 0x20) // Store the return offset. // End the transaction, returning the string. return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library to encode strings in Base64. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol) /// @author Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos - <[email protected]>. library Base64 { /// @dev Encodes `data` using the base64 encoding described in RFC 4648. /// See: https://datatracker.ietf.org/doc/html/rfc4648 /// @param fileSafe Whether to replace '+' with '-' and '/' with '_'. /// @param noPadding Whether to strip away the padding. function encode(bytes memory data, bool fileSafe, bool noPadding) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let dataLength := mload(data) if dataLength { // Multiply by 4/3 rounded up. // The `shl(2, ...)` is equivalent to multiplying by 4. let encodedLength := shl(2, div(add(dataLength, 2), 3)) // Set `result` to point to the start of the free memory. result := mload(0x40) // Store the table into the scratch space. // Offsetted by -1 byte so that the `mload` will load the character. // We will rewrite the free memory pointer at `0x40` later with // the allocated size. // The magic constant 0x0670 will turn "-_" into "+/". mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef") mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0670))) // Skip the first slot, which stores the length. let ptr := add(result, 0x20) let end := add(ptr, encodedLength) let dataEnd := add(add(0x20, data), dataLength) let dataEndValue := mload(dataEnd) // Cache the value at the `dataEnd` slot. mstore(dataEnd, 0x00) // Zeroize the `dataEnd` slot to clear dirty bits. // Run over the input, 3 bytes at a time. for {} 1 {} { data := add(data, 3) // Advance 3 bytes. let input := mload(data) // Write 4 bytes. Optimized for fewer stack operations. mstore8(0, mload(and(shr(18, input), 0x3F))) mstore8(1, mload(and(shr(12, input), 0x3F))) mstore8(2, mload(and(shr(6, input), 0x3F))) mstore8(3, mload(and(input, 0x3F))) mstore(ptr, mload(0x00)) ptr := add(ptr, 4) // Advance 4 bytes. if iszero(lt(ptr, end)) { break } } mstore(dataEnd, dataEndValue) // Restore the cached value at `dataEnd`. mstore(0x40, add(end, 0x20)) // Allocate the memory. // Equivalent to `o = [0, 2, 1][dataLength % 3]`. let o := div(2, mod(dataLength, 3)) // Offset `ptr` and pad with '='. We can simply write over the end. mstore(sub(ptr, o), shl(240, 0x3d3d)) // Set `o` to zero if there is padding. o := mul(iszero(iszero(noPadding)), o) mstore(sub(ptr, o), 0) // Zeroize the slot after the string. mstore(result, sub(encodedLength, o)) // Store the length. } } } /// @dev Encodes `data` using the base64 encoding described in RFC 4648. /// Equivalent to `encode(data, false, false)`. function encode(bytes memory data) internal pure returns (string memory result) { result = encode(data, false, false); } /// @dev Encodes `data` using the base64 encoding described in RFC 4648. /// Equivalent to `encode(data, fileSafe, false)`. function encode(bytes memory data, bool fileSafe) internal pure returns (string memory result) { result = encode(data, fileSafe, false); } /// @dev Decodes base64 encoded `data`. /// /// Supports: /// - RFC 4648 (both standard and file-safe mode). /// - RFC 3501 (63: ','). /// /// Does not support: /// - Line breaks. /// /// Note: For performance reasons, /// this function will NOT revert on invalid `data` inputs. /// Outputs for invalid inputs will simply be undefined behaviour. /// It is the user's responsibility to ensure that the `data` /// is a valid base64 encoded string. function decode(string memory data) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { let dataLength := mload(data) if dataLength { let decodedLength := mul(shr(2, dataLength), 3) for {} 1 {} { // If padded. if iszero(and(dataLength, 3)) { let t := xor(mload(add(data, dataLength)), 0x3d3d) // forgefmt: disable-next-item decodedLength := sub( decodedLength, add(iszero(byte(30, t)), iszero(byte(31, t))) ) break } // If non-padded. decodedLength := add(decodedLength, sub(and(dataLength, 3), 1)) break } result := mload(0x40) // Write the length of the bytes. mstore(result, decodedLength) // Skip the first slot, which stores the length. let ptr := add(result, 0x20) let end := add(ptr, decodedLength) // Load the table into the scratch space. // Constants are optimized for smaller bytecode with zero gas overhead. // `m` also doubles as the mask of the upper 6 bits. let m := 0xfc000000fc00686c7074787c8084888c9094989ca0a4a8acb0b4b8bcc0c4c8cc mstore(0x5b, m) mstore(0x3b, 0x04080c1014181c2024282c3034383c4044484c5054585c6064) mstore(0x1a, 0xf8fcf800fcd0d4d8dce0e4e8ecf0f4) for {} 1 {} { // Read 4 bytes. data := add(data, 4) let input := mload(data) // Write 3 bytes. // forgefmt: disable-next-item mstore(ptr, or( and(m, mload(byte(28, input))), shr(6, or( and(m, mload(byte(29, input))), shr(6, or( and(m, mload(byte(30, input))), shr(6, mload(byte(31, input))) )) )) )) ptr := add(ptr, 3) if iszero(lt(ptr, end)) { break } } mstore(0x40, add(end, 0x20)) // Allocate the memory. mstore(end, 0) // Zeroize the slot after the bytes. mstore(0x60, 0) // Restore the zero slot. } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC1155 implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ext/zksync/ERC1155.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol) /// /// @dev Note: /// - The ERC1155 standard allows for self-approvals. /// For performance, this implementation WILL NOT revert for such actions. /// Please add any checks with overrides if desired. /// /// If you are overriding: /// - Make sure all variables written to storage are properly cleaned // (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood). /// - Check that the overridden function is actually used in the function you want to /// change the behavior of. Much of the code has been manually inlined for performance. abstract contract ERC1155 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The lengths of the input arrays are not the same. error ArrayLengthsMismatch(); /// @dev Cannot mint or transfer to the zero address. error TransferToZeroAddress(); /// @dev The recipient's balance has overflowed. error AccountBalanceOverflow(); /// @dev Insufficient balance. error InsufficientBalance(); /// @dev Only the token owner or an approved account can manage the tokens. error NotOwnerNorApproved(); /// @dev Cannot safely transfer to a contract that does not implement /// the ERC1155Receiver interface. error TransferToNonERC1155ReceiverImplementer(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when `amount` of token `id` is transferred /// from `from` to `to` by `operator`. event TransferSingle( address indexed operator, address indexed from, address indexed to, uint256 id, uint256 amount ); /// @dev Emitted when `amounts` of token `ids` are transferred /// from `from` to `to` by `operator`. event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] amounts ); /// @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 Emitted when the Uniform Resource Identifier (URI) for token `id` /// is updated to `value`. This event is not used in the base contract. /// You may need to emit this event depending on your URI logic. /// /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata event URI(string value, uint256 indexed id); /// @dev `keccak256(bytes("TransferSingle(address,address,address,uint256,uint256)"))`. uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE = 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62; /// @dev `keccak256(bytes("TransferBatch(address,address,address,uint256[],uint256[])"))`. uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE = 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `ownerSlotSeed` of a given owner is given by. /// ``` /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)) /// ``` /// /// The balance slot of `owner` is given by. /// ``` /// mstore(0x20, ownerSlotSeed) /// mstore(0x00, id) /// let balanceSlot := keccak256(0x00, 0x40) /// ``` /// /// The operator approval slot of `owner` is given by. /// ``` /// mstore(0x20, ownerSlotSeed) /// mstore(0x00, operator) /// let operatorApprovalSlot := keccak256(0x0c, 0x34) /// ``` uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC1155 METADATA */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the URI for token `id`. /// /// You can either return the same templated URI for all token IDs, /// (e.g. "https://example.com/api/{id}.json"), /// or return a unique URI for each `id`. /// /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata function uri(uint256 id) public view virtual returns (string memory); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC1155 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the amount of `id` owned by `owner`. function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, owner) mstore(0x00, id) result := sload(keccak256(0x00, 0x40)) } } /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. function isApprovedForAll(address owner, address operator) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, owner) mstore(0x00, operator) result := sload(keccak256(0x0c, 0x34)) } } /// @dev Sets whether `operator` is approved to manage the tokens of the caller. /// /// Emits a {ApprovalForAll} event. function setApprovalForAll(address operator, bool isApproved) public virtual { /// @solidity memory-safe-assembly assembly { // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`msg.sender`, `operator`). mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, caller()) mstore(0x00, operator) sstore(keccak256(0x0c, 0x34), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) // forgefmt: disable-next-line log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) } } /// @dev Transfers `amount` of `id` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `from` must have at least `amount` of `id`. /// - If the caller is not `from`, /// it must be approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. /// /// Emits a {TransferSingle} event. function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) public virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) mstore(0x20, fromSlotSeed) // Clear the upper 96 bits. from := shr(96, fromSlotSeed) to := shr(96, toSlotSeed) // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // If the caller is not `from`, do the authorization check. if iszero(eq(caller(), from)) { mstore(0x00, caller()) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Subtract and store the updated balance of `from`. { mstore(0x00, id) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, toSlotSeed) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } // Emit a {TransferSingle} event. mstore(0x20, amount) log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { // Do the {onERC1155Received} check if `to` is a smart contract. if extcodesize(to) { // Prepare the calldata. let m := mload(0x40) // `onERC1155Received(address,address,uint256,uint256,bytes)`. mstore(m, 0xf23a6e61) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), from) mstore(add(m, 0x60), id) mstore(add(m, 0x80), amount) mstore(add(m, 0xa0), 0xa0) mstore(add(m, 0xc0), data.length) calldatacopy(add(m, 0xe0), data.offset, data.length) // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), 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 with the function selector. if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } } /// @dev Transfers `amounts` of `ids` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `from` must have at least `amount` of `id`. /// - `ids` and `amounts` must have the same length. /// - If the caller is not `from`, /// it must be approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. /// /// Emits a {TransferBatch} event. function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) public virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { if iszero(eq(ids.length, amounts.length)) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) mstore(0x20, fromSlotSeed) // Clear the upper 96 bits. from := shr(96, fromSlotSeed) to := shr(96, toSlotSeed) // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // If the caller is not `from`, do the authorization check. if iszero(eq(caller(), from)) { mstore(0x00, caller()) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Loop through all the `ids` and update the balances. { for { let i := shl(5, ids.length) } i {} { i := sub(i, 0x20) let amount := calldataload(add(amounts.offset, i)) // Subtract and store the updated balance of `from`. { mstore(0x20, fromSlotSeed) mstore(0x00, calldataload(add(ids.offset, i))) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, toSlotSeed) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := shl(5, ids.length) mstore(add(m, 0x40), ids.length) calldatacopy(add(m, 0x60), ids.offset, n) // Copy the `amounts`. mstore(add(m, 0x20), add(0x60, n)) let o := add(add(m, n), 0x60) mstore(o, ids.length) calldatacopy(add(o, 0x20), amounts.offset, n) // Do the emit. log4(m, add(add(n, n), 0x80), _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to) } } if (_useAfterTokenTransfer()) { _afterTokenTransferCalldata(from, to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { // Do the {onERC1155BatchReceived} check if `to` is a smart contract. if extcodesize(to) { mstore(0x00, to) // Cache `to` to prevent stack too deep. let m := mload(0x40) // Prepare the calldata. // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. mstore(m, 0xbc197c81) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), from) // Copy the `ids`. mstore(add(m, 0x60), 0xa0) let n := shl(5, ids.length) mstore(add(m, 0xc0), ids.length) calldatacopy(add(m, 0xe0), ids.offset, n) // Copy the `amounts`. mstore(add(m, 0x80), add(0xc0, n)) let o := add(add(m, n), 0xe0) mstore(o, ids.length) calldatacopy(add(o, 0x20), amounts.offset, n) // Copy the `data`. mstore(add(m, 0xa0), add(add(0xe0, n), n)) o := add(add(o, n), 0x20) mstore(o, data.length) calldatacopy(add(o, 0x20), data.offset, data.length) let nAll := add(0x104, add(data.length, add(n, n))) // Revert if the call reverts. if iszero(call(gas(), mload(0x00), 0, add(mload(0x40), 0x1c), nAll, 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 with the function selector. if iszero(eq(mload(m), shl(224, 0xbc197c81))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } } /// @dev Returns the amounts of `ids` for `owners. /// /// Requirements: /// - `owners` and `ids` must have the same length. function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) public view virtual returns (uint256[] memory balances) { /// @solidity memory-safe-assembly assembly { if iszero(eq(ids.length, owners.length)) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } balances := mload(0x40) mstore(balances, ids.length) let o := add(balances, 0x20) let i := shl(5, ids.length) mstore(0x40, add(i, o)) // Loop through all the `ids` and load the balances. for {} i {} { i := sub(i, 0x20) let owner := calldataload(add(owners.offset, i)) mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))) mstore(0x00, calldataload(add(ids.offset, i))) mstore(add(o, i), sload(keccak256(0x00, 0x40))) } } } /// @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, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL MINT FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Mints `amount` of `id` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. /// /// Emits a {TransferSingle} event. function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Increase and store the updated balance of `to`. { mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, to) mstore(0x00, id) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } // Emit a {TransferSingle} event. mstore(0x20, amount) log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(address(0), to, _single(id), _single(amount), data); } if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data); } /// @dev Mints `amounts` of `ids` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `ids` and `amounts` must have the same length. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. /// /// Emits a {TransferBatch} event. function _batchMint( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(address(0), to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { function copy(dst_, src_, n_) { for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { mstore(add(dst_, i_), mload(add(src_, i_))) } } if iszero(eq(mload(ids), mload(amounts))) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Loop through all the `ids` and update the balances. { mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { let amount := mload(add(amounts, i)) // Increase and store the updated balance of `to`. { mstore(0x00, mload(add(ids, i))) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0x40) copy(o, ids, n) // Copy the `amounts`. mstore(add(m, 0x20), add(0x40, n)) o := add(o, n) n := add(0x20, shl(5, mload(amounts))) copy(o, amounts, n) n := sub(add(o, n), m) // Do the emit. log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) } } if (_useAfterTokenTransfer()) { _afterTokenTransfer(address(0), to, ids, amounts, data); } if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL BURN FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_burn(address(0), from, id, amount)`. function _burn(address from, uint256 id, uint256 amount) internal virtual { _burn(address(0), from, id, amount); } /// @dev Destroys `amount` of `id` from `from`. /// /// Requirements: /// - `from` must have at least `amount` of `id`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// /// Emits a {TransferSingle} event. function _burn(address by, address from, uint256 id, uint256 amount) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, address(0), _single(id), _single(amount), ""); } /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Decrease and store the updated balance of `from`. { mstore(0x00, id) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Emit a {TransferSingle} event. mstore(0x20, amount) log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, address(0), _single(id), _single(amount), ""); } } /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`. function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual { _batchBurn(address(0), from, ids, amounts); } /// @dev Destroys `amounts` of `ids` from `from`. /// /// Requirements: /// - `ids` and `amounts` must have the same length. /// - `from` must have at least `amounts` of `ids`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// /// Emits a {TransferBatch} event. function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, address(0), ids, amounts, ""); } /// @solidity memory-safe-assembly assembly { function copy(dst_, src_, n_) { for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { mstore(add(dst_, i_), mload(add(src_, i_))) } } if iszero(eq(mload(ids), mload(amounts))) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let from_ := shl(96, from) mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. let by_ := shl(96, by) if iszero(or(iszero(by_), eq(by_, from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Loop through all the `ids` and update the balances. { for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { let amount := mload(add(amounts, i)) // Decrease and store the updated balance of `from`. { mstore(0x00, mload(add(ids, i))) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0x40) copy(o, ids, n) // Copy the `amounts`. mstore(add(m, 0x20), add(0x40, n)) o := add(o, n) n := add(0x20, shl(5, mload(amounts))) copy(o, amounts, n) n := sub(add(o, n), m) // Do the emit. log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0) } } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, address(0), ids, amounts, ""); } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL APPROVAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Approve or remove the `operator` as an operator for `by`, /// without authorization checks. /// /// Emits a {ApprovalForAll} event. function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { /// @solidity memory-safe-assembly assembly { // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`by`, `operator`). mstore(0x20, _ERC1155_MASTER_SLOT_SEED) mstore(0x14, by) mstore(0x00, operator) sstore(keccak256(0x0c, 0x34), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) let m := shr(96, not(0)) log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL TRANSFER FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`. function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data) internal virtual { _safeTransfer(address(0), from, to, id, amount, data); } /// @dev Transfers `amount` of `id` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `from` must have at least `amount` of `id`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. /// /// Emits a {TransferSingle} event. function _safeTransfer( address by, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, _single(id), _single(amount), data); } /// @solidity memory-safe-assembly assembly { let from_ := shl(96, from) let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. let by_ := shl(96, by) if iszero(or(iszero(by_), eq(by_, from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Subtract and store the updated balance of `from`. { mstore(0x00, id) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } // Emit a {TransferSingle} event. mstore(0x20, amount) // forgefmt: disable-next-line log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, _single(id), _single(amount), data); } if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data); } /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`. function _safeBatchTransfer( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { _safeBatchTransfer(address(0), from, to, ids, amounts, data); } /// @dev Transfers `amounts` of `ids` from `from` to `to`. /// /// Requirements: /// - `to` cannot be the zero address. /// - `ids` and `amounts` must have the same length. /// - `from` must have at least `amounts` of `ids`. /// - If `by` is not the zero address, it must be either `from`, /// or approved to manage the tokens of `from`. /// - If `to` refers to a smart contract, it must implement /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. /// /// Emits a {TransferBatch} event. function _safeBatchTransfer( address by, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, to, ids, amounts, data); } /// @solidity memory-safe-assembly assembly { function copy(dst_, src_, n_) { for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { mstore(add(dst_, i_), mload(add(src_, i_))) } } if iszero(eq(mload(ids), mload(amounts))) { mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. revert(0x1c, 0x04) } let from_ := shl(96, from) let to_ := shl(96, to) // Revert if `to` is the zero address. if iszero(to_) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_) let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_) mstore(0x20, fromSlotSeed) // If `by` is not the zero address, and not equal to `from`, // check if it is approved to manage all the tokens of `from`. let by_ := shl(96, by) if iszero(or(iszero(by_), eq(by_, from_))) { mstore(0x00, by) if iszero(sload(keccak256(0x0c, 0x34))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Loop through all the `ids` and update the balances. { for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { let amount := mload(add(amounts, i)) // Subtract and store the updated balance of `from`. { mstore(0x20, fromSlotSeed) mstore(0x00, mload(add(ids, i))) let fromBalanceSlot := keccak256(0x00, 0x40) let fromBalance := sload(fromBalanceSlot) if gt(amount, fromBalance) { mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. revert(0x1c, 0x04) } sstore(fromBalanceSlot, sub(fromBalance, amount)) } // Increase and store the updated balance of `to`. { mstore(0x20, toSlotSeed) let toBalanceSlot := keccak256(0x00, 0x40) let toBalanceBefore := sload(toBalanceSlot) let toBalanceAfter := add(toBalanceBefore, amount) if lt(toBalanceAfter, toBalanceBefore) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceAfter) } } } // Emit a {TransferBatch} event. { let m := mload(0x40) // Copy the `ids`. mstore(m, 0x40) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0x40) copy(o, ids, n) // Copy the `amounts`. mstore(add(m, 0x20), add(0x40, n)) o := add(o, n) n := add(0x20, shl(5, mload(amounts))) copy(o, amounts, n) n := sub(add(o, n), m) // Do the emit. log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) } } if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, ids, amounts, data); } if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HOOKS FOR OVERRIDING */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override this function to return true if `_beforeTokenTransfer` is used. /// This is to help the compiler avoid producing dead bytecode. function _useBeforeTokenTransfer() internal view virtual returns (bool) { return false; } /// @dev Hook that is called before any token transfer. /// This includes minting and burning, as well as batched variants. /// /// The same hook is called on both single and batched variants. /// For single transfers, the length of the `id` and `amount` arrays are 1. function _beforeTokenTransfer( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /// @dev Override this function to return true if `_afterTokenTransfer` is used. /// This is to help the compiler avoid producing dead bytecode. function _useAfterTokenTransfer() internal view virtual returns (bool) { return false; } /// @dev Hook that is called after any token transfer. /// This includes minting and burning, as well as batched variants. /// /// The same hook is called on both single and batched variants. /// For single transfers, the length of the `id` and `amount` arrays are 1. function _afterTokenTransfer( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PRIVATE HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Helper for calling the `_afterTokenTransfer` hook. /// This is to help the compiler avoid producing dead bytecode. function _afterTokenTransferCalldata( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) private { if (_useAfterTokenTransfer()) { _afterTokenTransfer(from, to, ids, amounts, data); } } /// @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 {IERC1155Receiver-onERC1155Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC1155Received( address from, address to, uint256 id, uint256 amount, bytes memory data ) private { /// @solidity memory-safe-assembly assembly { function copy(dst_, src_, n_) { for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { mstore(add(dst_, i_), mload(add(src_, i_))) } } // Prepare the calldata. let m := mload(0x40) // `onERC1155Received(address,address,uint256,uint256,bytes)`. mstore(m, 0xf23a6e61) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), amount) mstore(add(m, 0xa0), 0xa0) let n := mload(data) mstore(add(m, 0xc0), n) copy(add(m, 0xe0), add(data, 0x20), n) // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), 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 with the function selector. if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC1155BatchReceived( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { /// @solidity memory-safe-assembly assembly { function copy(dst_, src_, n_) { for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { mstore(add(dst_, i_), mload(add(src_, i_))) } } // Prepare the calldata. let m := mload(0x40) // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. mstore(m, 0xbc197c81) mstore(add(m, 0x20), caller()) mstore(add(m, 0x40), shr(96, shl(96, from))) // Copy the `ids`. mstore(add(m, 0x60), 0xa0) let n := add(0x20, shl(5, mload(ids))) let o := add(m, 0xc0) copy(o, ids, n) // Copy the `amounts`. let s := add(0xa0, n) mstore(add(m, 0x80), s) o := add(o, n) n := add(0x20, shl(5, mload(amounts))) copy(o, amounts, n) // Copy the `data`. mstore(add(m, 0xa0), add(s, n)) o := add(o, n) n := add(0x20, mload(data)) copy(o, data, n) n := sub(add(o, n), add(m, 0x1c)) // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), n, 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 with the function selector. if iszero(eq(mload(m), shl(224, 0xbc197c81))) { mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. revert(0x1c, 0x04) } } } /// @dev Returns `x` in an array with a single element. function _single(uint256 x) private pure returns (uint256[] memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) mstore(0x40, add(result, 0x40)) mstore(result, 1) mstore(add(result, 0x20), x) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for byte related operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBytes.sol) library LibBytes { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STRUCTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Goated bytes storage struct that totally MOGs, no cap, fr. /// Uses less gas and bytecode than Solidity's native bytes storage. It's meta af. /// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. struct BytesStorage { bytes32 _spacer; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the bytes. uint256 internal constant NOT_FOUND = type(uint256).max; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTE STORAGE OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sets the value of the bytes storage `$` to `s`. function set(BytesStorage storage $, bytes memory s) internal { /// @solidity memory-safe-assembly assembly { let n := mload(s) let packed := or(0xff, shl(8, n)) for { let i := 0 } 1 {} { if iszero(gt(n, 0xfe)) { i := 0x1f packed := or(n, shl(8, mload(add(s, i)))) if iszero(gt(n, i)) { break } } let o := add(s, 0x20) mstore(0x00, $.slot) for { let p := keccak256(0x00, 0x20) } 1 {} { sstore(add(p, shr(5, i)), mload(add(o, i))) i := add(i, 0x20) if iszero(lt(i, n)) { break } } break } sstore($.slot, packed) } } /// @dev Sets the value of the bytes storage `$` to `s`. function setCalldata(BytesStorage storage $, bytes calldata s) internal { /// @solidity memory-safe-assembly assembly { let packed := or(0xff, shl(8, s.length)) for { let i := 0 } 1 {} { if iszero(gt(s.length, 0xfe)) { i := 0x1f packed := or(s.length, shl(8, shr(8, calldataload(s.offset)))) if iszero(gt(s.length, i)) { break } } mstore(0x00, $.slot) for { let p := keccak256(0x00, 0x20) } 1 {} { sstore(add(p, shr(5, i)), calldataload(add(s.offset, i))) i := add(i, 0x20) if iszero(lt(i, s.length)) { break } } break } sstore($.slot, packed) } } /// @dev Sets the value of the bytes storage `$` to the empty bytes. function clear(BytesStorage storage $) internal { delete $._spacer; } /// @dev Returns whether the value stored is `$` is the empty bytes "". function isEmpty(BytesStorage storage $) internal view returns (bool) { return uint256($._spacer) & 0xff == uint256(0); } /// @dev Returns the length of the value stored in `$`. function length(BytesStorage storage $) internal view returns (uint256 result) { result = uint256($._spacer); /// @solidity memory-safe-assembly assembly { let n := and(0xff, result) result := or(mul(shr(8, result), eq(0xff, n)), mul(n, iszero(eq(0xff, n)))) } } /// @dev Returns the value stored in `$`. function get(BytesStorage storage $) internal view returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let o := add(result, 0x20) let packed := sload($.slot) let n := shr(8, packed) for { let i := 0 } 1 {} { if iszero(eq(or(packed, 0xff), packed)) { mstore(o, packed) n := and(0xff, packed) i := 0x1f if iszero(gt(n, i)) { break } } mstore(0x00, $.slot) for { let p := keccak256(0x00, 0x20) } 1 {} { mstore(add(o, i), sload(add(p, shr(5, i)))) i := add(i, 0x20) if iszero(lt(i, n)) { break } } break } mstore(result, n) // Store the length of the memory. mstore(add(o, n), 0) // Zeroize the slot after the bytes. mstore(0x40, add(add(o, n), 0x20)) // Allocate memory. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTES OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns `subject` all occurrences of `needle` replaced with `replacement`. function replace(bytes memory subject, bytes memory needle, bytes memory replacement) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let needleLen := mload(needle) let replacementLen := mload(replacement) let d := sub(result, subject) // Memory difference. let i := add(subject, 0x20) // Subject bytes pointer. mstore(0x00, add(i, mload(subject))) // End of subject. if iszero(gt(needleLen, mload(subject))) { let subjectSearchEnd := add(sub(mload(0x00), needleLen), 1) let h := 0 // The hash of `needle`. if iszero(lt(needleLen, 0x20)) { h := keccak256(add(needle, 0x20), needleLen) } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(needleLen, 0x1f))) } 1 {} { let t := mload(i) // Whether the first `needleLen % 32` bytes of `subject` and `needle` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(i, needleLen), h)) { mstore(add(i, d), t) i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } continue } } // Copy the `replacement` one word at a time. for { let j := 0 } 1 {} { mstore(add(add(i, d), j), mload(add(add(replacement, 0x20), j))) j := add(j, 0x20) if iszero(lt(j, replacementLen)) { break } } d := sub(add(d, replacementLen), needleLen) if needleLen { i := add(i, needleLen) if iszero(lt(i, subjectSearchEnd)) { break } continue } } mstore(add(i, d), t) i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } } } let end := mload(0x00) let n := add(sub(d, add(result, 0x20)), end) // Copy the rest of the bytes one word at a time. for {} lt(i, end) { i := add(i, 0x20) } { mstore(add(i, d), mload(i)) } let o := add(i, d) mstore(o, 0) // Zeroize the slot after the bytes. mstore(0x40, add(o, 0x20)) // Allocate memory. mstore(result, n) // Store the length. } } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from left to right, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(bytes memory subject, bytes memory needle, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := not(0) // Initialize to `NOT_FOUND`. for { let subjectLen := mload(subject) } 1 {} { if iszero(mload(needle)) { result := from if iszero(gt(from, subjectLen)) { break } result := subjectLen break } let needleLen := mload(needle) let subjectStart := add(subject, 0x20) subject := add(subjectStart, from) let end := add(sub(add(subjectStart, subjectLen), needleLen), 1) let m := shl(3, sub(0x20, and(needleLen, 0x1f))) let s := mload(add(needle, 0x20)) if iszero(and(lt(subject, end), lt(from, subjectLen))) { break } if iszero(lt(needleLen, 0x20)) { for { let h := keccak256(add(needle, 0x20), needleLen) } 1 {} { if iszero(shr(m, xor(mload(subject), s))) { if eq(keccak256(subject, needleLen), 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 `needle` in `subject`, /// needleing from left to right. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(bytes memory subject, bytes memory needle) internal pure returns (uint256) { return indexOf(subject, needle, 0); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from right to left, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(bytes memory subject, bytes memory needle, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for {} 1 {} { result := not(0) // Initialize to `NOT_FOUND`. let needleLen := mload(needle) if gt(needleLen, mload(subject)) { break } let w := result let fromMax := sub(mload(subject), needleLen) 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(needle, 0x20), needleLen) } 1 {} { if eq(keccak256(subject, needleLen), 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 `needle` in `subject`, /// needleing from right to left. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(bytes memory subject, bytes memory needle) internal pure returns (uint256) { return lastIndexOf(subject, needle, type(uint256).max); } /// @dev Returns true if `needle` is found in `subject`, false otherwise. function contains(bytes memory subject, bytes memory needle) internal pure returns (bool) { return indexOf(subject, needle) != NOT_FOUND; } /// @dev Returns whether `subject` starts with `needle`. function startsWith(bytes memory subject, bytes memory needle) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let n := mload(needle) // Just using keccak256 directly is actually cheaper. let t := eq(keccak256(add(subject, 0x20), n), keccak256(add(needle, 0x20), n)) result := lt(gt(n, mload(subject)), t) } } /// @dev Returns whether `subject` ends with `needle`. function endsWith(bytes memory subject, bytes memory needle) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let n := mload(needle) let notInRange := gt(n, mload(subject)) // `subject + 0x20 + max(subject.length - needle.length, 0)`. let t := add(add(subject, 0x20), mul(iszero(notInRange), sub(mload(subject), n))) // Just using keccak256 directly is actually cheaper. result := gt(eq(keccak256(t, n), keccak256(add(needle, 0x20), n)), notInRange) } } /// @dev Returns `subject` repeated `times`. function repeat(bytes memory subject, uint256 times) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { let l := mload(subject) // Subject length. if iszero(or(iszero(times), iszero(l))) { result := mload(0x40) subject := add(subject, 0x20) let o := add(result, 0x20) for {} 1 {} { // Copy the `subject` one word at a time. for { let j := 0 } 1 {} { mstore(add(o, j), mload(add(subject, j))) j := add(j, 0x20) if iszero(lt(j, l)) { break } } o := add(o, l) times := sub(times, 1) if iszero(times) { break } } mstore(o, 0) // Zeroize the slot after the bytes. mstore(0x40, add(o, 0x20)) // Allocate memory. mstore(result, sub(o, add(result, 0x20))) // Store the length. } } } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. function slice(bytes memory subject, uint256 start, uint256 end) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { let l := mload(subject) // Subject length. if iszero(gt(l, end)) { end := l } if iszero(gt(l, start)) { start := l } if lt(start, end) { result := mload(0x40) let n := sub(end, start) let i := add(subject, start) let w := not(0x1f) // Copy the `subject` one word at a time, backwards. for { let j := and(add(n, 0x1f), w) } 1 {} { mstore(add(result, j), mload(add(i, j))) j := add(j, w) // `sub(j, 0x20)`. if iszero(j) { break } } let o := add(add(result, 0x20), n) mstore(o, 0) // Zeroize the slot after the bytes. mstore(0x40, add(o, 0x20)) // Allocate memory. mstore(result, n) // Store the length. } } } /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. /// `start` is a byte offset. function slice(bytes memory subject, uint256 start) internal pure returns (bytes memory result) { result = slice(subject, start, type(uint256).max); } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. Faster than Solidity's native slicing. function sliceCalldata(bytes calldata subject, uint256 start, uint256 end) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { end := xor(end, mul(xor(end, subject.length), lt(subject.length, end))) start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) result.offset := add(subject.offset, start) result.length := mul(lt(start, end), sub(end, start)) } } /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. /// `start` is a byte offset. Faster than Solidity's native slicing. function sliceCalldata(bytes calldata subject, uint256 start) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) result.offset := add(subject.offset, start) result.length := mul(lt(start, subject.length), sub(subject.length, start)) } } /// @dev Reduces the size of `subject` to `n`. /// If `n` is greater than the size of `subject`, this will be a no-op. function truncate(bytes memory subject, uint256 n) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := subject mstore(mul(lt(n, mload(result)), result), n) } } /// @dev Returns a copy of `subject`, with the length reduced to `n`. /// If `n` is greater than the size of `subject`, this will be a no-op. function truncatedCalldata(bytes calldata subject, uint256 n) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { result.offset := subject.offset result.length := xor(n, mul(xor(n, subject.length), lt(subject.length, n))) } } /// @dev Returns all the indices of `needle` in `subject`. /// The indices are byte offsets. function indicesOf(bytes memory subject, bytes memory needle) internal pure returns (uint256[] memory result) { /// @solidity memory-safe-assembly assembly { let searchLen := mload(needle) if iszero(gt(searchLen, mload(subject))) { result := mload(0x40) let i := add(subject, 0x20) let o := add(result, 0x20) let subjectSearchEnd := add(sub(add(i, mload(subject)), searchLen), 1) let h := 0 // The hash of `needle`. if iszero(lt(searchLen, 0x20)) { h := keccak256(add(needle, 0x20), searchLen) } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(searchLen, 0x1f))) } 1 {} { let t := mload(i) // Whether the first `searchLen % 32` bytes of `subject` and `needle` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(i, searchLen), h)) { i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } continue } } mstore(o, sub(i, add(subject, 0x20))) // Append to `result`. o := add(o, 0x20) i := add(i, searchLen) // Advance `i` by `searchLen`. if searchLen { if iszero(lt(i, subjectSearchEnd)) { break } continue } } i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } } mstore(result, shr(5, sub(o, add(result, 0x20)))) // Store the length of `result`. // Allocate memory for result. // We allocate one more word, so this array can be recycled for {split}. mstore(0x40, add(o, 0x20)) } } } /// @dev Returns a arrays of bytess based on the `delimiter` inside of the `subject` bytes. function split(bytes memory subject, bytes memory delimiter) internal pure returns (bytes[] 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)) for { let prevIndex := 0 } 1 {} { let index := mload(indexPtr) mstore(indexPtr, 0x60) if iszero(eq(index, prevIndex)) { let element := mload(0x40) let l := sub(index, prevIndex) mstore(element, l) // Store the length of the element. // Copy the `subject` one word at a time, backwards. for { let o := and(add(l, 0x1f), w) } 1 {} { mstore(add(element, o), mload(add(add(subject, prevIndex), o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } mstore(add(add(element, 0x20), l), 0) // Zeroize the slot after the bytes. // Allocate memory for the length and the bytes, rounded up to a multiple of 32. mstore(0x40, add(element, and(add(l, 0x3f), w))) mstore(indexPtr, element) // Store the `element` into the array. } 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 bytes of `a` and `b`. /// Cheaper than `bytes.concat()` and does not de-align the free memory pointer. function concat(bytes memory a, bytes memory b) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let w := not(0x1f) let aLen := mload(a) // Copy `a` one word at a time, backwards. for { let o := and(add(aLen, 0x20), w) } 1 {} { mstore(add(result, o), mload(add(a, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let bLen := mload(b) let output := add(result, aLen) // Copy `b` one word at a time, backwards. for { let o := and(add(bLen, 0x20), w) } 1 {} { mstore(add(output, o), mload(add(b, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let totalLen := add(aLen, bLen) let last := add(add(result, 0x20), totalLen) mstore(last, 0) // Zeroize the slot after the bytes. mstore(result, totalLen) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate memory. } } /// @dev Returns whether `a` equals `b`. function eq(bytes memory a, bytes 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 bytes. function eqs(bytes 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 Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. function cmp(bytes memory a, bytes memory b) internal pure returns (int256 result) { /// @solidity memory-safe-assembly assembly { let aLen := mload(a) let bLen := mload(b) let n := and(xor(aLen, mul(xor(aLen, bLen), lt(bLen, aLen))), not(0x1f)) if n { for { let i := 0x20 } 1 {} { let x := mload(add(a, i)) let y := mload(add(b, i)) if iszero(or(xor(x, y), eq(i, n))) { i := add(i, 0x20) continue } result := sub(gt(x, y), lt(x, y)) break } } // forgefmt: disable-next-item if iszero(result) { let l := 0x201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201 let x := and(mload(add(add(a, 0x20), n)), shl(shl(3, byte(sub(aLen, n), l)), not(0))) let y := and(mload(add(add(b, 0x20), n)), shl(shl(3, byte(sub(bLen, n), l)), not(0))) result := sub(gt(x, y), lt(x, y)) if iszero(result) { result := sub(gt(aLen, bLen), lt(aLen, bLen)) } } } } /// @dev Directly returns `a` without copying. function directReturn(bytes memory a) internal pure { assembly { // Assumes that the bytes does not start from the scratch space. let retStart := sub(a, 0x20) let retUnpaddedSize := add(mload(a), 0x40) // Right pad with zeroes. Just in case the bytes is produced // by a method that doesn't zero right pad. mstore(add(retStart, retUnpaddedSize), 0) mstore(retStart, 0x20) // Store the return offset. // End the transaction, returning the bytes. return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) } } /// @dev Directly returns `a` with minimal copying. function directReturn(bytes[] memory a) internal pure { assembly { let n := mload(a) // `a.length`. let o := add(a, 0x20) // Start of elements in `a`. let u := a // Highest memory slot. let w := not(0x1f) for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } { let c := add(o, shl(5, i)) // Location of pointer to `a[i]`. let s := mload(c) // `a[i]`. let l := mload(s) // `a[i].length`. let r := and(l, 0x1f) // `a[i].length % 32`. let z := add(0x20, and(l, w)) // Offset of last word in `a[i]` from `s`. // If `s` comes before `o`, or `s` is not zero right padded. if iszero(lt(lt(s, o), or(iszero(r), iszero(shl(shl(3, r), mload(add(s, z))))))) { let m := mload(0x40) mstore(m, l) // Copy `a[i].length`. for {} 1 {} { mstore(add(m, z), mload(add(s, z))) // Copy `a[i]`, backwards. z := add(z, w) // `sub(z, 0x20)`. if iszero(z) { break } } let e := add(add(m, 0x20), l) mstore(e, 0) // Zeroize the slot after the copied bytes. mstore(0x40, add(e, 0x20)) // Allocate memory. s := m } mstore(c, sub(s, o)) // Convert to calldata offset. let t := add(l, add(s, 0x20)) if iszero(lt(t, u)) { u := t } } let retStart := add(a, w) // Assumes `a` doesn't start from scratch space. mstore(retStart, 0x20) // Store the return offset. return(retStart, add(0x40, sub(u, retStart))) // End the transaction. } } /// @dev Returns the word at `offset`, without any bounds checks. /// To load an address, you can use `address(bytes20(load(a, offset)))`. function load(bytes memory a, uint256 offset) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := mload(add(add(a, 0x20), offset)) } } /// @dev Returns the word at `offset`, without any bounds checks. /// To load an address, you can use `address(bytes20(loadCalldata(a, offset)))`. function loadCalldata(bytes calldata a, uint256 offset) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := calldataload(add(a.offset, offset)) } } /// @dev Returns empty calldata bytes. For silencing the compiler. function emptyCalldata() internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { result.length := 0 } } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "mode": "3", "runs": 200 }, "outputSelection": { "*": { "*": [ "abi" ] } }, "detectMissingLibraries": false, "forceEVMLA": false, "enableEraVMExtensions": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountBalanceOverflow","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ArrayLengthsMismatch","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidLengths","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotOwnerNorApproved","type":"error"},{"inputs":[],"name":"NotRWAManager","type":"error"},{"inputs":[],"name":"Soulbound","type":"error"},{"inputs":[],"name":"TransferToNonERC1155ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"isApproved","type":"bool"}],"name":"ApprovalForAll","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":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"owners","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"balances","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","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":"address","name":"","type":"address"}],"name":"rwaManagers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"isApproved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setRwaManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_description","type":"string"},{"internalType":"string","name":"_ipfsHash","type":"string"},{"internalType":"bool","name":"_soulbound","type":"bool"}],"name":"setTokenMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
9c4d535b00000000000000000000000000000000000000000000000000000000000000000100046d14a55f00f9187a72543583e0ec1fe0508e8a042adba91299decd27c700000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x0002000000000002000d00000000000200010000000103550000006003100270000003f30030019d000000800c0000390000004000c0043f0000000100200190000000380000c13d000003f302300197000000040020008c00000f250000413d000000000301043b000000e003300270000003fe0030009c000000710000213d0000040e0030009c000000910000213d000004160030009c000000f90000213d0000041a0030009c0000062e0000613d0000041b0030009c0000018d0000613d0000041c0030009c00000f250000c13d0000000001000416000000000001004b00000f250000c13d0000000103000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000006b0000c13d000000800010043f000000000004004b000009140000613d000000000030043f000000000001004b0000008f0000613d000003f7030000410000000004000019000000000503041a000000a002400039000000000052043500000001033000390000002004400039000000000014004b000000300000413d000009190000013d0000000001000416000000000001004b00000f250000c13d0000000006000411000003f401000041000000000061041b0000000001000414000003f30010009c000003f301008041000000c001100210000003f5011001c70000800d020000390000000303000039000003f60400004100000000050000190fc90fbf0000040f000000010020019000000f250000613d0000000101000039000000000201041a000000010320019000000001022002700000007f0220618f0000001f0020008c00000000040000390000000104002039000000000043004b0000006b0000c13d000000200020008c0000005e0000413d000003f7030000410000001f022000390000000502200270000003f80220009a000000000003041b0000000103300039000000000023004b0000005a0000413d000003f902000041000000000021041b0000000201000039000000000301041a000000010030019000000001023002700000007f0220618f0000001f0020008c00000000040000390000000104002039000000000343013f00000001003001900000012b0000613d0000046401000041000000000010043f0000002201000039000000040010043f000004650100004100000fcb00010430000003ff0030009c000000b10000213d000004070030009c000001460000213d0000040b0030009c000006440000613d0000040c0030009c000001a10000613d0000040d0030009c00000f250000c13d0000000001000416000000000001004b00000f250000c13d0000000203000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000006b0000c13d000000800010043f000000000004004b000009140000613d000000000030043f000000000001004b000009590000c13d0000008002000039000009190000013d0000040f0030009c0000015d0000213d000004130030009c000007410000613d000004140030009c000001aa0000613d000004150030009c00000f250000c13d0000041e010000410000000c0010043f0000000001000411000000000010043f0000000001000414000003f30010009c000003f301008041000000c0011002100000042f011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000001041b0000000001000414000003f30010009c000003f301008041000000c001100210000003f5011001c70000800d0200003900000002030000390000043c04000041000001250000013d000004000030009c000001780000213d000004040030009c0000087a0000613d000004050030009c0000020d0000613d000004060030009c00000f250000c13d000000a40020008c00000f250000413d0000000003000416000000000003004b00000f250000c13d0000000403100370000000000303043b000d00000003001d0000041d0030009c00000f250000213d0000002403100370000000000303043b000c00000003001d0000041d0030009c00000f250000213d0000006403100370000000000303043b000a00000003001d0000004403100370000000000303043b000b00000003001d0000008403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d000800040030003d0000000801100360000000000101043b000900000001001d000004250010009c00000f250000213d00000009013000290000002401100039000000000021004b00000f250000213d0000000b01000029000000000010043f0000000301000039000000200010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b0000000c0000006b00000a210000613d0000000d0000006b00000a210000613d0000000301100039000000000101041a000000ff0010019000000a210000613d0000043d01000041000000000010043f0000043e0100004100000fcb00010430000004170030009c000008950000613d000004180030009c0000023c0000613d000004190030009c00000f250000c13d0000041e010000410000000c0010043f0000000001000411000000000010043f000004300100004100000000001004430000000001000414000003f30010009c000003f301008041000000c00110021000000431011001c70000800b020000390fc90fc40000040f000000010020019000000af10000613d000000000101043b000d00000001001d0000000001000414000003f30010009c000003f301008041000000c0011002100000042f011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b0000000d02000029000004440220009a000000000021041b0000000001000414000003f30010009c000003f301008041000000c001100210000003f5011001c70000800d020000390000000203000039000004450400004100000000050004110fc90fbf0000040f000000010020019000000f250000613d000000000100001900000fca0001042e0000001f0020008c000001350000a13d000003fa030000410000001f022000390000000502200270000003fb0220009a000000000003041b0000000103300039000000000023004b000001310000413d000003fc02000041000000000021041b0000000001000411000000000010043f000000200000043f000000400200003900000000010000190fc90faa0000040f000000000301041a000004680230019700000001022001bf000000000021041b000000200100003900000100001004430000012000000443000003fd0100004100000fca0001042e000004080030009c000008b30000613d000004090030009c000003e70000613d0000040a0030009c00000f250000c13d000000240020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000401100370000000000101043b0000041d0010009c00000f250000213d000000000010043f000000200000043f000000400200003900000000010000190fc90faa0000040f000000000101041a000000ff00100190000008900000013d000004100030009c000008e30000613d000004110030009c0000051c0000613d000004120030009c00000f250000c13d000003f401000041000000000101041a0000000005000411000000000015004b000009100000c13d0000000001000414000003f30010009c000003f301008041000000c001100210000003f5011001c70000800d020000390000000303000039000003f60400004100000000060000190fc90fbf0000040f000000010020019000000f250000613d000003f401000041000000000001041b000000000100001900000fca0001042e000004010030009c000008ff0000613d000004020030009c000006080000613d000004030030009c00000f250000c13d000000240020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000401100370000000000101043b0000041d0010009c00000f250000213d0000041e020000410000000c0020043f000000000010043f0000000c0100003900000020020000390000063f0000013d000000240020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000401100370000000000101043b000004660010019800000f250000c13d000000e001100270000004670010009c000000000200003900000001020060390000041b0010009c00000001022061bf000004170010009c00000001022061bf000000800020043f0000041f0100004100000fca0001042e0000000001000416000000000001004b00000f250000c13d000003f401000041000000000101041a0000041d01100197000000800010043f0000041f0100004100000fca0001042e000000440020008c00000f250000413d0000000003000416000000000003004b00000f250000c13d0000000403100370000000000403043b000004250040009c00000f250000213d0000002303400039000000000023004b00000f250000813d000c00040040003d0000000c03100360000000000303043b000004250030009c00000f250000213d000000050530021000000000045400190000002404400039000000000024004b00000f250000213d0000002404100370000000000504043b000004250050009c00000f250000213d0000002304500039000000000024004b00000f250000813d000b00040050003d0000000b01100360000000000401043b000004250040009c00000f250000213d000000050640021000000000016500190000002401100039000000000021004b00000f250000213d000000000034004b00000a1d0000c13d0000000002060019000000800040043f000000a001600039000000400010043f000000000004004b000001f60000613d0000000003020019000d00000003001d0000000c013000290000000101100367000000000101043b000000600110021000000421011001c7000000200010043f0000000b013000290000000101100367000000000101043b000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a0000000d0300002900000080023000390000000000120435000000200330008c000001da0000c13d000000400100043d00000020020000390000000002210436000000800300043d00000000003204350000004002100039000000000003004b000002040000613d000000a0040000390000000005000019000000004604043400000000026204360000000105500039000000000035004b000001ff0000413d0000000002120049000003f30020009c000003f3020080410000006002200210000003f30010009c000003f3010080410000004001100210000000000112019f00000fca0001042e000000240020008c00000f250000413d0000000401100370000000000101043b000d00000001001d0000041d0010009c00000f250000213d000003f401000041000000000101041a0000000002000411000000000012004b000009100000c13d0000041e010000410000000c0010043f0000000d01000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c0011002100000042f011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000b00000001001d000000000101041a000c00000001001d000004300100004100000000001004430000000001000414000003f30010009c000003f301008041000000c00110021000000431011001c70000800b020000390fc90fc40000040f000000010020019000000af10000613d000000000101043b0000000c0010006c000009d60000a13d0000043201000041000000000010043f000004240100004100000fcb00010430000000840020008c00000f250000413d0000000003000416000000000003004b00000f250000c13d0000000403100370000000000303043b000d00000003001d0000041d0030009c00000f250000213d0000002403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d0000000404300039000000000441034f000000000404043b000c00000004001d000004250040009c00000f250000213d00000024043000390000000c030000290000000503300210000800000004001d000b00000003001d000900000043001d000000090020006b00000f250000213d0000004403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d0000000404300039000000000441034f000000000404043b000a00000004001d000004250040009c00000f250000213d00000024033000390000000a040000290000000504400210000500000003001d000700000004001d000600000034001d000000060020006b00000f250000213d0000006403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d000300040030003d0000000301100360000000000101043b000400000001001d000004250010009c00000f250000213d0000000401300029000200240010003d000000020020006b00000f250000213d000003f401000041000000000101041a0000041d011001970000000002000411000000000012004b00000b650000c13d0000000d0000006b000008fb0000613d0000000a020000290000000c0020006b00000a450000c13d0000000b010000290000003f011000390000043601100197000000400300043d0000000002130019000a00000003001d000000000032004b00000000010000390000000101004039000004250020009c000008ad0000213d0000000100100190000008ad0000c13d0000000001000031000000400020043f0000000a020000290000000c030000290000000000320435000000090010006b00000f250000213d0000000c0000006b00000008050000290000000906000029000002ad0000613d00000001020003670000000a03000029000000000452034f000000000404043b000000200330003900000000004304350000002005500039000000000065004b000002a60000413d00000007020000290000003f022000390000043602200197000000400300043d0000000002230019000900000003001d000000000032004b00000000030000390000000103004039000004250020009c000008ad0000213d0000000100300190000008ad0000c13d000000400020043f00000009020000290000000c030000290000000000320435000000060010006b00000f250000213d0000000c0000006b00000005050000290000000606000029000002cd0000613d00000001020003670000000903000029000000000452034f000000000404043b000000200330003900000000004304350000002005500039000000000065004b000002c60000413d00000004020000290000001f0220003900000469022001970000003f022000390000046902200197000000400400043d0000000002240019000800000004001d000000000042004b00000000040000390000000104004039000004250020009c000008ad0000213d0000000100400190000008ad0000c13d000000400020043f000000080200002900000004040000290000000002420436000000020010006b00000f250000213d000000040100002900000469031001980000001f0410018f0000000001320019000000030500002900000020055000390000000105500367000002f00000613d000000000605034f0000000007020019000000006806043c0000000007870436000000000017004b000002ec0000c13d000000000004004b000002fd0000613d000000000335034f0000000304400210000000000501043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f000000000031043500000004012000290000000000010435000000090100002900000000010104330000000a020000290000000002020433000000000012004b00000a1d0000c13d0000000d01000029000000600110021200000a2b0000613d00000421011001c7000000200010043f0000000a0900002900000000010904330000000503100212000003290000613d0000000001930019000c00000003001d00000009023000290000000002020433000b00000002001d0000000001010433000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000b03000029000000000032001a00000f330000413d0000000002320019000000000021041b0000000c03000029000000200330008c0000000a090000290000030e0000c13d000000400100043d0000004002000039000000000321043600000000020904330000000502200210000000200420003a000003390000613d0000004005100039000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b000003320000413d00000060052000390000000000530435000000090900002900000000030904330000000503300210000000200430003a000003490000613d0000000005150019000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b000003420000413d000000000232001900000080022000390000006003200210000004370020009c0000043803008041000003f30010009c000003f3010080410000004001100210000000000113019f0000000002000414000003f30020009c000003f302008041000000c0022002100000000001210019000004390110009a0000800d0200003900000004030000390000043a04000041000000000500041100000000060000190000000d070000290fc90fbf0000040f000000010020019000000f250000613d000004280100004100000000001004430000000d0100002900000004001004430000000001000414000003f30010009c000003f301008041000000c00110021000000429011001c700008002020000390fc90fc40000040f000000010020019000000af10000613d000000000101043b000000000001004b000001290000613d000000400300043d0000006001300039000000a002000039000000000021043500000020013000390000000002000411000000000021043500000442010000410000000000130435000c00000003001d000000400130003900000000000104350000000a0700002900000000010704330000000501100210000000200210003a0000038c0000613d0000000c03000029000000c003300039000000000400001900000000054300190000000006740019000000000606043300000000006504350000002004400039000000000024004b000003850000413d000000c0021000390000000c04000029000000800340003900000000002304350000000002410019000000090900002900000000030904330000000503300210000000200430003a0000039f0000613d000000e005200039000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b000003980000413d0000000001310019000000e0011000390000000c04000029000000a0044000390000000000140435000000000123001900000008080000290000000002080433000000200320003a000003b20000613d0000010004100039000000000500001900000000065400190000000007850019000000000707043300000000007604350000002005500039000000000035004b000003ab0000413d0000000c03000029000000000131004900000000012100190000010401100039000003f30010009c000003f30100804100000060011002100000001c02300039000003f30020009c000003f3020080410000004002200210000000000121019f0000000002000414000003f30020009c000003f302008041000000c002200210000000000112019f0000000d020000290fc90fbf0000040f0000006003100270000003f303300197000000200030008c000000200400003900000000040340190000001f0540018f00000020064001900000000c04600029000003d40000613d000000000701034f0000000c08000029000000007907043c0000000008980436000000000048004b000003d00000c13d000000000005004b000003e10000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000ea50000613d0000000c01000029000008760000013d000000a40020008c00000f250000413d0000000003000416000000000003004b00000f250000c13d0000002403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d000c00040030003d0000000c04100360000000000404043b000d00000004001d000004250040009c00000f250000213d0000000d03300029000b00240030003d0000000b0020006b00000f250000213d0000004403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d0000000404300039000000000441034f000000000404043b000a00000004001d000004250040009c00000f250000213d0000002404300039000800000004001d0009000a0040002d000000090020006b00000f250000213d0000006403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d0000000404300039000000000441034f000000000404043b000700000004001d000004250040009c00000f250000213d0000002404300039000500000004001d000600070040002d000000060020006b00000f250000213d0000008401100370000000000301043b000000000003004b0000000001000039000000010100c039000400000003001d000000000013004b00000f250000c13d000003f401000041000000000101041a0000041d031001970000000001000411000000000031004b00000b760000c13d0000000d010000290000001f0110003900000469011001970000003f0110003900000469011001970000008003c00039000000400030043f0000000001130019000004250010009c000008ad0000213d000000400010043f0000000d0100002900000000001304350000000b0020006b00000f250000213d0000000c0100002900000020041000390000000101000367000000000641034f0000000d0800002900000469078001980000001f0880018f000000a004c0003900000000057400190000044e0000613d000000000906034f000000000a040019000000009b09043c000000000aba043600000000005a004b0000044a0000c13d000000000008004b0000045b0000613d000000000676034f0000000307800210000000000805043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f00000000006504350000000d04400029000000000004043500000000033c0436000d00000003001d0000000a030000290000001f0330003900000469033001970000003f033000390000046904300197000000400300043d0000000004430019000000000034004b00000000050000390000000105004039000004250040009c000008ad0000213d0000000100500190000008ad0000c13d000000400040043f0000000a040000290000000004430436000000090020006b00000f250000213d00000008061003600000000a0800002900000469078001980000001f0880018f00000000057400190000047e0000613d000000000906034f000000000a040019000000009b09043c000000000aba043600000000005a004b0000047a0000c13d000000000008004b0000048b0000613d000000000676034f0000000307800210000000000805043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f00000000006504350000000a0440002900000000000404350000000d04000029000000000034043500000007030000290000001f0330003900000469033001970000003f033000390000046904300197000000400300043d0000000004430019000000000034004b00000000050000390000000105004039000004250040009c000008ad0000213d0000000100500190000008ad0000c13d000000400040043f00000007040000290000000004430436000000060020006b00000f250000213d0000000505100360000000070700002900000469067001980000001f0770018f0000000002640019000004ae0000613d000000000805034f0000000009040019000000008a08043c0000000009a90436000000000029004b000004aa0000c13d000000000007004b000004bb0000613d000000000565034f0000000306700210000000000702043300000000076701cf000000000767022f000000000505043b0000010006600089000000000565022f00000000056501cf000000000575019f00000000005204350000000702400029000000000002043500030000000c001d0000006002c00039000b00000002001d000000040400002900000000004204350000004002c00039000c00000002001d00000000003204350000000401100370000000000101043b000000000010043f0000000301000039000000200010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f0000000303000029000000010020019000000f250000613d000000000101043b000a00000001001d0000000001030433000700000001001d0000000021010434000800000002001d000900000001001d000004250010009c000008ad0000213d0000000a01000029000000000101041a000000010010019000000001021002700000007f0220618f000600000002001d0000001f0020008c00000000020000390000000102002039000000000121013f00000001001001900000006b0000c13d0000000601000029000000200010008c000005080000413d0000000a01000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d00000009030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000006010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b000005080000813d000000000002041b0000000102200039000000000012004b000005040000413d00000009010000290000001f0010008c00000e250000a13d0000000a01000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000200200008a0000000902200180000000000101043b00000e320000c13d000000200300003900000e3f0000013d000000640020008c00000f250000413d0000000003000416000000000003004b00000f250000c13d0000000403100370000000000303043b000900000003001d0000041d0030009c00000f250000213d0000002403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d0000000404300039000000000441034f000000000404043b000d00000004001d000004250040009c00000f250000213d00000024043000390000000d030000290000000503300210000800000004001d000c00000003001d000a00000043001d0000000a0020006b00000f250000213d0000004403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d0000000404300039000000000141034f000000000101043b000b00000001001d000004250010009c00000f250000213d00000024013000390000000b030000290000000503300210000500000001001d000700000003001d000600000013001d000000060020006b00000f250000213d000003f401000041000000000101041a0000041d011001970000000002000411000000000012004b000005660000613d0000000001000411000000000010043f000000200000043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a000000ff001001900000062a0000613d0000000b020000290000000d0020006b00000a450000c13d0000000c010000290000003f011000390000043601100197000000400300043d0000000002130019000b00000003001d000000000032004b00000000010000390000000101004039000004250020009c000008ad0000213d0000000100100190000008ad0000c13d0000000001000031000000400020043f0000000b020000290000000d0300002900000000003204350000000a0010006b00000f250000213d0000000d0000006b00000008050000290000000a060000290000058a0000613d00000001020003670000000b03000029000000000452034f000000000404043b000000200330003900000000004304350000002005500039000000000065004b000005830000413d00000007020000290000003f022000390000043602200197000000400300043d0000000002230019000a00000003001d000000000032004b00000000030000390000000103004039000004250020009c000008ad0000213d0000000100300190000008ad0000c13d000000400020043f0000000a020000290000000d030000290000000000320435000000060010006b00000f250000213d0000000d0000006b0000000001000019000005ac0000613d000000050400002900000001014003670000000a0200002900000006050000290000002002200039000000001301043c00000000003204350000002004400039000000000054004b000005a40000413d0000000a0100002900000000010104330000000b020000290000000002020433000000000012004b00000a1d0000c13d0000000901000029000000600110021000000421011001c7000000200010043f0000000b0900002900000000010904330000000503100212000005d10000613d0000000001930019000c00000003001d0000000a023000290000000002020433000d00000002001d0000000001010433000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000d0220006c000009790000413d000000000021041b0000000c03000029000000200330008c0000000b09000029000005b80000c13d000000400100043d0000004002000039000000000321043600000000020904330000000502200210000000200420003a000005e10000613d0000004005100039000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b000005da0000413d000000600520003900000000005304350000000a0900002900000000030904330000000503300210000000200430003a000005f10000613d0000000005150019000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b000005ea0000413d000000000232001900000080022000390000006003200210000004370020009c0000043803008041000003f30010009c000003f3010080410000004001100210000000000113019f0000000002000414000003f30020009c000003f302008041000000c0022002100000000001210019000004390110009a00000009020000290000041d062001970000800d0200003900000004030000390000043a0400004100000000050004110000000007000019000001260000013d000000640020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000402100370000000000202043b000d00000002001d0000041d0020009c00000f250000213d0000004402100370000000000202043b000c00000002001d000003f402000041000000000202041a0000041d022001970000000003000411000000000023004b000009640000613d000000000030043f000000200000043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a000000ff00100190000009630000c13d0000044601000041000000000010043f0000043e0100004100000fcb00010430000000440020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000402100370000000000202043b0000041d0020009c00000f250000213d0000042103000041000000200030043f000000140020043f0000002401100370000000000101043b000000000010043f000000400200003900000000010000190fc90faa0000040f000000000101041a000000800010043f0000041f0100004100000fca0001042e000000840020008c00000f250000413d0000000003000416000000000003004b00000f250000c13d0000000403100370000000000303043b000d00000003001d0000041d0030009c00000f250000213d0000004403100370000000000303043b000b00000003001d0000002403100370000000000303043b000c00000003001d0000006403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d000900040030003d0000000901100360000000000101043b000a00000001001d000004250010009c00000f250000213d0000000a01300029000800240010003d000000080020006b00000f250000213d000003f401000041000000000101041a0000041d011001970000000002000411000000000012004b0000067a0000613d000000000020043f000000200000043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a000000ff001001900000062a0000613d0000000d0000006b000008fb0000613d0000000a010000290000001f0210003900000469022001970000003f022000390000046902200197000000400400043d0000000002240019000000000042004b00000000030000390000000103004039000004250020009c000008ad0000213d0000000100300190000008ad0000c13d000000400020043f000600000004001d0000000a020000290000000002240436000700000002001d0000000802000029000000000020007c00000f250000213d0000000a0300002900000469023001980000001f0330018f0000000701200029000000090400002900000020044000390000000104400367000006a00000613d000000000504034f0000000706000029000000005705043c0000000006760436000000000016004b0000069c0000c13d000000000003004b000006ad0000613d000000000224034f0000000303300210000000000401043300000000043401cf000000000434022f000000000202043b0000010003300089000000000232022f00000000023201cf000000000242019f00000000002104350000000a02000029000000070120002900000000000104350000042101000041000000200010043f0000000d01000029000000140010043f0000000c01000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000b0020002a00000f330000413d0000000b030000290000000002320019000000000021041b000000200030043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c70000800d0200003900000004030000390000042204000041000000000500041100000000060000190000000d070000290fc90fbf0000040f000000010020019000000f250000613d000004280100004100000000001004430000000d0100002900000004001004430000000001000414000003f30010009c000003f301008041000000c00110021000000429011001c700008002020000390fc90fc40000040f000000010020019000000af10000613d000000000101043b000000000001004b000001290000613d000000400300043d000000a001300039000000a002000039000000000021043500000080013000390000000b02000029000000000021043500000060013000390000000c0200002900000000002104350000002001300039000000000200041100000000002104350000042a0100004100000000001304350000004001300039000000000001043500000006010000290000000001010433000a00000003001d000000c0023000390000000000120435000000000001004b0000000706000029000007080000613d0000000a02000029000000e002200039000000000300001900000000043200190000000005630019000000000505043300000000005404350000002003300039000000000013004b000007010000413d0000000a020000290000001c02200039000003f30020009c000003f3020080410000004002200210000000c401100039000003f30010009c000003f3010080410000006001100210000000000121019f0000000002000414000003f30020009c000003f302008041000000c002200210000000000112019f0000000d020000290fc90fbf0000040f0000006003100270000003f303300197000000200030008c000000200400003900000000040340190000001f0540018f00000020064001900000000a04600029000007280000613d000000000701034f0000000a08000029000000007907043c0000000008980436000000000048004b000007240000c13d000000000005004b000007350000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000d220000613d0000000a0100002900000000010104330000042e0010009c000001290000613d0000044a01000041000000000010043f000004240100004100000fcb00010430000000a40020008c00000f250000413d0000000003000416000000000003004b00000f250000c13d0000000403100370000000000303043b000700000003001d0000041d0030009c00000f250000213d0000002403100370000000000303043b000600000003001d0000041d0030009c00000f250000213d0000004403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d000a00040030003d0000000a04100360000000000404043b000c00000004001d000004250040009c00000f250000213d00000024043000390000000c030000290000000503300210000500000003001d000b00000004001d0000000003430019000000000023004b00000f250000213d0000006403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d000900040030003d0000000904100360000000000404043b000800000004001d000004250040009c00000f250000213d0000000804000029000000050440021000000000034300190000002403300039000000000023004b00000f250000213d0000008403100370000000000303043b000004250030009c00000f250000213d0000002304300039000000000024004b00000f250000813d0000000404300039000000000141034f000000000101043b000400000001001d000004250010009c00000f250000213d0000002403300039000300000003001d0000000401300029000000000021004b00000f250000213d0000000c0000006b00000c450000c13d00000008020000290000000c0020006b00000a1d0000c13d0000000701000029000000600110021000000421011001c7000800000001001d000000200010043f00000006010000290002041d0010019c00000a2b0000613d00000007010000290001041d0010019b0000000001000411000000010010006c00000daf0000c13d0000000c0000006b00000dbe0000c13d000000400100043d00000040021000390000000c030000290000000000320435000000400200003900000000032104360000000504000029000d001f004001930000000a02000029000b00200020003d0000000102000367000000000004004b000007b20000613d000000600410003900000005054000290000000b06200360000000006706043c0000000004740436000000000054004b000007ae0000c13d0000000d0000006b000000050500002900000060045000390000000000430435000000000351001900000060043000390000000c0600002900000000006404350000000904000029000a00200040003d000000000005004b000007c50000613d0000000a0220036000000080033000390000000504300029000000002502043c0000000003530436000000000043004b000007c10000c13d0000000d0000006b0000000c020000290000000602200210000900000002001d00000080022000390000006003200210000004390330009a000004370020009c0000044103008041000003f30010009c000003f3010080410000004001100210000000000131019f0000000002000414000003f30020009c000003f302008041000000c00220021000000000012100190000800d0200003900000004030000390000043a040000410000000005000411000000010600002900000002070000290fc90fbf0000040f000000010020019000000f250000613d00000428010000410000000000100443000000020100002900000004001004430000000001000414000003f30010009c000003f301008041000000c00110021000000429011001c700008002020000390fc90fc40000040f000000010020019000000af10000613d000000000101043b000000000001004b000001290000613d0000000201000029000000000010043f000000400300043d000000c0013000390000000c0200002900000000002104350000006001300039000000a00200003900000000002104350000004001300039000000010200002900000000002104350000002001300039000000000200041100000000002104350000044201000041000800000003001d00000000001304350000000101000367000000050000006b0000080d0000613d0000000802000029000000e00220003900000005032000290000000b04100360000000004504043c0000000002520436000000000032004b000008090000c13d0000000d0000006b0000000504000029000000c0024000390000000805000029000000800350003900000000002304350000000002450019000000e0032000390000000c050000290000000000530435000000000004004b000008200000613d0000000a0310036000000100042000390000000505400029000000003603043c0000000004640436000000000054004b0000081c0000c13d0000000d0000006b0000000903000029000000e0033000390000000804000029000000a00440003900000000003404350000000505200029000001000250003900000004040000290000000000420435000000030210036000000469034001980000001f0440018f00000120055000390000000001350019000008350000613d000000000602034f000000006706043c0000000005750436000000000015004b000008310000c13d000000000004004b000008420000613d000000000232034f0000000303400210000000000401043300000000043401cf000000000434022f000000000202043b0000010003300089000000000232022f00000000023201cf000000000242019f0000000000210435000000090200002900000004012000290000010401100039000003f30010009c000003f3010080410000006001100210000000400200043d0000001c02200039000003f30020009c000003f3020080410000004002200210000000000112019f000000000200043d0000000003000414000003f30030009c000003f303008041000000c003300210000000000131019f0fc90fbf0000040f0000006003100270000003f303300197000000200030008c000000200400003900000000040340190000001f0540018f00000020064001900000000804600029000008640000613d000000000701034f0000000808000029000000007907043c0000000008980436000000000048004b000008600000c13d000000000005004b000008710000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000e0b0000613d00000008010000290000000001010433000004430010009c000001290000613d0000073d0000013d000000440020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000402100370000000000202043b0000041d0020009c00000f250000213d0000002401100370000000000101043b0000041d0010009c00000f250000213d0000042103000041000000200030043f000000140020043f000000000010043f0000000c0100003900000034020000390fc90faa0000040f000000000101041a000000000001004b0000000001000039000000010100c039000000800010043f0000041f0100004100000fca0001042e000000240020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000401100370000000000101043b000d00000001001d000000000010043f0000000301000039000000200010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000701043b000000400600043d0000044d0060009c0000092a0000413d0000046401000041000000000010043f0000004101000039000000040010043f000004650100004100000fcb00010430000000440020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000402100370000000000202043b000d00000002001d0000041d0020009c00000f250000213d0000002401100370000000000201043b000000000002004b0000000001000039000000010100c039000c00000002001d000000000012004b00000f250000c13d0000042101000041000000200010043f0000000001000411000000140010043f0000000d01000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000427011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b0000000c02000029000000000021041b000000000020043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c70000800d020000390000000303000039000004350400004100000000050004110000000d06000029000001260000013d000000440020008c00000f250000413d0000000002000416000000000002004b00000f250000c13d0000000402100370000000000202043b0000041d0020009c00000f250000213d0000002401100370000000000301043b000000000003004b0000000001000039000000010100c039000d00000003001d000000000013004b00000f250000c13d000003f401000041000000000101041a0000000003000411000000000013004b000009100000c13d000000000002004b0000098b0000c13d0000044c01000041000000000010043f0000043e0100004100000fcb00010430000000240020008c00000f250000413d0000000401100370000000000101043b0000041d0010009c00000f250000213d000003f402000041000000000202041a0000000003000411000000000023004b000009100000c13d000000000001004b000009d90000c13d0000042301000041000000000010043f000004240100004100000fcb000104300000043b01000041000000000010043f000004240100004100000fcb000104300000046802200197000000a00020043f000000000001004b000000a0020000390000008002006039000000600220008a00000080010000390fc90f5f0000040f000000400100043d000d00000001001d00000080020000390fc90f7e0000040f0000000d020000290000000001210049000003f30010009c000003f3010080410000006001100210000003f30020009c000003f3020080410000004002200210000000000121019f00000fca0001042e0000008008600039000000400080043f000000000107041a000000010210019000000001041002700000007f0440618f0000001f0040008c00000000030000390000000103002039000000000331013f00000001003001900000006b0000c13d0000000000480435000000000002004b000009960000613d000900000004001d000a00000008001d000b00000006001d000c00000007001d000000000070043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d0000000909000029000000000009004b00000000020000190000000b060000290000000c070000290000000a080000290000099c0000613d000000a003600039000000000101043b00000000020000190000000004230019000000000501041a000000000054043500000001011000390000002002200039000000000092004b000009510000413d0000099c0000013d000003fa030000410000000004000019000000000503041a000000a002400039000000000052043500000001033000390000002004400039000000000014004b0000095b0000413d000009190000013d00000001010003670000000d02000029000000600220021000000421022001c7000000200020043f0000002401100370000000000101043b000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000c03000029000000000232004b0000097d0000813d0000044001000041000000000010043f000004240100004100000fcb00010430000000000021041b000000200030043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c70000800d020000390000000403000039000004220400004100000000050004110000000d060000290000000007000019000001260000013d000000000020043f000000200000043f000000400200003900000000010000190fc90faa0000040f000000000201041a00000468022001970000000d022001af000000000021041b000000000100001900000fca0001042e0000046801100197000000a0026000390000000000120435000000000004004b000000200200003900000000020060390000003f0120003900000469021001970000000001820019000000000021004b00000000020000390000000102004039000004250010009c000008ad0000213d0000000100200190000008ad0000c13d000000400010043f00000000058604360000000101700039000000000201041a000000010320019000000001082002700000007f0880618f0000001f0080008c00000000040000390000000104002039000000000442013f00000001004001900000006b0000c13d000700000005001d000c00000007001d000b00000006001d000000400400043d000a00000004001d000900000008001d0000000004840436000800000004001d000000000003004b000009dc0000613d000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d0000000905000029000000000005004b00000000020000190000000806000029000009e20000613d000000000101043b00000000020000190000000003260019000000000401041a000000000043043500000001011000390000002002200039000000000052004b000009ce0000413d000009e20000013d0000000b01000029000000000001041b0000000d010000290fc90f930000040f000000000100001900000fca0001042e000004680120019700000008020000290000000000120435000000090000006b000000200200003900000000020060390000003f0120003900000469021001970000000a040000290000000001420019000000000021004b00000000020000390000000102004039000004250010009c0000000c03000029000008ad0000213d0000000100200190000008ad0000c13d000000400010043f000000070100002900000000004104350000000201300039000000000201041a000000010320019000000001042002700000007f0440618f000a00000004001d0000001f0040008c00000000040000390000000104002039000000000442013f00000001004001900000006b0000c13d000000400400043d000900000004001d0000000a050000290000000004540436000800000004001d000000000003004b00000af20000613d000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d0000000a05000029000000000005004b0000000002000019000000080600002900000af80000613d000000000101043b00000000020000190000000003260019000000000401041a000000000043043500000001011000390000002002200039000000000052004b00000a150000413d00000af80000013d0000044801000041000000000010043f000004240100004100000fcb000104300000000d01000029000000600110021000000421011001c7000000200010043f0000000c01000029000000600110021000000421011001c7000700000001001d000004260010009c00000a2f0000813d0000044b01000041000000000010043f000004240100004100000fcb0001043000000000020004110000000d0020006c00000a490000613d0000000001000411000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000427011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a000000000001004b00000a490000c13d0000043f01000041000000000010043f000004240100004100000fcb000104300000044701000041000000000010043f0000043e0100004100000fcb000104300000000b01000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000a0220006c000009790000413d000000000021041b0000000701000029000000200010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000a0020002a00000f330000413d0000000a030000290000000002320019000000000021041b000000200030043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c70000800d020000390000000403000039000004220400004100000000050004110000000d060000290000000c070000290fc90fbf0000040f000000010020019000000f250000613d000004280100004100000000001004430000000c0100002900000004001004430000000001000414000003f30010009c000003f301008041000000c00110021000000429011001c700008002020000390fc90fc40000040f000000010020019000000af10000613d000000000101043b000000000001004b000001290000613d000000400400043d000000a001400039000000a002000039000000000021043500000080014000390000000a02000029000000000021043500000060014000390000000b02000029000000000021043500000040014000390000000d0200002900000000002104350000002001400039000000000200041100000000002104350000042a010000410000000000140435000000c0014000390000000903000029000000000031043500000469023001980000001f0330018f000700000004001d000000e005400039000000000125001900000008040000290000002004400039000000010440036700000aad0000613d000000000604034f000000006706043c0000000005750436000000000015004b00000aa90000c13d000000000003004b00000aba0000613d000000000224034f0000000303300210000000000401043300000000043401cf000000000434022f000000000202043b0000010003300089000000000232022f00000000023201cf000000000242019f000000000021043500000009010000290000042b0010009c0000042b01008041000000600110021000000007020000290000001c02200039000003f30020009c000003f3020080410000004002200210000000000121019f0000000002000414000003f30020009c000003f302008041000000c002200210000000000121019f0000042c0110009a0000000c020000290fc90fbf0000040f0000006003100270000003f303300197000000200030008c000000200400003900000000040340190000001f0540018f0000002006400190000000070460002900000adb0000613d000000000701034f0000000708000029000000007907043c0000000008980436000000000048004b00000ad70000c13d000000000005004b00000ae80000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000df10000613d000000070100002900000000010104330000042e0010009c000001290000613d0000073d0000013d000000000001042f0000046801200197000000080200002900000000001204350000000a0000006b000000200200003900000000020060390000003f0120003900000469021001970000000901200029000000000021004b00000000020000390000000102004039000004250010009c0000000b040000290000000c05000029000008ad0000213d0000000100200190000008ad0000c13d000000400010043f0000004003400039000000090100002900000000001304350000000301500039000000000101041a000000ff001001900000000001000039000000010100c0390000006002400039000c00000002001d0000000000120435000000400500043d00000000060404330000000001060433000000000001004b00000b480000c13d000000a001500039000000400010043f000000800250003900000000000204350000000d070000290000000004020019000000090070008c0000000a1770011a000000f801100210000000010220008a00000000060204330000044e06600197000000000116019f0000044f011001c7000000000012043500000b1a0000213d00000000014500490000008101100039000000210440008a0000000000140435000000400600043d00000020016000390000045005000041000000000051043500000027056000390000000004040433000000000004004b00000b390000613d000000000700001900000000015700190000000008270019000000000808043300000000008104350000002007700039000000000047004b00000b320000413d0000000001540019000000000001043500000007014000390000000000160435000000460140003900000469011001970000000005610019000000000015004b00000000010000390000000101004039000004250050009c000008ad0000213d0000000100100190000008ad0000c13d000000400050043f000000070100002900000000010104330000000002010433000000000002004b00000b580000c13d000004510050009c000008ad0000213d0000004001500039000000400010043f00000020015000390000045202000041000000000021043500000013010000390000000000150435000000400200043d00000b5a0000013d0000000002050019000000000501001900000000040304330000000031040434000000000001004b00000b8b0000c13d000004540020009c000008ad0000213d0000002001200039000000400010043f0000000000020435000000400300043d00000ba90000013d0000000001000411000000000010043f000000200000043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a000000ff00100190000002870000c13d0000062a0000013d000000000010043f000000200000043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a000000ff001001900000062a0000613d000000400100043d000004330010009c000008ad0000213d000000000c01001900000000020000310000042f0000013d00000020012000390000045307000041000000000071043500000027072000390000000004040433000000000004004b00000b9a0000613d000000000800001900000000017800190000000009830019000000000909043300000000009104350000002008800039000000000048004b00000b930000413d0000000001740019000000000001043500000007014000390000000000120435000000460140003900000469011001970000000003210019000000000013004b00000000010000390000000101004039000004250030009c000008ad0000213d0000000100100190000008ad0000c13d000000400030043f0000045508000041000000150080043f00000020043000390000000001060433000000000001004b000000000904001900000c650000c13d00000000060904360000000001390049000000200110008a0000000000130435000d00000006001d000000400060043f000000150080043f00000040069000390000000001050433000000000001004b000000000806001900000ca40000c13d000000000a0804360000000001980049000000400110008a0000000d0500002900000000001504350000004000a0043f0000045501000041000000150010043f00000040058000390000000001020433000000000001004b000000000b05001900000ce30000c13d00000000090b043600000000018b0049000000400110008a00000000001a0435000000400090043f0000006002b00039000004250020009c000008ad0000213d000000000092004b000008ad0000413d0000000c010000290000000001010433000000400020043f000000000001004b0000000301000039000000020100603900000000001904350000004008b00039000004590100004100000458010060410000000000180435000000400200043d00000020012000390000045a07000041000000000071043500000021072000390000045b0b0000410000000000b70435000000290b2000390000000003030433000000000003004b00000bf10000613d0000000007000019000000000cb70019000000000d470019000000000d0d04330000000000dc04350000002007700039000000000037004b00000bea0000413d0000000004b300190000000000040435000000000323001900000029043000390000045c0700004100000000007404350000003a0b3000390000000d040000290000000004040433000000000004004b00000c040000613d0000000007000019000000000cb70019000000000d670019000000000d0d04330000000000dc04350000002007700039000000000047004b00000bfd0000413d0000000006b40019000000000006043500000000033400190000003a043000390000045d0600004100000000006404350000004506300039000000290330003900000000040a0433000000000004004b00000c170000613d0000000007000019000000000a670019000000000b570019000000000b0b04330000000000ba04350000002007700039000000000047004b00000c100000413d0000000005640019000000000005043500000000034300190000001c043000390000045e0500004100000000005404350000002b0530003900000011033000390000000004090433000000000004004b00000c2a0000613d000000000600001900000000075600190000000009860019000000000909043300000000009704350000002006600039000000000046004b00000c230000413d0000000005540019000000000005043500000000034300190000001a043000390000045f0500004100000000005404350000000003230049000000040430008a00000000004204350000003b0330003900000469043001970000000003240019000000000043004b00000000040000390000000104004039000004250030009c000008ad0000213d0000000100400190000008ad0000c13d000000400030043f0000000005020433000000000005004b00000d570000c13d00000060020000390000008001000039000000000403001900000d9a0000013d000000070000006b00000d400000613d000000060000006b00000d400000613d0000000002000019000d00000002001d00000005012002100000000b011000290000000101100367000000000101043b000000000010043f0000000301000039000000200010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b0000000301100039000000000101041a000000ff00100190000000f50000c13d0000000d0200002900000001022000390000000c0020006c00000c4a0000413d0000078c0000013d0000000007610019000000000904001900000c7a0000013d0000370000f0019000000c8d0000613d00000000010904330000044e0110019700000456011001c700000000001904350000000801e000390000000001010433000000f801100210000000010d900039000000000e0d04330000044e0ee0019700000000011e019f00000000001d0435000000020d00003900000000099d0019000000000076004b00000bb00000613d0000000106600039000000000d060433000000ff0ed0018f000000010fe0020f0000001f00e0008c00000c680000a13d000000f80de0021000000000010904330000044e011001970000045700f0019800000ca00000613d00000456011001c700000000001904350000000101900039000000000e0104330000044e0ee00197000000000dde019f0000000000d1043500000c760000013d0000001d0100043d0000044e01100197000000040ed002700000000f0ee0018f000000000e0e0433000000f80ee002100000000001e1019f0000001d0010043f0000000f01d0018f0000000001010433000000f8011002100000001e0d00043d0000044e0dd0019700000000011d019f0000001e0010043f000000190100043d0000000000190435000000060d00003900000c770000013d0000000001d1019f0000000000190435000000010d00003900000c770000013d000000000a510019000000000806001900000cb90000013d000037000010019000000ccc0000613d00000000010804330000044e0110019700000456011001c700000000001804350000000801f000390000000001010433000000f8011002100000000107800039000000000e0704330000044e0ee0019700000000011e019f0000000000170435000000020700003900000000088700190000000000a5004b00000bbc0000613d0000000105500039000000000e050433000000ff0fe0018f0000000101f0020f0000001f00f0008c00000ca70000a13d000000f807f00210000000000e0804330000044e0ee00197000004570010019800000cdf0000613d0000045601e001c700000000001804350000000101800039000000000e0104330000044e0ee0019700000000077e019f000000000071043500000cb50000013d0000001d0100043d0000044e011001970000000407e002700000000f0770018f0000000007070433000000f807700210000000000171019f0000001d0010043f0000000f01e0018f0000000001010433000000f8011002100000001e0700043d0000044e07700197000000000117019f0000001e0010043f000000190100043d0000000000180435000000060700003900000cb60000013d00000000017e019f0000000000180435000000010700003900000cb60000013d0000000009210019000000000b05001900000cf80000013d000037000010019000000d0b0000613d00000000010b04330000044e0110019700000456011001c700000000001b043500000008017000390000000001010433000000f8011002100000000107b00039000000000f0704330000044e0ff0019700000000011f019f00000000001704350000000207000039000000000bb70019000000000092004b00000bc90000613d0000000102200039000000000f020433000000ff07f0018f000000010170020f0000001f0070008c00000ce60000a13d000000f807700210000000000f0b04330000044e0ff00197000004570010019800000d1e0000613d0000045601f001c700000000001b04350000000101b00039000000000f0104330000044e0ff0019700000000077f019f000000000071043500000cf40000013d0000001d0100043d0000044e011001970000000407f002700000000f0770018f0000000007070433000000f807700210000000000171019f0000001d0010043f0000000f01f0018f0000000001010433000000f8011002100000001e0700043d0000044e07700197000000000117019f0000001e0010043f000000190100043d00000000001b0435000000060700003900000cf50000013d00000000017f019f00000000001b0435000000010700003900000cf50000013d0000001f0430018f0000042d053001980000000a0250002900000d2c0000613d000000000601034f0000000a07000029000000006806043c0000000007870436000000000027004b00000d280000c13d000000000004004b00000d390000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000000a02000029000003f30020009c000003f3020080410000004002200210000000000121019f00000fcb000104300000000002000019000d00000002001d00000005012002100000000b011000290000000101100367000000000101043b000000000010043f0000000301000039000000200010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d0000000d0200002900000001022000390000000c0020006c00000d410000413d0000078c0000013d00000460040000410000001f0040043f00000461040000410000003f0040043f00000000071500190000000008070433000000000007043500000020013000390000000204500039000000030440011a00000002044002100000000009340019000000200a9000390000000006010019000000000b00043d0000044e0bb001970000000302200039000000000c020433000000120dc002700000003f0dd0018f000000000d0d0433000000f80dd00210000000000bdb019f0000000000b0043f0000000c0bc002700000003f0bb0018f000000000b0b0433000000f80bb00210000000010d00043d0000044e0dd00197000000000bbd019f0000000100b0043f000000060bc002700000003f0bb0018f000000000b0b0433000000f80bb00210000000020d00043d0000044e0dd00197000000000bbd019f0000000200b0043f0000003f0bc0018f000000000b0b0433000000f80bb00210000000030c00043d0000044e0cc00197000000000bbc019f0000000300b0043f000000000b00043d0000000000b6043500000004066000390000000000a6004b00000d650000413d00000000008704350000004002900039000000400020043f000000032050011a000000000002004b0000000005000019000000ff0220c18f000000020520c11900000000025600490000046205000041000000000052043500000000000604350000000000430435000000400400043d00000000020300190000000005040019000d00000004001d0000002003400039000004630400004100000000004304350000000003020433000c00000003001d0000003d025000390fc90f710000040f0000000c030000290000001d023000390000000d0100002900000000002104350000003d023000390fc90f5f0000040f000000400100043d000c00000001001d0000000d020000290fc90f7e0000040f0000000c02000029000009210000013d000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000427011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000101041a000000000001004b0000079c0000c13d00000a410000013d0000000601000029000000600110021000070421001001cb000000050300002900000009013000290000000101100367000000000101043b000d00000001001d0000000801000029000000200010043f000b00000003001d0000000a013000290000000101100367000000000101043b000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000d0220006c000009790000413d000000000021041b0000000701000029000000200010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000420011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000000101043b000000000201041a0000000d04000029000000000042001a00000f330000413d0000000b03000029000000200330008c0000000002420019000000000021041b00000dc20000c13d0000079e0000013d0000001f0430018f0000042d05300198000000070250002900000dfb0000613d000000000601034f0000000707000029000000006806043c0000000007870436000000000027004b00000df70000c13d000000000004004b00000e080000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001204350000006001300210000000070200002900000d3b0000013d0000001f0430018f0000042d05300198000000080250002900000e150000613d000000000601034f0000000807000029000000006806043c0000000007870436000000000027004b00000e110000c13d000000000004004b00000e220000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001204350000006001300210000000080200002900000d3b0000013d000000090000006b000000000100001900000e2a0000613d00000008010000290000000001010433000000090400002900000003024002100000046a0220027f0000046a02200167000000000121016f0000000102400210000000000121019f00000e4d0000013d000000010320008a0000000503300270000000000431001900000020030000390000000104400039000000070600002900000000056300190000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000e380000c13d000000090020006c00000e4a0000813d00000009020000290000000302200210000000f80220018f0000046a0220027f0000046a0220016700000007033000290000000003030433000000000223016f000000000021041b0000000901000029000000010110021000000001011001bf0000000a02000029000000000012041b0000000d010000290000000001010433000800000001001d0000000021010434000900000002001d000d00000001001d000004250010009c000008ad0000213d0000000a010000290000000101100039000700000001001d000000000101041a000000010010019000000001021002700000007f0220618f000600000002001d0000001f0020008c00000000020000390000000102002039000000000121013f00000001001001900000006b0000c13d0000000601000029000000200010008c00000e840000413d0000000701000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d0000000d030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000006010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b00000e840000813d000000000002041b0000000102200039000000000012004b00000e800000413d0000000d010000290000001f0010008c00000e980000a13d0000000701000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000200200008a0000000d02200180000000000101043b00000ebf0000c13d000000200300003900000ecc0000013d0000000d0000006b000000000100001900000e9d0000613d000000090100002900000000010104330000000d0400002900000003024002100000046a0220027f0000046a02200167000000000121016f0000000102400210000000000121019f00000eda0000013d0000001f0430018f0000042d053001980000000c0250002900000eaf0000613d000000000601034f0000000c07000029000000006806043c0000000007870436000000000027004b00000eab0000c13d000000000004004b00000ebc0000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000000c0200002900000d3b0000013d000000010320008a0000000503300270000000000431001900000020030000390000000104400039000000080600002900000000056300190000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000ec50000c13d0000000d0020006c00000ed70000813d0000000d020000290000000302200210000000f80220018f0000046a0220027f0000046a0220016700000008033000290000000003030433000000000223016f000000000021041b0000000d01000029000000010110021000000001011001bf0000000702000029000000000012041b0000000c010000290000000001010433000d00000001001d0000000021010434000900000002001d000c00000001001d000004250010009c000008ad0000213d0000000a010000290000000201100039000800000001001d000000000101041a000000010010019000000001021002700000007f0220618f000700000002001d0000001f0020008c00000000020000390000000102002039000000000121013f00000001001001900000006b0000c13d0000000701000029000000200010008c00000f110000413d0000000801000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d0000000c030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000007010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b00000f110000813d000000000002041b0000000102200039000000000012004b00000f0d0000413d0000000c010000290000001f0010008c00000f270000a13d0000000801000029000000000010043f0000000001000414000003f30010009c000003f301008041000000c00110021000000434011001c700008010020000390fc90fc40000040f000000010020019000000f250000613d000000200200008a0000000c02200180000000000101043b00000f370000c13d000000200300003900000f430000013d000000000100001900000fcb000104300000000c0000006b000000000100001900000f2c0000613d000000090100002900000000010104330000000c0400002900000003024002100000046a0220027f0000046a02200167000000000221016f000000010140021000000f510000013d0000044901000041000000000010043f000004240100004100000fcb00010430000000010320008a00000005033002700000000004310019000000200300003900000001044000390000000d053000290000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000f3c0000c13d0000000c0020006c00000f4e0000813d0000000c020000290000000302200210000000f80220018f0000046a0220027f0000046a022001670000000d033000290000000003030433000000000223016f000000000021041b00000001010000390000000c020000290000000102200210000000000112019f0000000802000029000000000012041b0000000a010000290000000301100039000000000201041a00000468022001970000000b030000290000000003030433000000000003004b000000010220c1bf000000000021041b000000000100001900000fca0001042e0000001f0220003900000469022001970000000001120019000000000021004b00000000020000390000000102004039000004250010009c00000f6b0000213d000000010020019000000f6b0000c13d000000400010043f000000000001042d0000046401000041000000000010043f0000004101000039000000040010043f000004650100004100000fcb00010430000000000003004b00000f7b0000613d000000000400001900000000052400190000000006140019000000000606043300000000006504350000002004400039000000000034004b00000f740000413d00000000012300190000000000010435000000000001042d00000020030000390000000004310436000000003202043400000000002404350000004001100039000000000002004b00000f8d0000613d000000000400001900000000051400190000000006430019000000000606043300000000006504350000002004400039000000000024004b00000f860000413d000000000312001900000000000304350000001f0220003900000469022001970000000001210019000000000001042d0001000000000002000003f402000041000000000502041a00000000020004140000041d06100197000003f30020009c000003f302008041000000c001200210000003f5011001c70000800d020000390000000303000039000003f604000041000100000006001d0fc90fbf0000040f000000010020019000000fa70000613d000003f4010000410000000102000029000000000021041b000000000001042d000000000100001900000fcb00010430000000000001042f000003f30010009c000003f3010080410000004001100210000003f30020009c000003f3020080410000006002200210000000000112019f0000000002000414000003f30020009c000003f302008041000000c002200210000000000112019f000003f5011001c700008010020000390fc90fc40000040f000000010020019000000fbd0000613d000000000101043b000000000001042d000000000100001900000fcb0001043000000fc2002104210000000102000039000000000001042d0000000002000019000000000001042d00000fc7002104230000000102000039000000000001042d0000000002000019000000000001042d00000fc90000043200000fca0001042e00000fcb0001043000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392702000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf64ef1d2ad89edf8c4d91132028e8195cdf30bb4b5053d4f8cd260341d4805f30a426561726973682044726f70730000000000000000000000000000000000001a405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acebfa87805ed57dc1f0d489ce33be4c4577d74ccde357eeeee058a32c55c44a53244524f505300000000000000000000000000000000000000000000000000000a000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000000000000000000000731133e800000000000000000000000000000000000000000000000000000000e985e9c400000000000000000000000000000000000000000000000000000000f2fde38a00000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000f5298aca00000000000000000000000000000000000000000000000000000000fee81cf400000000000000000000000000000000000000000000000000000000e985e9c500000000000000000000000000000000000000000000000000000000f04e283e00000000000000000000000000000000000000000000000000000000f242432a00000000000000000000000000000000000000000000000000000000a22cb46400000000000000000000000000000000000000000000000000000000a22cb46500000000000000000000000000000000000000000000000000000000be1a7c8300000000000000000000000000000000000000000000000000000000c444719400000000000000000000000000000000000000000000000000000000731133e9000000000000000000000000000000000000000000000000000000008da5cb5b0000000000000000000000000000000000000000000000000000000095d89b41000000000000000000000000000000000000000000000000000000002eb2c2d5000000000000000000000000000000000000000000000000000000005a1b4fb0000000000000000000000000000000000000000000000000000000005a1b4fb1000000000000000000000000000000000000000000000000000000006b20c45400000000000000000000000000000000000000000000000000000000715018a6000000000000000000000000000000000000000000000000000000002eb2c2d6000000000000000000000000000000000000000000000000000000004e1273f40000000000000000000000000000000000000000000000000000000054d1f13d000000000000000000000000000000000000000000000000000000000e89341b000000000000000000000000000000000000000000000000000000000e89341c000000000000000000000000000000000000000000000000000000001f7fdffa00000000000000000000000000000000000000000000000000000000256929620000000000000000000000000000000000000000000000000000000000fdd58e0000000000000000000000000000000000000000000000000000000001ffc9a70000000000000000000000000000000000000000000000000000000006fdde03000000000000000000000000ffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000389a75e1000000000000000000000000000000000000002000000080000000000000000002000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000009a31110384e0b0c9c3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62000000000000000000000000000000000000000000000000000000007448fbae00000000000000000000000000000000000000040000001c0000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff000000000000000000000000000000000000000100000000000000000000000002000000000000000000000000000000000000340000000c00000000000000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b83020000020000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000000000000000000000f23a6e6100000000000000000000000000000000000000000000000000000000ffffff3bffffffffffffffffffffffffffffffffffffff3c00000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffe0f23a6e610000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000200000000c0000000000000000796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d955391320200000200000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000006f5e8818000000000000000000000000000000000000000000000000ffffffffffffff7f020000000000000000000000000000000000002000000000000000000000000017307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c317fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000ffffffff000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000004a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb0000000000000000000000000000000000000000000000000000000082b42900fa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92a4420a95000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000004b6e7f1800000000000000000000000000000000000000000000000000000000f4d678b802000000000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000bc197c81bc197c8100000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd5d00dbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d102508fc000000000000000000000000000000000000000000000000000000001df89e8b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b800a460000000000000000000000000000000000000000000000000000000001336cea000000000000000000000000000000000000000000000000000000009c05499b00000000000000000000000000000000000000000000000000000000ea553b34d92e233d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff8000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3000000000000000000000000000000000000000000000000000000000000000546f6b656e202300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffbf4e6f206465736372697074696f6e207365742e00000000000000000000000000697066733a2f2f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffdf000000005c75303030303031323334353637383961626364656662746e0066725c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000004000000004e4f00000000000000000000000000000000000000000000000000000000000059455300000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000226e616d65223a22000000000000000000000000000000000000000000000000222c226465736372697074696f6e223a22000000000000000000000000000000222c22696d616765223a22000000000000000000000000000000000000000000222c22736f756c626f756e64223a220000000000000000000000000000000000227d0000000000000000000000000000000000000000000000000000000000004142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3d3d000000000000000000000000000000000000000000000000000000000000646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000004e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000d9b67a26ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000009c3929f3478013e0cdaff48ca46a85e2c4707f22d458fb2f497cf98ac3aa1c6e
[ 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.