Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 45 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim POAP | 2644302 | 8 hrs ago | IN | 0 ETH | 0.00000972 | ||||
Set Token Metada... | 2643891 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643889 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643888 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643886 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643884 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643882 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643879 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643878 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643876 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643873 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643872 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643869 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643867 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643865 | 8 hrs ago | IN | 0 ETH | 0.00001269 | ||||
Set Token Metada... | 2643863 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643861 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643860 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643858 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643856 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643854 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643852 | 8 hrs ago | IN | 0 ETH | 0.00001585 | ||||
Set Token Metada... | 2643850 | 8 hrs ago | IN | 0 ETH | 0.00001388 | ||||
Set Token Metada... | 2643848 | 8 hrs ago | IN | 0 ETH | 0.00001267 | ||||
Set Token Metada... | 2643846 | 8 hrs ago | IN | 0 ETH | 0.00001388 |
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
2593286 | 23 hrs ago | Contract Creation | 0 ETH |
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:
RegenTreasureHunt
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"; import {ECDSA} from "solady/src/utils/ECDSA.sol"; import {IERC1155} from "@openzeppelin/contracts/interfaces/IERC1155.sol"; import {IERC1155MetadataURI} from "@openzeppelin/contracts/interfaces/IERC1155MetadataURI.sol"; /** * @title RegenTreasureHunt * @author @dripchain * @notice Soulbound ERC1155 contract using server-side signatures for POAP claims. * @dev Tokens are minted with a signature from `serverSigner`. Each claim uses a unique nonce. */ contract RegenTreasureHunt is ERC1155, Ownable { using LibString for uint256; /** * @dev Thrown on user-to-user transfer if the token is soulbound. */ error Soulbound(); /** * @dev Thrown if `msg.sender` is neither owner nor manager. */ error NotManager(); /** * @dev Thrown if an input address is zero. */ error ZeroAddress(); /** * @dev Thrown if token metadata is not created before use. */ error TokenNotCreated(); /** * @dev Thrown if signature validation fails. */ error InvalidSignature(); /** * @dev Thrown if a given nonce has already been used. */ error NonceUsed(); /** * @notice Tracks which addresses can mint or burn tokens (besides the owner). */ mapping(address => bool) public managers; /** * @dev Modifier that checks `msg.sender` is the owner or a manager. */ modifier onlyOwnerOrManager() { if (msg.sender != owner() && !managers[msg.sender]) { revert NotManager(); } _; } /** * @notice Sets or unsets `_manager` as a manager. * @param _manager Address to configure. * @param _status Boolean to grant or revoke. */ function setManager(address _manager, bool _status) external onlyOwner { if (_manager == address(0)) revert ZeroAddress(); managers[_manager] = _status; } /** * @notice Data structure for metadata. */ struct OnChainMetadata { string name; string description; string imageIpfsHash; bool soulbound; uint256 createdAt; } /** * @notice Mapping from tokenId => metadata. */ mapping(uint256 => OnChainMetadata) private _tokenMetadata; /** * @notice Contract name. */ string public name; /** * @notice Contract symbol. */ string public symbol; /** * @notice Address used to validate off-chain signatures for POAP claims. */ address public serverSigner; /** * @notice Nonce tracking to prevent replay. */ mapping(uint256 => bool) public usedNonces; /** * @param _signer Sets the serverSigner address. */ function setServerSigner(address _signer) external onlyOwner { if (_signer == address(0)) revert ZeroAddress(); serverSigner = _signer; } /** * @notice Constructor sets owner to deployer and optional manager status. */ constructor() { _initializeOwner(msg.sender); name = "RegenTreasureHunt"; symbol = "REHUNT"; managers[msg.sender] = true; } /** * @inheritdoc ERC1155 */ 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); } /** * @inheritdoc ERC1155 */ 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); } /** * @notice Admin or manager can mint. * @param to Recipient address. * @param id Token ID. * @param amount Quantity to mint. * @param data Extra data. */ function mint( address to, uint256 id, uint256 amount, bytes calldata data ) external onlyOwnerOrManager { if (to == address(0)) revert ZeroAddress(); _mint(to, id, amount, data); } /** * @notice Admin or manager can burn from another address. * @param from Address to burn from. * @param id Token ID. * @param amount Quantity to burn. */ function burnFrom( address from, uint256 id, uint256 amount ) external onlyOwnerOrManager { _burn(from, id, amount); } /** * @notice Admin or manager can batch mint. * @param to Recipient address. * @param ids Array of token IDs. * @param amounts Array of amounts. * @param data Extra data. */ function mintBatch( address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external onlyOwnerOrManager { if (to == address(0)) revert ZeroAddress(); require(ids.length == amounts.length, "Mismatch"); _batchMint(to, ids, amounts, data); } /** * @notice Admin or manager can batch burn from another address. * @param from Address to burn from. * @param ids Array of token IDs. * @param amounts Array of amounts. */ function burnBatch( address from, uint256[] calldata ids, uint256[] calldata amounts ) external onlyOwnerOrManager { require(ids.length == amounts.length, "Mismatch"); _batchBurn(from, ids, amounts); } /** * @notice Claim function requiring server-side signature validation. * @param tokenId Token ID. * @param amount Quantity to mint. * @param nonce Unique nonce. * @param signature Off-chain signature from `serverSigner`. */ function claimPOAP( uint256 tokenId, uint256 amount, uint256 nonce, bytes calldata signature ) external { if (_tokenMetadata[tokenId].createdAt == 0) revert TokenNotCreated(); if (usedNonces[nonce]) revert NonceUsed(); usedNonces[nonce] = true; bytes32 msgHash = keccak256( abi.encodePacked(address(this), msg.sender, tokenId, amount, nonce) ); bytes32 ethSignedHash = ECDSA.toEthSignedMessageHash(msgHash); address recoveredSigner = ECDSA.recoverCalldata( ethSignedHash, signature ); if (recoveredSigner != serverSigner) revert InvalidSignature(); _mint(msg.sender, tokenId, amount, ""); } /** * @notice Self-burn for a user's own balance. * @param tokenId Token ID. * @param amount Quantity to burn. */ function burn(uint256 tokenId, uint256 amount) external { uint256 bal = balanceOf(msg.sender, tokenId); require(bal >= amount, "Not enough balance"); _burn(msg.sender, tokenId, amount); } /** * @notice Set metadata for `tokenId`. * @param tokenId Token ID. * @param _name Name field. * @param _description Description field. * @param _ipfsHash IPFS hash for image. * @param _soulbound Whether token is soulbound. */ function setTokenMetadata( uint256 tokenId, string calldata _name, string calldata _description, string calldata _ipfsHash, bool _soulbound ) external onlyOwnerOrManager { _tokenMetadata[tokenId] = OnChainMetadata({ name: _name, description: _description, imageIpfsHash: _ipfsHash, soulbound: _soulbound, createdAt: block.timestamp }); } /** * @notice Returns Base64-encoded JSON metadata for `tokenId`. * @param tokenId Token ID. * @return A data: URI containing the JSON metadata. */ function uri( uint256 tokenId ) public view virtual override returns (string memory) { OnChainMetadata memory meta = _tokenMetadata[tokenId]; if (meta.createdAt == 0) revert TokenNotCreated(); 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."; string memory image_ = bytes(meta.imageIpfsHash).length > 0 ? string(abi.encodePacked("ipfs://", meta.imageIpfsHash)) : ""; string memory json = string( abi.encodePacked( "{", '"name":"', LibString.escapeJSON(name_, false), '","description":"', LibString.escapeJSON(desc_, false), '","image":"', LibString.escapeJSON(image_, false), '","soulbound":"', meta.soulbound ? "YES" : "NO", '"}' ) ); return string( abi.encodePacked( "data:application/json;base64,", Base64.encode(bytes(json)) ) ); } /** * @notice ERC165 support. * @param interfaceId Interface ID. * @return True if supported. */ function supportsInterface( bytes4 interfaceId ) public view virtual override returns (bool) { return super.supportsInterface(interfaceId) || interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId; } }
// 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 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 // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "../token/ERC1155/IERC1155.sol";
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Gas optimized ECDSA wrapper. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol) /// /// @dev Note: /// - The recovery functions use the ecrecover precompile (0x1). /// - As of Solady version 0.0.68, the `recover` variants will revert upon recovery failure. /// This is for more safety by default. /// Use the `tryRecover` variants if you need to get the zero address back /// upon recovery failure instead. /// - As of Solady version 0.0.134, all `bytes signature` variants accept both /// regular 65-byte `(r, s, v)` and EIP-2098 `(r, vs)` short form signatures. /// See: https://eips.ethereum.org/EIPS/eip-2098 /// This is for calldata efficiency on smart accounts prevalent on L2s. /// /// WARNING! Do NOT directly use signatures as unique identifiers: /// - The recovery operations do NOT check if a signature is non-malleable. /// - Use a nonce in the digest to prevent replay attacks on the same contract. /// - Use EIP-712 for the digest to prevent replay attacks across different chains and contracts. /// EIP-712 also enables readable signing of typed data for better user safety. /// - If you need a unique hash from a signature, please use the `canonicalHash` functions. library ECDSA { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The order of the secp256k1 elliptic curve. uint256 internal constant N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141; /// @dev `N/2 + 1`. Used for checking the malleability of the signature. uint256 private constant _HALF_N_PLUS_1 = 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The signature is invalid. error InvalidSignature(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* RECOVERY OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. function recover(bytes32 hash, bytes memory signature) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { for { let m := mload(0x40) } 1 { mstore(0x00, 0x8baa579f) // `InvalidSignature()`. revert(0x1c, 0x04) } { switch mload(signature) case 64 { let vs := mload(add(signature, 0x40)) mstore(0x20, add(shr(255, vs), 27)) // `v`. mstore(0x60, shr(1, shl(1, vs))) // `s`. } case 65 { mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. mstore(0x60, mload(add(signature, 0x40))) // `s`. } default { continue } mstore(0x00, hash) mstore(0x40, mload(add(signature, 0x20))) // `r`. result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) mstore(0x60, 0) // Restore the zero slot. mstore(0x40, m) // Restore the free memory pointer. // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. if returndatasize() { break } } } } /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. function recoverCalldata(bytes32 hash, bytes calldata signature) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { for { let m := mload(0x40) } 1 { mstore(0x00, 0x8baa579f) // `InvalidSignature()`. revert(0x1c, 0x04) } { switch signature.length case 64 { let vs := calldataload(add(signature.offset, 0x20)) mstore(0x20, add(shr(255, vs), 27)) // `v`. mstore(0x40, calldataload(signature.offset)) // `r`. mstore(0x60, shr(1, shl(1, vs))) // `s`. } case 65 { mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`. calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`. } default { continue } mstore(0x00, hash) result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) mstore(0x60, 0) // Restore the zero slot. mstore(0x40, m) // Restore the free memory pointer. // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. if returndatasize() { break } } } } /// @dev Recovers the signer's address from a message digest `hash`, /// and the EIP-2098 short form signature defined by `r` and `vs`. function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x00, hash) mstore(0x20, add(shr(255, vs), 27)) // `v`. mstore(0x40, r) mstore(0x60, shr(1, shl(1, vs))) // `s`. result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. if iszero(returndatasize()) { mstore(0x00, 0x8baa579f) // `InvalidSignature()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Recovers the signer's address from a message digest `hash`, /// and the signature defined by `v`, `r`, `s`. function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x00, hash) mstore(0x20, and(v, 0xff)) mstore(0x40, r) mstore(0x60, s) result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. if iszero(returndatasize()) { mstore(0x00, 0x8baa579f) // `InvalidSignature()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot. mstore(0x40, m) // Restore the free memory pointer. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* TRY-RECOVER OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // WARNING! // These functions will NOT revert upon recovery failure. // Instead, they will return the zero address upon recovery failure. // It is critical that the returned address is NEVER compared against // a zero address (e.g. an uninitialized address variable). /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. function tryRecover(bytes32 hash, bytes memory signature) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { for { let m := mload(0x40) } 1 {} { switch mload(signature) case 64 { let vs := mload(add(signature, 0x40)) mstore(0x20, add(shr(255, vs), 27)) // `v`. mstore(0x60, shr(1, shl(1, vs))) // `s`. } case 65 { mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. mstore(0x60, mload(add(signature, 0x40))) // `s`. } default { break } mstore(0x00, hash) mstore(0x40, mload(add(signature, 0x20))) // `r`. pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) mstore(0x60, 0) // Restore the zero slot. // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. result := mload(xor(0x60, returndatasize())) mstore(0x40, m) // Restore the free memory pointer. break } } } /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. function tryRecoverCalldata(bytes32 hash, bytes calldata signature) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { for { let m := mload(0x40) } 1 {} { switch signature.length case 64 { let vs := calldataload(add(signature.offset, 0x20)) mstore(0x20, add(shr(255, vs), 27)) // `v`. mstore(0x40, calldataload(signature.offset)) // `r`. mstore(0x60, shr(1, shl(1, vs))) // `s`. } case 65 { mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`. calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`. } default { break } mstore(0x00, hash) pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) mstore(0x60, 0) // Restore the zero slot. // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. result := mload(xor(0x60, returndatasize())) mstore(0x40, m) // Restore the free memory pointer. break } } } /// @dev Recovers the signer's address from a message digest `hash`, /// and the EIP-2098 short form signature defined by `r` and `vs`. function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x00, hash) mstore(0x20, add(shr(255, vs), 27)) // `v`. mstore(0x40, r) mstore(0x60, shr(1, shl(1, vs))) // `s`. pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) mstore(0x60, 0) // Restore the zero slot. // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. result := mload(xor(0x60, returndatasize())) mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Recovers the signer's address from a message digest `hash`, /// and the signature defined by `v`, `r`, `s`. function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns (address result) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x00, hash) mstore(0x20, and(v, 0xff)) mstore(0x40, r) mstore(0x60, s) pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) mstore(0x60, 0) // Restore the zero slot. // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. result := mload(xor(0x60, returndatasize())) mstore(0x40, m) // Restore the free memory pointer. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HASHING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns an Ethereum Signed Message, created from a `hash`. /// This produces a hash corresponding to the one signed with the /// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign) /// JSON-RPC method as part of EIP-191. function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { mstore(0x20, hash) // Store into scratch space for keccak256. mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32") // 28 bytes. result := keccak256(0x04, 0x3c) // `32 * 2 - (32 - 28) = 60 = 0x3c`. } } /// @dev Returns an Ethereum Signed Message, created from `s`. /// This produces a hash corresponding to the one signed with the /// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign) /// JSON-RPC method as part of EIP-191. /// Note: Supports lengths of `s` up to 999999 bytes. function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { let sLength := mload(s) let o := 0x20 mstore(o, "\x19Ethereum Signed Message:\n") // 26 bytes, zero-right-padded. mstore(0x00, 0x00) // Convert the `s.length` to ASCII decimal representation: `base10(s.length)`. for { let temp := sLength } 1 {} { o := sub(o, 1) mstore8(o, add(48, mod(temp, 10))) temp := div(temp, 10) if iszero(temp) { break } } let n := sub(0x3a, o) // Header length: `26 + 32 - o`. // Throw an out-of-offset error (consumes all gas) if the header exceeds 32 bytes. returndatacopy(returndatasize(), returndatasize(), gt(n, 0x20)) mstore(s, or(mload(0x00), mload(n))) // Temporarily store the header. result := keccak256(add(s, sub(0x20, n)), add(n, sLength)) mstore(s, sLength) // Restore the length. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CANONICAL HASH FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // The following functions returns the hash of the signature in it's canonicalized format, // which is the 65-byte `abi.encodePacked(r, s, uint8(v))`, where `v` is either 27 or 28. // If `s` is greater than `N / 2` then it will be converted to `N - s` // and the `v` value will be flipped. // If the signature has an invalid length, or if `v` is invalid, // a uniquely corrupt hash will be returned. // These functions are useful for "poor-mans-VRF". /// @dev Returns the canonical hash of `signature`. function canonicalHash(bytes memory signature) internal pure returns (bytes32 result) { // @solidity memory-safe-assembly assembly { let l := mload(signature) for {} 1 {} { mstore(0x00, mload(add(signature, 0x20))) // `r`. let s := mload(add(signature, 0x40)) let v := mload(add(signature, 0x41)) if eq(l, 64) { v := add(shr(255, s), 27) s := shr(1, shl(1, s)) } if iszero(lt(s, _HALF_N_PLUS_1)) { v := xor(v, 7) s := sub(N, s) } mstore(0x21, v) mstore(0x20, s) result := keccak256(0x00, 0x41) mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. break } // If the length is neither 64 nor 65, return a uniquely corrupted hash. if iszero(lt(sub(l, 64), 2)) { // `bytes4(keccak256("InvalidSignatureLength"))`. result := xor(keccak256(add(signature, 0x20), l), 0xd62f1ab2) } } } /// @dev Returns the canonical hash of `signature`. function canonicalHashCalldata(bytes calldata signature) internal pure returns (bytes32 result) { // @solidity memory-safe-assembly assembly { for {} 1 {} { mstore(0x00, calldataload(signature.offset)) // `r`. let s := calldataload(add(signature.offset, 0x20)) let v := calldataload(add(signature.offset, 0x21)) if eq(signature.length, 64) { v := add(shr(255, s), 27) s := shr(1, shl(1, s)) } if iszero(lt(s, _HALF_N_PLUS_1)) { v := xor(v, 7) s := sub(N, s) } mstore(0x21, v) mstore(0x20, s) result := keccak256(0x00, 0x41) mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. break } // If the length is neither 64 nor 65, return a uniquely corrupted hash. if iszero(lt(sub(signature.length, 64), 2)) { calldatacopy(mload(0x40), signature.offset, signature.length) // `bytes4(keccak256("InvalidSignatureLength"))`. result := xor(keccak256(mload(0x40), signature.length), 0xd62f1ab2) } } } /// @dev Returns the canonical hash of `signature`. function canonicalHash(bytes32 r, bytes32 vs) internal pure returns (bytes32 result) { // @solidity memory-safe-assembly assembly { mstore(0x00, r) // `r`. let v := add(shr(255, vs), 27) let s := shr(1, shl(1, vs)) mstore(0x21, v) mstore(0x20, s) result := keccak256(0x00, 0x41) mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. } } /// @dev Returns the canonical hash of `signature`. function canonicalHash(uint8 v, bytes32 r, bytes32 s) internal pure returns (bytes32 result) { // @solidity memory-safe-assembly assembly { mstore(0x00, r) // `r`. if iszero(lt(s, _HALF_N_PLUS_1)) { v := xor(v, 7) s := sub(N, s) } mstore(0x21, v) mstore(0x20, s) result := keccak256(0x00, 0x41) mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EMPTY CALLDATA HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns an empty calldata bytes. function emptySignature() internal pure returns (bytes calldata signature) { /// @solidity memory-safe-assembly assembly { signature.length := 0 } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155MetadataURI} from "../token/ERC1155/extensions/IERC1155MetadataURI.sol";
// 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 } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC-1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[ERC]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155} from "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[ERC]. */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "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":"InvalidSignature","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NonceUsed","type":"error"},{"inputs":[],"name":"NotManager","type":"error"},{"inputs":[],"name":"NotOwnerNorApproved","type":"error"},{"inputs":[],"name":"Soulbound","type":"error"},{"inputs":[],"name":"TokenNotCreated","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":"uint256","name":"tokenId","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":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"claimPOAP","outputs":[],"stateMutability":"nonpayable","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":"","type":"address"}],"name":"managers","outputs":[{"internalType":"bool","name":"","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":"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":[],"name":"serverSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setServerSigner","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":"","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"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"usedNonces","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
9c4d535b000000000000000000000000000000000000000000000000000000000000000001000505997fb0cc08fcab36bab684fa70effd6c9cf62b35c693eae1f0029a5300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x0002000000000002000d00000000000200010000000103550000006003100270000004700030019d0000008005000039000000400050043f0000000100200190000001660000c13d0000047002300197000000040020008c0000085f0000413d000000000301043b000000e0033002700000047b0030009c0000019f0000a13d0000047c0030009c000001e10000a13d0000047d0030009c000002000000213d000004830030009c000003340000213d000004860030009c000007d00000613d000004870030009c0000085f0000c13d000000a40020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000002403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d000c00040030003d0000000c04100360000000000404043b000d00000004001d000004a90040009c0000085f0000213d0000000d03300029000b00240030003d0000000b0020006b0000085f0000213d0000004403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000441034f000000000404043b000a00000004001d000004a90040009c0000085f0000213d0000002404300039000800000004001d0009000a0040002d000000090020006b0000085f0000213d0000006403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000441034f000000000404043b000700000004001d000004a90040009c0000085f0000213d0000002404300039000500000004001d000600070040002d000000060020006b0000085f0000213d0000008401100370000000000301043b000000000003004b0000000001000039000000010100c039000300000003001d000000000013004b0000085f0000c13d000400000005001d0000047101000041000000000101041a000004a4031001970000000001000411000000000031004b00000bee0000c13d0000000d010000290000001f01100039000004ff011001970000003f01100039000004ff011001970000000403000029000000a003300039000000400030043f0000000001130019000004a90010009c000003960000213d000000400010043f0000000d0100002900000000001304350000000b0020006b00000004050000290000085f0000213d0000000c0100002900000020041000390000000101000367000000000641034f0000000d08000029000004ff078001980000001f0880018f000000c0045000390000000005740019000000840000613d000000000906034f000000000a040019000000009b09043c000000000aba043600000000005a004b000000800000c13d000000000008004b000000910000613d000000000676034f0000000307800210000000000805043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f00000000006504350000000d04400029000000000004043500000004040000290000000003340436000d00000003001d0000000a030000290000001f03300039000004ff033001970000003f03300039000004ff04300197000000400300043d0000000004430019000000000034004b00000000050000390000000105004039000004a90040009c000003960000213d0000000100500190000003960000c13d000000400040043f0000000a040000290000000004430436000000090020006b0000085f0000213d00000008061003600000000a08000029000004ff078001980000001f0880018f0000000005740019000000b50000613d000000000906034f000000000a040019000000009b09043c000000000aba043600000000005a004b000000b10000c13d000000000008004b000000c20000613d000000000676034f0000000307800210000000000805043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f00000000006504350000000a0440002900000000000404350000000d04000029000000000034043500000007030000290000001f03300039000004ff033001970000003f03300039000004ff04300197000000400300043d0000000004430019000000000034004b00000000050000390000000105004039000004a90040009c000003960000213d0000000100500190000003960000c13d000000400040043f00000007040000290000000004430436000000060020006b0000085f0000213d00000005021003600000000706000029000004ff056001980000001f0660018f0000000001540019000000e50000613d000000000702034f0000000008040019000000007907043c0000000008980436000000000018004b000000e10000c13d000000000006004b000000f20000613d000000000252034f0000000305600210000000000601043300000000065601cf000000000656022f000000000202043b0000010005500089000000000252022f00000000025201cf000000000262019f00000000002104350000000701400029000000000001043500000004020000290000006001200039000b00000001001d000000030400002900000000004104350000004001200039000c00000001001d0000000000310435000004b70100004100000000001004430000000001000414000004700010009c0000047001008041000000c001100210000004b8011001c70000800b0200003911bd11b80000040f000000010020019000000bed0000613d000000000101043b0000000402000029000400000002001d0000008002200039000900000002001d000000000012043500000004010000390000000101100367000000000101043b000000000010043f0000000101000039000a00000001001d000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f000000040300002900000001002001900000085f0000613d000000000101043b000800000001001d0000000001030433000500000001001d0000000021010434000600000002001d000700000001001d000004a90010009c000003960000213d0000000801000029000000000101041a000000010010019000000001021002700000007f0220618f000400000002001d0000001f0020008c00000000020000390000000102002039000000000121013f0000000100100190000001990000c13d0000000401000029000000200010008c000001520000413d0000000801000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d00000007030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000004010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b000001520000813d000000000002041b0000000102200039000000000012004b0000014e0000413d00000007010000290000001f0010008c00000ee50000a13d0000000801000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000200200008a0000000702200180000000000101043b00000ef20000c13d000000200300003900000eff0000013d0000000001000416000000000001004b0000085f0000c13d00000000060004110000047101000041000000000061041b0000000001000414000004700010009c0000047001008041000000c00110021000000472011001c70000800d0200003900000003030000390000047304000041000000000500001911bd11b30000040f00000001002001900000085f0000613d0000000201000039000000000201041a000000010320019000000001022002700000007f0220618f0000001f0020008c00000000040000390000000104002039000000000043004b000001990000c13d000000200020008c0000018c0000413d00000474030000410000001f022000390000000502200270000004750220009a000000000003041b0000000103300039000000000023004b000001880000413d0000047602000041000000000021041b0000000301000039000000000201041a000000010020019000000001012002700000007f0110618f0000001f0010008c00000000030000390000000103002039000000000232013f0000000100200190000002170000613d000004f801000041000000000010043f0000002201000039000000040010043f000004f901000041000011bf00010430000004910030009c000001c10000213d0000049b0030009c000002330000a13d0000049c0030009c0000029d0000213d0000049f0030009c0000037e0000613d000004a00030009c0000085f0000c13d000000640020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000402100370000000000202043b000d00000002001d000004a40020009c0000085f0000213d0000047102000041000000000202041a000004a4032001970000000002000411000000000032004b000008b60000c13d0000002402100370000000000202043b0000004401100370000000000301043b0000000d0100002911bd109d0000040f0000000001000019000011be0001042e000004920030009c000002570000a13d000004930030009c000002cd0000213d000004960030009c0000039c0000613d000004970030009c0000085f0000c13d000004a5010000410000000c0010043f0000000001000411000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004b6011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000001041b0000000001000414000004700010009c0000047001008041000000c00110021000000472011001c70000800d020000390000000203000039000004c704000041000002c70000013d000004880030009c000002920000a13d000004890030009c0000030d0000213d0000048c0030009c000005c50000613d0000048d0030009c0000085f0000c13d000000240020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000401100370000000000101043b000004a40010009c0000085f0000213d0000047102000041000000000202041a0000000003000411000000000023004b000008610000c13d000000000001004b000007b70000613d0000000402000039000000000302041a000004c003300197000000000113019f000000000012041b0000000001000019000011be0001042e0000047e0030009c000003670000213d000004810030009c000007ff0000613d000004820030009c0000085f0000c13d000000240020008c0000085f0000413d0000000401100370000000000101043b000004a40010009c0000085f0000213d0000047102000041000000000202041a0000000003000411000000000023004b000008610000c13d000000000001004b0000098e0000c13d000004a701000041000000000010043f000004a801000041000011bf000104300000001f0010008c000002210000a13d00000477020000410000001f011000390000000501100270000004780110009a000000000002041b0000000102200039000000000012004b0000021d0000413d00000479010000410000000302000039000000000012041b0000000001000411000000000010043f000000200000043f0000004002000039000000000100001911bd119e0000040f000000000301041a000005000230019700000001022001bf000000000021041b0000002001000039000001000010044300000120000004430000047a01000041000011be0001042e000004a10030009c000006370000613d000004a20030009c000005db0000613d000004a30030009c0000085f0000c13d0000000001000416000000000001004b0000085f0000c13d0000000203000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f0000000100500190000001990000c13d000000800010043f000000000004004b000008650000613d000000000030043f000000000001004b000005d90000613d00000474030000410000000004000019000000000503041a000000a002400039000000000052043500000001033000390000002004400039000000000014004b0000024f0000413d0000086a0000013d000004980030009c0000064b0000613d000004990030009c000005fb0000613d0000049a0030009c0000085f0000c13d000000840020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000004403100370000000000303043b000c00000003001d0000002403100370000000000303043b000b00000003001d0000000403100370000000000303043b000d00000003001d0000006403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d000900040030003d0000000901100360000000000101043b000a00000001001d000004a90010009c0000085f0000213d0000000a013000290000002401100039000000000021004b0000085f0000213d0000000d01000029000000000010043f0000000101000039000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b0000000401100039000000000101041a000000000001004b0000091a0000c13d000004f701000041000000000010043f000004c901000041000011bf000104300000048e0030009c000007bb0000613d0000048f0030009c000007840000613d000004900030009c0000085f0000c13d0000000001000416000000000001004b0000085f0000c13d0000047101000041000005ff0000013d0000049d0030009c000003ff0000613d0000049e0030009c0000085f0000c13d000004a5010000410000000c0010043f0000000001000411000000000010043f000004b70100004100000000001004430000000001000414000004700010009c0000047001008041000000c001100210000004b8011001c70000800b0200003911bd11b80000040f000000010020019000000bed0000613d000000000101043b000d00000001001d0000000001000414000004700010009c0000047001008041000000c001100210000004b6011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b0000000d02000029000004d70220009a000000000021041b0000000001000414000004700010009c0000047001008041000000c00110021000000472011001c70000800d020000390000000203000039000004d804000041000000000500041111bd11b30000040f00000001002001900000085f0000613d0000000001000019000011be0001042e000004940030009c000005ba0000613d000004950030009c0000085f0000c13d000000640020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000000403100370000000000303043b000900000003001d000004a40030009c0000085f0000213d0000002403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000441034f000000000404043b000d00000004001d000004a90040009c0000085f0000213d00000024043000390000000d030000290000000503300210000800000004001d000c00000003001d000a00000043001d0000000a0020006b0000085f0000213d0000004403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000141034f000000000101043b000700000001001d000004a90010009c0000085f0000213d000000240130003900000007030000290000000503300210000400000001001d000600000003001d000500000013001d000000050020006b0000085f0000213d0000047101000041000000000101041a000004a4011001970000000002000411000000000012004b000009f20000c13d000000800100003900000a030000013d0000048a0030009c000006040000613d0000048b0030009c0000085f0000c13d000000440020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000402100370000000000202043b000004a40020009c0000085f0000213d0000002401100370000000000301043b000000000003004b0000000001000039000000010100c039000d00000003001d000000000013004b0000085f0000c13d0000047101000041000000000101041a0000000003000411000000000013004b000008610000c13d000000000002004b000007b70000613d000000000020043f000000200000043f0000004002000039000000000100001911bd119e0000040f000000000201041a00000500022001970000000d022001af000000000021041b0000000001000019000011be0001042e000004840030009c0000083f0000613d000004850030009c0000085f0000c13d000000240020008c0000085f0000413d0000000401100370000000000101043b000d00000001001d000004a40010009c0000085f0000213d0000047101000041000000000101041a0000000002000411000000000012004b000008610000c13d000004a5010000410000000c0010043f0000000d01000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004b6011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000b00000001001d000000000101041a000c00000001001d000004b70100004100000000001004430000000001000414000004700010009c0000047001008041000000c001100210000004b8011001c70000800b0200003911bd11b80000040f000000010020019000000bed0000613d000000000101043b0000000c0010006c0000098b0000a13d000004b901000041000000000010043f000004a801000041000011bf000104300000047f0030009c000008560000613d000004800030009c0000085f0000c13d000000240020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000401100370000000000101043b000004a40010009c0000085f0000213d000004a5020000410000000c0020043f000000000010043f0000000c01000039000000200200003911bd119e0000040f000000000101041a000000800010043f000004a601000041000011be0001042e000000240020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000401100370000000000101043b000d00000001001d000000000010043f0000000101000039000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000701043b000000400600043d000004e00060009c000008870000413d000004f801000041000000000010043f0000004101000039000000040010043f000004f901000041000011bf00010430000000440020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000000403100370000000000403043b000004a90040009c0000085f0000213d0000002303400039000000000023004b0000085f0000813d000c00040040003d0000000c03100360000000000303043b000004a90030009c0000085f0000213d000000050530021000000000045400190000002404400039000000000024004b0000085f0000213d0000002404100370000000000504043b000004a90050009c0000085f0000213d0000002304500039000000000024004b0000085f0000813d000b00040050003d0000000b01100360000000000401043b000004a90040009c0000085f0000213d000000050640021000000000016500190000002401100039000000000021004b0000085f0000213d000000000034004b00000aa70000c13d0000000002060019000000800040043f000000a001600039000000400010043f000000000004004b000003e80000613d0000000003020019000d00000003001d0000000c013000290000000101100367000000000101043b0000006001100210000004ab011001c7000000200010043f0000000b013000290000000101100367000000000101043b000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a0000000d0300002900000080023000390000000000120435000000200330008c000003cc0000c13d000000400100043d00000020020000390000000002210436000000800300043d00000000003204350000004002100039000000000003004b000003f60000613d000000a0040000390000000005000019000000004604043400000000026204360000000105500039000000000035004b000003f10000413d0000000002120049000004700020009c00000470020080410000006002200210000004700010009c00000470010080410000004001100210000000000112019f000011be0001042e000000840020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000000403100370000000000303043b000d00000003001d000004a40030009c0000085f0000213d0000002403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000441034f000000000404043b000c00000004001d000004a90040009c0000085f0000213d00000024043000390000000c030000290000000503300210000800000004001d000a00000003001d000900000043001d000000090020006b0000085f0000213d0000004403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000441034f000000000404043b000700000004001d000004a90040009c0000085f0000213d000000240330003900000007040000290000000504400210000400000003001d000600000004001d000500000034001d000000050020006b0000085f0000213d0000006403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d000200040030003d0000000201100360000000000101043b000300000001001d000004a90010009c0000085f0000213d0000000301300029000100240010003d000000010020006b0000085f0000213d0000047101000041000000000101041a000004a4011001970000000002000411000000000012004b0000045a0000613d0000000001000411000000000010043f000000200000043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000ff00100190000008c50000613d0000000d0000006b000007b70000613d000000400100043d000b00000001001d00000007020000290000000c0020006b00000ac10000c13d0000000a010000290000003f01100039000004c2011001970000000b021000290000000b0020006c00000000010000390000000101004039000004a90020009c000003960000213d0000000100100190000003960000c13d0000000001000031000000400020043f0000000b020000290000000c030000290000000000320435000000090010006b0000085f0000213d0000000c0000006b00000008050000290000000906000029000004800000613d00000001020003670000000b03000029000000000452034f000000000404043b000000200330003900000000004304350000002005500039000000000065004b000004790000413d00000006020000290000003f02200039000004c202200197000000400300043d0000000002230019000900000003001d000000000032004b00000000030000390000000103004039000004a90020009c000003960000213d0000000100300190000003960000c13d000000400020043f00000009020000290000000c030000290000000000320435000000050010006b0000085f0000213d0000000c0000006b00000004050000290000000506000029000004a00000613d00000001020003670000000903000029000000000452034f000000000404043b000000200330003900000000004304350000002005500039000000000065004b000004990000413d00000003020000290000001f02200039000004ff022001970000003f02200039000004ff02200197000000400400043d0000000002240019000800000004001d000000000042004b00000000040000390000000104004039000004a90020009c000003960000213d0000000100400190000003960000c13d000000400020043f000000080200002900000003040000290000000002420436000000010010006b0000085f0000213d0000000301000029000004ff031001980000001f0410018f0000000001320019000000020500002900000020055000390000000105500367000004c30000613d000000000605034f0000000007020019000000006806043c0000000007870436000000000017004b000004bf0000c13d000000000004004b000004d00000613d000000000335034f0000000304400210000000000501043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f000000000031043500000003012000290000000000010435000000090100002900000000010104330000000b020000290000000002020433000000000012004b00000aa70000c13d0000000d010000290000006001100212000009ea0000613d000004ab011001c7000000200010043f0000000b0900002900000000010904330000000503100212000004fc0000613d0000000001930019000c00000003001d00000009023000290000000002020433000a00000002001d0000000001010433000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000201041a0000000a03000029000000000032001a00000ff00000413d0000000002320019000000000021041b0000000c03000029000000200330008c0000000b09000029000004e10000c13d000000400100043d0000004002000039000000000321043600000000020904330000000502200210000000200420003a0000050c0000613d0000004005100039000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b000005050000413d00000060052000390000000000530435000000090900002900000000030904330000000503300210000000200430003a0000051c0000613d0000000005150019000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b000005150000413d000000000232001900000080022000390000006003200210000004c30020009c000004c403008041000004700010009c00000470010080410000004001100210000000000113019f0000000002000414000004700020009c0000047002008041000000c0022002100000000001210019000004c50110009a0000800d020000390000000403000039000004c604000041000000000500041100000000060000190000000d0700002911bd11b30000040f00000001002001900000085f0000613d000004af0100004100000000001004430000000d0100002900000004001004430000000001000414000004700010009c0000047001008041000000c001100210000004b0011001c7000080020200003911bd11b80000040f000000010020019000000bed0000613d000000000101043b000000000001004b000002cb0000613d000000400300043d0000006001300039000000a0020000390000000000210435000000200130003900000000020004110000000000210435000004d5010000410000000000130435000c00000003001d000000400130003900000000000104350000000b0700002900000000010704330000000501100210000000200210003a0000055f0000613d0000000c03000029000000c003300039000000000400001900000000054300190000000006740019000000000606043300000000006504350000002004400039000000000024004b000005580000413d000000c0021000390000000c04000029000000800340003900000000002304350000000002410019000000090900002900000000030904330000000503300210000000200430003a000005720000613d000000e005200039000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b0000056b0000413d0000000001310019000000e0011000390000000c04000029000000a0044000390000000000140435000000000123001900000008080000290000000002080433000000200320003a000005850000613d0000010004100039000000000500001900000000065400190000000007850019000000000707043300000000007604350000002005500039000000000035004b0000057e0000413d0000000c03000029000000000131004900000000012100190000010401100039000004700010009c000004700100804100000060011002100000001c02300039000004700020009c00000470020080410000004002200210000000000121019f0000000002000414000004700020009c0000047002008041000000c002200210000000000112019f0000000d0200002911bd11b30000040f00000060031002700000047003300197000000200030008c000000200400003900000000040340190000001f0540018f00000020064001900000000c04600029000005a70000613d000000000701034f0000000c08000029000000007907043c0000000008980436000000000048004b000005a30000c13d000000000005004b000005b40000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000f650000613d0000000c01000029000007800000013d000000240020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000401100370000000000101043b000000000010043f0000000501000039000000200010043f0000087d0000013d0000000001000416000000000001004b0000085f0000c13d0000000303000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f0000000100500190000001990000c13d000000800010043f000000000004004b000008650000613d000000000030043f000000000001004b000008ce0000c13d00000080020000390000086a0000013d000000240020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000401100370000000000101043b000004fa001001980000085f0000c13d000000e003100270000004fb0030009c00000000020000390000000102006039000004a20030009c00000001022061bf0000049f0030009c00000001022061bf000004a20030009c000005f50000613d0000049f0030009c000005f50000613d000004fb0030009c000005f50000613d000004fc0010009c00000000020000390000000102006039000004fd0010009c00000001022061bf000000010120018f000000800010043f000004a601000041000011be0001042e0000000001000416000000000001004b0000085f0000c13d0000000401000039000000000101041a000004a401100197000000800010043f000004a601000041000011be0001042e000000440020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000402100370000000000202043b000d00000002001d000004a40020009c0000085f0000213d0000002401100370000000000201043b000000000002004b0000000001000039000000010100c039000c00000002001d000000000012004b0000085f0000c13d000004ab01000041000000200010043f0000000001000411000000140010043f0000000d01000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004ad011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b0000000c02000029000000000021041b000000000020043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c70000800d020000390000000303000039000004bf0400004100000000050004110000000d0600002911bd11b30000040f00000001002001900000085f0000613d000002cb0000013d000000440020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000402100370000000000302043b000004a40030009c0000085f0000213d0000002401100370000000000201043b000000000103001911bd10530000040f000000400200043d0000000000120435000004700020009c00000470020080410000004001200210000004fe011001c7000011be0001042e000000a40020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000000403100370000000000303043b000700000003001d000004a40030009c0000085f0000213d0000002403100370000000000303043b000600000003001d000004a40030009c0000085f0000213d0000004403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d000a00040030003d0000000a04100360000000000404043b000c00000004001d000004a90040009c0000085f0000213d00000024043000390000000c030000290000000503300210000500000003001d000b00000004001d0000000003430019000000000023004b0000085f0000213d0000006403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d000900040030003d0000000904100360000000000404043b000800000004001d000004a90040009c0000085f0000213d0000000804000029000000050440021000000000034300190000002403300039000000000023004b0000085f0000213d0000008403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000141034f000000000101043b000400000001001d000004a90010009c0000085f0000213d0000002403300039000300000003001d0000000401300029000000000021004b0000085f0000213d0000000c0000006b00000c110000c13d00000008020000290000000c0020006b00000aa70000c13d00000007010000290000006001100210000004ab011001c7000800000001001d000000200010043f0000000601000029000204a40010019c000009ea0000613d0000000701000029000104a40010019b0000000001000411000000010010006c00000e130000c13d0000000c0000006b00000e7a0000c13d000000400100043d00000040021000390000000c030000290000000000320435000000400200003900000000032104360000000504000029000d001f004001930000000a02000029000b00200020003d0000000102000367000000000004004b000006bc0000613d000000600410003900000005054000290000000b06200360000000006706043c0000000004740436000000000054004b000006b80000c13d0000000d0000006b000000050500002900000060045000390000000000430435000000000351001900000060043000390000000c0600002900000000006404350000000904000029000a00200040003d000000000005004b000006cf0000613d0000000a0220036000000080033000390000000504300029000000002502043c0000000003530436000000000043004b000006cb0000c13d0000000d0000006b0000000c020000290000000602200210000900000002001d00000080022000390000006003200210000004c50330009a000004c30020009c000004d403008041000004700010009c00000470010080410000004001100210000000000131019f0000000002000414000004700020009c0000047002008041000000c00220021000000000012100190000800d020000390000000403000039000004c60400004100000000050004110000000106000029000000020700002911bd11b30000040f00000001002001900000085f0000613d000004af010000410000000000100443000000020100002900000004001004430000000001000414000004700010009c0000047001008041000000c001100210000004b0011001c7000080020200003911bd11b80000040f000000010020019000000bed0000613d000000000101043b000000000001004b000002cb0000613d0000000201000029000000000010043f000000400300043d000000c0013000390000000c0200002900000000002104350000006001300039000000a0020000390000000000210435000000400130003900000001020000290000000000210435000000200130003900000000020004110000000000210435000004d501000041000800000003001d00000000001304350000000101000367000000050000006b000007170000613d0000000802000029000000e00220003900000005032000290000000b04100360000000004504043c0000000002520436000000000032004b000007130000c13d0000000d0000006b0000000504000029000000c0024000390000000805000029000000800350003900000000002304350000000002450019000000e0032000390000000c050000290000000000530435000000000004004b0000072a0000613d0000000a0310036000000100042000390000000505400029000000003603043c0000000004640436000000000054004b000007260000c13d0000000d0000006b0000000903000029000000e0033000390000000804000029000000a004400039000000000034043500000005052000290000010002500039000000040400002900000000004204350000000302100360000004ff034001980000001f0440018f000001200550003900000000013500190000073f0000613d000000000602034f000000006706043c0000000005750436000000000015004b0000073b0000c13d000000000004004b0000074c0000613d000000000232034f0000000303400210000000000401043300000000043401cf000000000434022f000000000202043b0000010003300089000000000232022f00000000023201cf000000000242019f0000000000210435000000090200002900000004012000290000010401100039000004700010009c00000470010080410000006001100210000000400200043d0000001c02200039000004700020009c00000470020080410000004002200210000000000112019f000000000200043d0000000003000414000004700030009c0000047003008041000000c003300210000000000131019f11bd11b30000040f00000060031002700000047003300197000000200030008c000000200400003900000000040340190000001f0540018f000000200640019000000008046000290000076e0000613d000000000701034f0000000808000029000000007907043c0000000008980436000000000048004b0000076a0000c13d000000000005004b0000077b0000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000ecb0000613d00000008010000290000000001010433000004d60010009c000002cb0000613d00000be90000013d000000840020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000000403100370000000000303043b000d00000003001d000004a40030009c0000085f0000213d0000006403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d0000000404300039000000000141034f000000000101043b000c00000001001d000004a90010009c0000085f0000213d0000002403300039000b00000003001d0000000c01300029000000000021004b0000085f0000213d0000047101000041000000000101041a000004a4021001970000000001000411000000000021004b000007b50000613d000000000010043f000000200000043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000ff00100190000008c50000613d0000000d0000006b000009910000c13d000004de01000041000000000010043f000004c901000041000011bf000104300000047101000041000000000101041a0000000005000411000000000015004b000008610000c13d0000000001000414000004700010009c0000047001008041000000c00110021000000472011001c70000800d0200003900000003030000390000047304000041000000000600001911bd11b30000040f00000001002001900000085f0000613d0000047101000041000000000001041b0000000001000019000011be0001042e000000440020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000002402100370000000000202043b000d00000002001d0000000401100370000000000201043b000004ab01000041000000200010043f0000000001000411000000140010043f000c00000002001d000000000020043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a0000000d03000029000000000031004b000008c90000813d000000400100043d0000004402100039000004bc030000410000000000320435000000240210003900000012030000390000000000320435000004bd020000410000000000210435000000040210003900000020030000390000000000320435000004700010009c00000470010080410000004001100210000004be011001c7000011bf00010430000000a40020008c0000085f0000413d0000000003000416000000000003004b0000085f0000c13d0000000403100370000000000303043b000d00000003001d000004a40030009c0000085f0000213d0000002403100370000000000303043b000c00000003001d000004a40030009c0000085f0000213d0000006403100370000000000303043b000a00000003001d0000004403100370000000000303043b000b00000003001d0000008403100370000000000303043b000004a90030009c0000085f0000213d0000002304300039000000000024004b0000085f0000813d000800040030003d0000000801100360000000000101043b000900000001001d000004a90010009c0000085f0000213d00000009013000290000002401100039000000000021004b0000085f0000213d0000000b01000029000000000010043f0000000101000039000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b0000000c0000006b000009e00000613d0000000d0000006b000009e00000613d0000000301100039000000000101041a000000ff00100190000009e00000613d000004d101000041000000000010043f000004c901000041000011bf00010430000000440020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000402100370000000000202043b000004a40020009c0000085f0000213d0000002401100370000000000101043b000004a40010009c0000085f0000213d000004ab03000041000000200030043f000000140020043f000000000010043f0000000c01000039000000340200003911bd119e0000040f000000000101041a000000000001004b000008820000013d000000240020008c0000085f0000413d0000000002000416000000000002004b0000085f0000c13d0000000401100370000000000101043b000004a40010009c0000087b0000a13d0000000001000019000011bf00010430000004c101000041000000000010043f000004a801000041000011bf000104300000050002200197000000a00020043f000000000001004b000000a0020000390000008002006039000000600220008a000000800100003911bd101f0000040f000000400100043d000d00000001001d000000800200003911bd103e0000040f0000000d020000290000000001210049000004700010009c00000470010080410000006001100210000004700020009c00000470020080410000004002200210000000000121019f000011be0001042e000000000010043f000000200000043f0000004002000039000000000100001911bd119e0000040f000000000101041a000000ff001001900000000001000039000000010100c039000000800010043f000004a601000041000011be0001042e000000a008600039000000400080043f000000000107041a000000010210019000000001041002700000007f0440618f0000001f0040008c00000000030000390000000103002039000000000331013f0000000100300190000001990000c13d0000000000480435000000000002004b000008d80000613d000900000004001d000a00000008001d000b00000006001d000c00000007001d000000000070043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d0000000909000029000000000009004b00000000020000190000000b060000290000000c070000290000000a08000029000008de0000613d000000c003600039000000000101043b00000000020000190000000004230019000000000501041a000000000054043500000001011000390000002002200039000000000092004b000008ae0000413d000008de0000013d000000000020043f000000200000043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000ff00100190000009180000c13d000004df01000041000000000010043f000004c901000041000011bf0001043000000000010004110000000c0200002911bd109d0000040f0000000001000019000011be0001042e00000477030000410000000004000019000000000503041a000000a002400039000000000052043500000001033000390000002004400039000000000014004b000008d00000413d0000086a0000013d0000050001100197000000c0026000390000000000120435000000000004004b000000200200003900000000020060390000003f01200039000004ff021001970000000001820019000000000021004b00000000020000390000000102004039000004a90010009c000003960000213d0000000100200190000003960000c13d000000400010043f00000000058604360000000101700039000000000201041a000000010320019000000001082002700000007f0880618f0000001f0080008c00000000040000390000000104002039000000000442013f0000000100400190000001990000c13d000700000005001d000c00000007001d000b00000006001d000000400400043d000a00000004001d000900000008001d0000000004840436000800000004001d000000000003004b0000099f0000613d000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d0000000905000029000000000005004b00000000020000190000000806000029000009a50000613d000000000101043b00000000020000190000000003260019000000000401041a000000000043043500000001011000390000002002200039000000000052004b000009100000413d000009a50000013d0000000101000367000001b90000013d0000000c01000029000000000010043f0000000501000039000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000ff00100190000009ee0000c13d0000000c01000029000000000010043f0000000501000039000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000201041a000005000220019700000001022001bf000000000021041b00000000010004100000006003100210000000400100043d00000020021000390000000000320435000000000300041100000060033002100000003404100039000000000034043500000088031000390000000c04000029000000000043043500000068031000390000000b04000029000000000043043500000048031000390000000d04000029000000000043043500000088030000390000000000310435000004ca0010009c000003960000213d000000c003100039000000400030043f000004700020009c000004700200804100000040022002100000000001010433000004700010009c00000470010080410000006001100210000000000121019f0000000002000414000004700020009c0000047002008041000000c002200210000000000112019f00000472011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000200010043f000004cb01000041000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004cc011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000400200043d000c00000002001d000000000101043b0000000a02000029000000400020008c00000cef0000613d0000000a02000029000000410020008c00000d270000c13d000000090400002900000060024000390000000102200367000000000202043b000000f802200270000000200020043f000000200240003900000001022003670000004003000039000000002402043c0000000003430436000000800030008c000009860000c13d00000cfc0000013d0000000b01000029000000000001041b0000000d0100002911bd11870000040f0000000001000019000011be0001042e00000000030000310000000b010000290000000c0200002911bd10650000040f00000001020003670000004403200370000000000303043b0000002402200370000000000202043b00000000040100190000000d0100002911bd10ca0000040f0000000001000019000011be0001042e000005000120019700000008020000290000000000120435000000090000006b000000200200003900000000020060390000003f01200039000004ff021001970000000a01200029000000000021004b00000000020000390000000102004039000004a90010009c0000000c03000029000003960000213d0000000100200190000003960000c13d000000400010043f00000007010000290000000a0200002900000000002104350000000201300039000000000201041a000000010320019000000001042002700000007f0440618f000a00000004001d0000001f0040008c00000000040000390000000104002039000000000442013f0000000100400190000001990000c13d000000400400043d000900000004001d0000000a050000290000000004540436000800000004001d000000000003004b00000ae50000613d000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d0000000a05000029000000000005004b0000000002000019000000080600002900000aeb0000613d000000000101043b00000000020000190000000003260019000000000401041a000000000043043500000001011000390000002002200039000000000052004b000009d80000413d00000aeb0000013d0000000d010000290000006001100210000004ab011001c7000000200010043f0000000c010000290000006001100210000004ab011001c7000700000001001d000004ac0010009c00000aab0000813d000004dd01000041000000000010043f000004a801000041000011bf00010430000004c801000041000000000010043f000004c901000041000011bf000104300000000001000411000000000010043f000000200000043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000ff00100190000008c50000613d000000400100043d000b00000001001d00000007020000290000000d0020006b00000ac10000c13d0000000c010000290000003f01100039000004c2011001970000000b021000290000000b0020006c00000000010000390000000101004039000004a90020009c000003960000213d0000000100100190000003960000c13d0000000001000031000000400020043f0000000b020000290000000d0300002900000000003204350000000a0010006b0000085f0000213d0000000d0000006b00000008050000290000000a0600002900000a260000613d00000001020003670000000b03000029000000000452034f000000000404043b000000200330003900000000004304350000002005500039000000000065004b00000a1f0000413d00000006020000290000003f02200039000004c202200197000000400300043d0000000002230019000a00000003001d000000000032004b00000000030000390000000103004039000004a90020009c000003960000213d0000000100300190000003960000c13d000000400020043f0000000a020000290000000d030000290000000000320435000000050010006b0000085f0000213d0000000d0000006b000000000100001900000a480000613d000000040400002900000001014003670000000a0200002900000005050000290000002002200039000000001301043c00000000003204350000002004400039000000000054004b00000a400000413d0000000a0100002900000000010104330000000b020000290000000002020433000000000012004b00000aa70000c13d00000009010000290000006001100210000004ab011001c7000000200010043f0000000b090000290000000001090433000000050310021200000a6d0000613d0000000001930019000c00000003001d0000000a023000290000000002020433000d00000002001d0000000001010433000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000201041a0000000d0220006c00000ae10000413d000000000021041b0000000c03000029000000200330008c0000000b0900002900000a540000c13d000000400100043d0000004002000039000000000321043600000000020904330000000502200210000000200420003a00000a7d0000613d0000004005100039000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b00000a760000413d000000600520003900000000005304350000000a0900002900000000030904330000000503300210000000200430003a00000a8d0000613d0000000005150019000000000600001900000000076500190000000008960019000000000808043300000000008704350000002006600039000000000046004b00000a860000413d000000000232001900000080022000390000006003200210000004c30020009c000004c403008041000004700010009c00000470010080410000004001100210000000000113019f0000000002000414000004700020009c0000047002008041000000c0022002100000000001210019000004c50110009a0000000902000029000004a4062001970000800d020000390000000403000039000004c6040000410000000005000411000000000700001911bd11b30000040f0000000100200190000002cb0000c13d0000085f0000013d000004da01000041000000000010043f000004a801000041000011bf0001043000000000020004110000000d0020006c00000ad20000613d0000000001000411000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004ad011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000000001004b00000ad20000c13d000004d201000041000000000010043f000004a801000041000011bf000104300000000b030000290000004401300039000004d9020000410000000000210435000000240130003900000008020000390000000000210435000004bd010000410000000000130435000000040130003900000020020000390000000000210435000004700030009c00000470030080410000004001300210000004be011001c7000011bf000104300000000b01000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000201041a0000000a0220006c00000b510000813d000004d301000041000000000010043f000004a801000041000011bf000104300000050001200197000000080200002900000000001204350000000a0000006b000000200200003900000000020060390000003f01200039000004ff021001970000000901200029000000000021004b00000000020000390000000102004039000004a90010009c0000000b040000290000000c05000029000003960000213d0000000100200190000003960000c13d000000400010043f0000004003400039000000090100002900000000001304350000000301500039000000000101041a000000ff001001900000000002000039000000010200c0390000006001400039000000000021043500000080024000390000000404500039000000000404041a0000000000420435000000000004004b0000028e0000613d000000400500043d0000000b0200002900000000060204330000000002060433000000000002004b00000b410000c13d000000a002500039000000400020043f000000800250003900000000000204350000000d080000290000000004020019000000090080008c0000000a2880011a000000f806200210000000010240008a0000000007020433000004e107700197000000000667019f000004e2066001c7000000000062043500000b130000213d00000000054500490000008105500039000000210440008a0000000000540435000000400600043d0000002005600039000004e307000041000000000075043500000027056000390000000004040433000000000004004b00000b320000613d000000000700001900000000085700190000000009270019000000000909043300000000009804350000002007700039000000000047004b00000b2b0000413d00000000025400190000000000020435000000070240003900000000002604350000004602400039000004ff022001970000000005620019000000000025004b00000000020000390000000102004039000004a90050009c000003960000213d0000000100200190000003960000c13d000000400050043f000000070200002900000000040204330000000002040433000000000002004b00000c030000c13d000004e40050009c000003960000213d0000004002500039000000400020043f0000002002500039000004e50400004100000000004204350000000f020000390000000000250435000000400200043d00000c050000013d000000000021041b0000000701000029000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000201041a0000000a0020002a00000ff00000413d0000000a030000290000000002320019000000000021041b000000200030043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c70000800d020000390000000403000039000004ae0400004100000000050004110000000d060000290000000c0700002911bd11b30000040f00000001002001900000085f0000613d000004af0100004100000000001004430000000c0100002900000004001004430000000001000414000004700010009c0000047001008041000000c001100210000004b0011001c7000080020200003911bd11b80000040f000000010020019000000bed0000613d000000000101043b000000000001004b000002cb0000613d000000400400043d000000a001400039000000a002000039000000000021043500000080014000390000000a02000029000000000021043500000060014000390000000b02000029000000000021043500000040014000390000000d020000290000000000210435000000200140003900000000020004110000000000210435000004b1010000410000000000140435000000c00140003900000009030000290000000000310435000004ff023001980000001f0330018f000700000004001d000000e005400039000000000125001900000008040000290000002004400039000000010440036700000ba60000613d000000000604034f000000006706043c0000000005750436000000000015004b00000ba20000c13d000000000003004b00000bb30000613d000000000224034f0000000303300210000000000401043300000000043401cf000000000434022f000000000202043b0000010003300089000000000232022f00000000023201cf000000000242019f00000000002104350000000901000029000004b20010009c000004b201008041000000600110021000000007020000290000001c02200039000004700020009c00000470020080410000004002200210000000000121019f0000000002000414000004700020009c0000047002008041000000c002200210000000000121019f000004b30110009a0000000c0200002911bd11b30000040f00000060031002700000047003300197000000200030008c000000200400003900000000040340190000001f0540018f0000002006400190000000070460002900000bd40000613d000000000701034f0000000708000029000000007907043c0000000008980436000000000048004b00000bd00000c13d000000000005004b00000be10000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000ead0000613d00000007010000290000000001010433000004b50010009c000002cb0000613d000004dc01000041000000000010043f000004a801000041000011bf00010430000000000001042f000000000010043f000000200000043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000ff00100190000008c50000613d000000400100043d000400000001001d000004ba0010009c000003960000213d0000000002000031000000630000013d0000000002050019000000000504001900000000040304330000000037040434000000000007004b00000c310000c13d000004e70020009c000003960000213d0000002003200039000000400030043f0000000000020435000000400300043d000d00000003001d00000c510000013d000000070000006b00000d3b0000613d000000060000006b00000d3b0000613d0000000002000019000d00000002001d00000005012002100000000b011000290000000101100367000000000101043b000000000010043f0000000101000039000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b0000000301100039000000000101041a000000ff001001900000083b0000c13d0000000d0200002900000001022000390000000c0020006c00000c160000413d000006960000013d0000002007200039000004e608000041000000000087043500000027072000390000000004040433000000000004004b00000c400000613d00000000080000190000000009780019000000000a830019000000000a0a04330000000000a904350000002008800039000000000048004b00000c390000413d00000000037400190000000000030435000000070340003900000000003204350000004603400039000004ff033001970000000004230019000000000034004b00000000030000390000000103004039000d00000004001d000004a90040009c000003960000213d0000000100300190000003960000c13d0000000d03000029000000400030043f000004e808000041000000150080043f0000000d0300002900000020043000390000000003060433000000000003004b000000000904001900000d520000c13d00000000070904360000000d060000290000000003690049000000200330008a0000000000360435000c00000007001d000000400070043f000000150080043f00000040069000390000000003050433000000000003004b000000000806001900000d910000c13d000000000a0804360000000003980049000000400330008a0000000c0500002900000000003504350000004000a0043f000004e803000041000000150030043f00000040058000390000000003020433000000000003004b000000000b05001900000dd00000c13d00000000090b043600000000028b0049000000400220008a00000000002a0435000000400090043f0000006002b00039000004a90020009c000003960000213d000000000092004b000003960000413d0000000001010433000000400020043f000000000001004b0000000301000039000000020100603900000000001904350000004008b00039000004ec01000041000004eb010060410000000000180435000000400200043d0000002001200039000004ed0300004100000000003104350000002103200039000004ee070000410000000000730435000000290b2000390000000d030000290000000003030433000000000003004b00000c9b0000613d0000000007000019000000000cb70019000000000d470019000000000d0d04330000000000dc04350000002007700039000000000037004b00000c940000413d0000000004b30019000000000004043500000000032300190000002904300039000004ef0700004100000000007404350000003a0b3000390000000c040000290000000004040433000000000004004b00000cae0000613d0000000007000019000000000cb70019000000000d670019000000000d0d04330000000000dc04350000002007700039000000000047004b00000ca70000413d0000000006b40019000000000006043500000000033400190000003a04300039000004f00600004100000000006404350000004506300039000000290330003900000000040a0433000000000004004b00000cc10000613d0000000007000019000000000a670019000000000b570019000000000b0b04330000000000ba04350000002007700039000000000047004b00000cba0000413d0000000005640019000000000005043500000000034300190000001c04300039000004f10500004100000000005404350000002b0530003900000011033000390000000004090433000000000004004b00000cd40000613d000000000600001900000000075600190000000009860019000000000909043300000000009704350000002006600039000000000046004b00000ccd0000413d0000000005540019000000000005043500000000034300190000001a04300039000004f20500004100000000005404350000000003230049000000040430008a00000000004204350000003b03300039000004ff043001970000000003240019000000000043004b00000000040000390000000104004039000004a90030009c000003960000213d0000000100400190000003960000c13d000000400030043f0000000005020433000000000005004b00000e220000c13d00000060020000390000008001000039000000000403001900000e650000013d000000090500002900000040025000390000000102200367000000000202043b000000ff042002700000001b04400039000000200040043f00000020045000390000000103400367000000000303043b000000400030043f000004cd02200197000000600020043f000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004ce011001c7000000010200003911bd11b80000040f000000010900003900000060031002700000047003300197000000200030008c000000200400003900000000040340190000001f0540018f000000200640019000000001046001bf00000d130000613d000000000701034f000000007807043c0000000009890436000000000049004b00000d0f0000c13d000000010220018f000000000005004b00000d210000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000000001020433000000600000043f0000000c02000029000000400020043f000000000003004b00000d2b0000c13d000004d001000041000000000010043f000004a801000041000011bf000104300000000402000039000000000202041a000000000112013f000004a40010019800000e0f0000c13d00000020020000390000000c0100002911bd101f0000040f0000000c04000029000000000004043500000000010004110000000d020000290000000b0300002911bd10ca0000040f0000000001000019000011be0001042e0000000002000019000d00000002001d00000005012002100000000b011000290000000101100367000000000101043b000000000010043f0000000101000039000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d0000000d0200002900000001022000390000000c0020006c00000d3c0000413d000006960000013d0000000007630019000000000904001900000d670000013d0000370000e0019000000d7a0000613d0000000003090433000004e103300197000004e9033001c700000000003904350000000803d000390000000003030433000000f803300210000000010c900039000000000d0c0433000004e10dd0019700000000033d019f00000000003c0435000000020c00003900000000099c0019000000000076004b00000c590000613d0000000106600039000000000c060433000000ff0dc0018f000000010ed0020f0000001f00d0008c00000d550000a13d000000f80cd002100000000003090433000004e103300197000004ea00e0019800000d8d0000613d000004e9033001c700000000003904350000000103900039000000000d030433000004e10dd00197000000000ccd019f0000000000c3043500000d630000013d0000001d0300043d000004e103300197000000040dc002700000000f0dd0018f000000000d0d0433000000f80dd002100000000003d3019f0000001d0030043f0000000f03c0018f0000000003030433000000f8033002100000001e0c00043d000004e10cc0019700000000033c019f0000001e0030043f000000190300043d0000000000390435000000060c00003900000d640000013d0000000003c3019f0000000000390435000000010c00003900000d640000013d000000000a530019000000000806001900000da60000013d000037000030019000000db90000613d0000000003080433000004e103300197000004e9033001c700000000003804350000000803f000390000000003030433000000f8033002100000000107800039000000000e070433000004e10ee0019700000000033e019f0000000000370435000000020700003900000000088700190000000000a5004b00000c660000613d0000000105500039000000000e050433000000ff0fe0018f0000000103f0020f0000001f00f0008c00000d940000a13d000000f807f00210000000000e080433000004e10ee00197000004ea0030019800000dcc0000613d000004e903e001c700000000003804350000000103800039000000000e030433000004e10ee0019700000000077e019f000000000073043500000da20000013d0000001d0300043d000004e1033001970000000407e002700000000f0770018f0000000007070433000000f807700210000000000373019f0000001d0030043f0000000f03e0018f0000000003030433000000f8033002100000001e0700043d000004e107700197000000000337019f0000001e0030043f000000190300043d0000000000380435000000060700003900000da30000013d00000000037e019f0000000000380435000000010700003900000da30000013d0000000009230019000000000b05001900000de50000013d000037000030019000000df80000613d00000000030b0433000004e103300197000004e9033001c700000000003b043500000008037000390000000003030433000000f8033002100000000107b00039000000000f070433000004e10ff0019700000000033f019f00000000003704350000000207000039000000000bb70019000000000092004b00000c730000613d0000000102200039000000000f020433000000ff07f0018f000000010370020f0000001f0070008c00000dd30000a13d000000f807700210000000000f0b0433000004e10ff00197000004ea0030019800000e0b0000613d000004e903f001c700000000003b04350000000103b00039000000000f030433000004e10ff0019700000000077f019f000000000073043500000de10000013d0000001d0300043d000004e1033001970000000407f002700000000f0770018f0000000007070433000000f807700210000000000373019f0000001d0030043f0000000f03f0018f0000000003030433000000f8033002100000001e0700043d000004e107700197000000000337019f0000001e0030043f000000190300043d00000000003b0435000000060700003900000de20000013d00000000037f019f00000000003b0435000000010700003900000de20000013d000004cf01000041000000000010043f000004c901000041000011bf00010430000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004ad011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000101041a000000000001004b000006a60000c13d00000abd0000013d000004f3040000410000001f0040043f000004f4040000410000003f0040043f00000000071500190000000008070433000000000007043500000020013000390000000204500039000000030440011a00000002044002100000000009340019000000200a9000390000000006010019000000000b00043d000004e10bb001970000000302200039000000000c020433000000120dc002700000003f0dd0018f000000000d0d0433000000f80dd00210000000000bdb019f0000000000b0043f0000000c0bc002700000003f0bb0018f000000000b0b0433000000f80bb00210000000010d00043d000004e10dd00197000000000bbd019f0000000100b0043f000000060bc002700000003f0bb0018f000000000b0b0433000000f80bb00210000000020d00043d000004e10dd00197000000000bbd019f0000000200b0043f0000003f0bc0018f000000000b0b0433000000f80bb00210000000030c00043d000004e10cc00197000000000bbc019f0000000300b0043f000000000b00043d0000000000b6043500000004066000390000000000a6004b00000e300000413d00000000008704350000004002900039000000400020043f000000032050011a000000000002004b0000000005000019000000ff0220c18f000000020520c1190000000002560049000004f505000041000000000052043500000000000604350000000000430435000000400400043d00000000020300190000000005040019000d00000004001d0000002003400039000004f60400004100000000004304350000000003020433000c00000003001d0000003d0250003911bd10310000040f0000000c030000290000001d023000390000000d0100002900000000002104350000003d0230003911bd101f0000040f000000400100043d000c00000001001d0000000d0200002911bd103e0000040f0000000c02000029000008720000013d00000006010000290000006001100210000704ab001001cb000000050300002900000009013000290000000101100367000000000101043b000d00000001001d0000000801000029000000200010043f000b00000003001d0000000a013000290000000101100367000000000101043b000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000201041a0000000d0220006c00000ae10000413d000000000021041b0000000701000029000000200010043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000000101043b000000000201041a0000000d04000029000000000042001a00000ff00000413d0000000b03000029000000200330008c0000000002420019000000000021041b00000e7e0000c13d000006a80000013d0000001f0430018f000004b405300198000000070250002900000eb70000613d000000000601034f0000000707000029000000006806043c0000000007870436000000000027004b00000eb30000c13d000000000004004b00000ec40000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000000702000029000004700020009c00000470020080410000004002200210000000000121019f000011bf000104300000001f0430018f000004b405300198000000080250002900000ed50000613d000000000601034f0000000807000029000000006806043c0000000007870436000000000027004b00000ed10000c13d000000000004004b00000ee20000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001204350000006001300210000000080200002900000ec60000013d000000070000006b000000000100001900000eea0000613d0000000601000029000000000101043300000007040000290000000302400210000005010220027f0000050102200167000000000121016f0000000102400210000000000121019f00000f0d0000013d000000010320008a0000000503300270000000000431001900000020030000390000000104400039000000050600002900000000056300190000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000ef80000c13d000000070020006c00000f0a0000813d00000007020000290000000302200210000000f80220018f000005010220027f000005010220016700000005033000290000000003030433000000000223016f000000000021041b0000000701000029000000010110021000000001011001bf0000000802000029000000000012041b0000000d010000290000000001010433000d00000001001d0000000021010434000600000002001d000700000001001d000004a90010009c000003960000213d00000008010000290000000101100039000500000001001d000000000101041a000000010010019000000001021002700000007f0220618f000400000002001d0000001f0020008c00000000020000390000000102002039000000000121013f0000000100100190000001990000c13d0000000401000029000000200010008c00000f440000413d0000000501000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d00000007030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000004010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b00000f440000813d000000000002041b0000000102200039000000000012004b00000f400000413d00000007010000290000001f0010008c00000f580000a13d0000000501000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000200200008a0000000702200180000000000101043b00000f7f0000c13d000000200300003900000f8b0000013d000000070000006b000000000100001900000f5d0000613d0000000601000029000000000101043300000007040000290000000302400210000005010220027f0000050102200167000000000121016f0000000102400210000000000121019f00000f990000013d0000001f0430018f000004b4053001980000000c0250002900000f6f0000613d000000000601034f0000000c07000029000000006806043c0000000007870436000000000027004b00000f6b0000c13d000000000004004b00000f7c0000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000000c0200002900000ec60000013d000000010320008a00000005033002700000000004310019000000200300003900000001044000390000000d053000290000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000f840000c13d000000070020006c00000f960000813d00000007020000290000000302200210000000f80220018f000005010220027f00000501022001670000000d033000290000000003030433000000000223016f000000000021041b0000000701000029000000010110021000000001011001bf0000000502000029000000000012041b0000000c010000290000000001010433000d00000001001d0000000021010434000700000002001d000c00000001001d000004a90010009c000003960000213d00000008010000290000000201100039000600000001001d000000000101041a000000010010019000000001021002700000007f0220618f000500000002001d0000001f0020008c00000000020000390000000102002039000000000121013f0000000100100190000001990000c13d0000000501000029000000200010008c00000fd00000413d0000000601000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d0000000c030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000005010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b00000fd00000813d000000000002041b0000000102200039000000000012004b00000fcc0000413d0000000c010000290000001f0010008c00000fe40000a13d0000000601000029000000000010043f0000000001000414000004700010009c0000047001008041000000c001100210000004bb011001c7000080100200003911bd11b80000040f00000001002001900000085f0000613d000000200200008a0000000c02200180000000000101043b00000ff40000c13d0000002003000039000010000000013d0000000c0000006b000000000100001900000fe90000613d000000070100002900000000010104330000000c040000290000000302400210000005010220027f0000050102200167000000000121016f000a0001004002180000100d0000013d000004db01000041000000000010043f000004a801000041000011bf00010430000000010320008a00000005033002700000000004310019000000200300003900000001044000390000000d053000290000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000ff90000c13d0000000c0020006c0000100b0000813d0000000c020000290000000302200210000000f80220018f000005010220027f00000501022001670000000d033000290000000003030433000000000223016f000000000021041b0000000c0100002900000001011002100000000a011001af0000000602000029000000000012041b00000008040000290000000301400039000000000201041a00000500022001970000000b030000290000000003030433000000000003004b000000010220c1bf000000000021041b000000040140003900000009020000290000000002020433000000000021041b0000000001000019000011be0001042e0000001f02200039000004ff022001970000000001120019000000000021004b00000000020000390000000102004039000004a90010009c0000102b0000213d00000001002001900000102b0000c13d000000400010043f000000000001042d000004f801000041000000000010043f0000004101000039000000040010043f000004f901000041000011bf00010430000000000003004b0000103b0000613d000000000400001900000000052400190000000006140019000000000606043300000000006504350000002004400039000000000034004b000010340000413d00000000012300190000000000010435000000000001042d00000020030000390000000004310436000000003202043400000000002404350000004001100039000000000002004b0000104d0000613d000000000400001900000000051400190000000006430019000000000606043300000000006504350000002004400039000000000024004b000010460000413d000000000312001900000000000304350000001f02200039000004ff022001970000000001210019000000000001042d000004ab03000041000000200030043f000000140010043f000000000020043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f0000000100200190000010630000613d000000000101043b000000000101041a000000000001042d0000000001000019000011bf00010430000005020020009c000010950000813d00000000040100190000001f01200039000004ff011001970000003f01100039000004ff05100197000000400100043d0000000005510019000000000015004b00000000070000390000000107004039000004a90050009c000010950000213d0000000100700190000010950000c13d000000400050043f00000000052104360000000007420019000000000037004b0000109b0000213d000004ff062001980000001f0720018f00000001044003670000000003650019000010850000613d000000000804034f0000000009050019000000008a08043c0000000009a90436000000000039004b000010810000c13d000000000007004b000010920000613d000000000464034f0000000306700210000000000703043300000000076701cf000000000767022f000000000404043b0000010006600089000000000464022f00000000046401cf000000000474019f000000000043043500000000022500190000000000020435000000000001042d000004f801000041000000000010043f0000004101000039000000040010043f000004f901000041000011bf000104300000000001000019000011bf000104300002000000000002000200000003001d000100000001001d0000006001100210000004ab011001c7000000200010043f000000000020043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f0000000100200190000010c40000613d000000000101043b000000000201041a0000000203000029000000000232004b000010c60000413d000000000021041b000000200030043f0000000001000414000004700010009c00000470010080410000000102000029000004a406200197000000c001100210000004aa011001c70000800d0200003900000004030000390000000005000411000004ae04000041000000000700001911bd11b30000040f0000000100200190000010c40000613d000000000001042d0000000001000019000011bf00010430000004d301000041000000000010043f000004a801000041000011bf000104300005000000000002000200000004001d000500000003001d000304a40010019c0000115c0000613d000004ab03000041000000200030043f000400000001001d000000140010043f000100000002001d000000000020043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c7000080100200003911bd11b80000040f00000001002001900000115a0000613d000000000101043b000000000201041a0000000503000029000000000032001a000011830000413d0000000002320019000000000021041b000000200030043f0000000001000414000004700010009c0000047001008041000000c001100210000004aa011001c70000800d0200003900000004030000390000000005000411000004ae040000410000000006000019000000030700002911bd11b30000040f00000001002001900000115a0000613d000004af010000410000000000100443000000040100002900000004001004430000000001000414000004700010009c0000047001008041000000c001100210000004b0011001c7000080020200003911bd11b80000040f0000000100200190000011600000613d000000000101043b000000000001004b000011590000613d000000400700043d000000a001700039000000a0020000390000000000210435000000800170003900000005020000290000000000210435000000600170003900000001020000290000000000210435000000200170003900000000020004110000000000210435000004b101000041000000000017043500000040017000390000000000010435000000c003700039000000020100002900000000210104340000000000130435000000000001004b000011240000613d000000e003700039000000000400001900000000054300190000000006420019000000000606043300000000006504350000002004400039000000000014004b0000111d0000413d0000001c02700039000004700020009c00000470020080410000004002200210000000c401100039000004700010009c00000470010080410000006001100210000000000121019f0000000002000414000004700020009c0000047002008041000000c002200210000000000112019f0000000402000029000500000007001d11bd11b30000040f000000050a00002900000060031002700000047003300197000000200030008c000000200400003900000000040340190000001f0540018f000000200640019000000000046a0019000011450000613d000000000701034f00000000080a0019000000007907043c0000000008980436000000000048004b000011410000c13d000000000005004b000011520000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf0000000100200190000011610000613d00000000010a0433000004b50010009c0000117f0000c13d000000000001042d0000000001000019000011bf00010430000004dd01000041000000000010043f000004a801000041000011bf00010430000000000001042f0000001f0430018f000004b40530019800000000025a00190000116b0000613d000000000601034f0000000507000029000000006806043c0000000007870436000000000027004b000011670000c13d000000000004004b000011780000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000000502000029000004700020009c00000470020080410000004002200210000000000121019f000011bf00010430000004dc01000041000000000010043f000004a801000041000011bf00010430000004db01000041000000000010043f000004a801000041000011bf0001043000010000000000020000047102000041000000000502041a0000000002000414000004a406100197000004700020009c0000047002008041000000c00120021000000472011001c70000800d0200003900000003030000390000047304000041000100000006001d11bd11b30000040f00000001002001900000119b0000613d00000471010000410000000102000029000000000021041b000000000001042d0000000001000019000011bf00010430000000000001042f000004700010009c00000470010080410000004001100210000004700020009c00000470020080410000006002200210000000000112019f0000000002000414000004700020009c0000047002008041000000c002200210000000000112019f00000472011001c7000080100200003911bd11b80000040f0000000100200190000011b10000613d000000000101043b000000000001042d0000000001000019000011bf00010430000011b6002104210000000102000039000000000001042d0000000002000019000000000001042d000011bb002104230000000102000039000000000001042d0000000002000019000000000001042d000011bd00000432000011be0001042e000011bf0001043000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392702000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acebfa87805ed57dc1f0d489ce33be4c4577d74ccde357eeeee058a32c55c44a532526567656e547265617375726548756e74000000000000000000000000000022c2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b3da8a5f161a6c3ff06a60736d0ed24d7963cc6a5c4fafd2fa1dae9bb908e07a5524548554e54000000000000000000000000000000000000000000000000000c000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000000000000000000000715018a500000000000000000000000000000000000000000000000000000000b390c0aa00000000000000000000000000000000000000000000000000000000f242432900000000000000000000000000000000000000000000000000000000fdff9b4c00000000000000000000000000000000000000000000000000000000fdff9b4d00000000000000000000000000000000000000000000000000000000fee81cf400000000000000000000000000000000000000000000000000000000f242432a00000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000e985e9c400000000000000000000000000000000000000000000000000000000e985e9c500000000000000000000000000000000000000000000000000000000f04e283e00000000000000000000000000000000000000000000000000000000b390c0ab00000000000000000000000000000000000000000000000000000000be1a7c830000000000000000000000000000000000000000000000000000000095d89b4000000000000000000000000000000000000000000000000000000000a22cb46400000000000000000000000000000000000000000000000000000000a22cb46500000000000000000000000000000000000000000000000000000000a5e90eee0000000000000000000000000000000000000000000000000000000095d89b410000000000000000000000000000000000000000000000000000000098e8628100000000000000000000000000000000000000000000000000000000715018a600000000000000000000000000000000000000000000000000000000731133e9000000000000000000000000000000000000000000000000000000008da5cb5b000000000000000000000000000000000000000000000000000000002eb2c2d5000000000000000000000000000000000000000000000000000000004e1273f3000000000000000000000000000000000000000000000000000000006717e41b000000000000000000000000000000000000000000000000000000006717e41c000000000000000000000000000000000000000000000000000000006b20c454000000000000000000000000000000000000000000000000000000004e1273f40000000000000000000000000000000000000000000000000000000054d1f13d000000000000000000000000000000000000000000000000000000002eb2c2d60000000000000000000000000000000000000000000000000000000031af190800000000000000000000000000000000000000000000000000000000408bd86e000000000000000000000000000000000000000000000000000000000e89341b000000000000000000000000000000000000000000000000000000001f7fdff9000000000000000000000000000000000000000000000000000000001f7fdffa0000000000000000000000000000000000000000000000000000000025692962000000000000000000000000000000000000000000000000000000000e89341c00000000000000000000000000000000000000000000000000000000124d91e50000000000000000000000000000000000000000000000000000000000fdd58e0000000000000000000000000000000000000000000000000000000001ffc9a70000000000000000000000000000000000000000000000000000000006fdde03000000000000000000000000ffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000389a75e10000000000000000000000000000000000000020000000800000000000000000000000000000000000000000000000000000000000000000000000007448fbae00000000000000000000000000000000000000040000001c0000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff02000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000009a31110384e0b0c9000000000000000000000000000000000000000100000000000000000000000002000000000000000000000000000000000000340000000c0000000000000000c3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f621806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b83020000020000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000000000000000000000f23a6e6100000000000000000000000000000000000000000000000000000000ffffff3bffffffffffffffffffffffffffffffffffffff3c00000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffe0f23a6e610000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000200000000c0000000000000000796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d955391320200000200000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000006f5e8818000000000000000000000000000000000000000000000000ffffffffffffff5f02000000000000000000000000000000000000200000000000000000000000004e6f7420656e6f7567682062616c616e6365000000000000000000000000000008c379a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006400000000000000000000000017307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082b429007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000ffffffff000000000000000000000000fe000000000000000000000000000000000000000000000000000000000000004a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fbfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c921f6d5aef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff3f0000000019457468657265756d205369676e6564204d6573736167653a0a3332020000000000000000000000000000000000003c0000000400000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000800000000000000000000000008baa579f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008baa579fa4420a9500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004b6e7f1800000000000000000000000000000000000000000000000000000000f4d678b802000000000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000bc197c81bc197c8100000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd5d00dbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d4d69736d61746368000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b800a460000000000000000000000000000000000000000000000000000000001336cea000000000000000000000000000000000000000000000000000000009c05499b00000000000000000000000000000000000000000000000000000000ea553b34d92e233d00000000000000000000000000000000000000000000000000000000c0fc8a8a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff6000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3000000000000000000000000000000000000000000000000000000000000000546f6b656e202300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffbf4e6f206465736372697074696f6e2e0000000000000000000000000000000000697066733a2f2f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffdf000000005c75303030303031323334353637383961626364656662746e0066725c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000004000000004e4f00000000000000000000000000000000000000000000000000000000000059455300000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000226e616d65223a22000000000000000000000000000000000000000000000000222c226465736372697074696f6e223a22000000000000000000000000000000222c22696d616765223a22000000000000000000000000000000000000000000222c22736f756c626f756e64223a220000000000000000000000000000000000227d0000000000000000000000000000000000000000000000000000000000004142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3d3d000000000000000000000000000000000000000000000000000000000000646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000002ce0136b000000000000000000000000000000000000000000000000000000004e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000d9b67a26d9b67a26000000000000000000000000000000000000000000000000000000000e89341c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000002e5c1fc2eaf0df0e80918dba18c916e2afcedf03ec78ac01c31e68c9c029af2f
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.