Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
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:
CatridgeNFT
Compiler Version
v0.8.28+commit.7893614a
ZkSolc Version
v1.5.11
Optimization Enabled:
Yes with Mode 3
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; import "../lib/solady/src/tokens/ERC721.sol"; import "../lib/solady/src/auth/Ownable.sol"; import "../lib/solady/src/utils/Base64.sol"; import "../lib/solady/src/utils/LibString.sol"; contract CatridgeNFT is ERC721, Ownable { // ******************************************* // * * // * STRUCTS * // * * // ******************************************* struct BossMetadata { string name; string imageURI; string description; CatridgeTier tier; } // ******************************************* // * * // * STATE VARIABLES * // * * // ******************************************* address public khugaBashAddress; uint256 private _tokenIdCounter; mapping(uint256 => bytes32) public tokenToBoss; mapping(address => mapping(bytes32 => uint256)) public playerBossToToken; enum CatridgeTier { COMMON, UNCOMMON, RARE, EPIC, LEGENDARY } mapping(bytes32 => BossMetadata) public bossMetadata; mapping(CatridgeTier => string) public tierNames; // ******************************************* // * * // * EVENTS * // * * // ******************************************* event CatridgeMinted(address indexed player, bytes32 indexed bossId, uint256 tokenId); // ******************************************* // * * // * ERRORS * // * * // ******************************************* error OnlyKhugaBashCanMint(); // ******************************************* // * * // * CONSTRUCTOR * // * * // ******************************************* constructor() { _initializeOwner(msg.sender); // Initialize tier names tierNames[CatridgeTier.COMMON] = "Common"; tierNames[CatridgeTier.UNCOMMON] = "Uncommon"; tierNames[CatridgeTier.RARE] = "Rare"; tierNames[CatridgeTier.EPIC] = "Epic"; tierNames[CatridgeTier.LEGENDARY] = "Legendary"; } // ******************************************* // * * // * ADMIN FUNCTIONS * // * * // ******************************************* function setKhugaBashAddress(address _khugaBashAddress) external onlyOwner { khugaBashAddress = _khugaBashAddress; } function setTierName(CatridgeTier tier, string calldata _name) external onlyOwner { tierNames[tier] = _name; } function setBossMetadata( bytes32 bossId, string calldata bossName, string calldata imageURI, string calldata description, CatridgeTier tier ) external onlyOwner { bossMetadata[bossId] = BossMetadata({ name: bossName, imageURI: imageURI, description: description, tier: tier }); } // ******************************************* // * * // * READ FUNCTIONS * // * * // ******************************************* function getTierOfToken(uint256 tokenId) public view returns (CatridgeTier) { require(_ownerOf(tokenId) != address(0), TokenDoesNotExist()); bytes32 bossId = tokenToBoss[tokenId]; return bossMetadata[bossId].tier; } // Get display name of a token's tier function getTierNameOfToken(uint256 tokenId) public view returns (string memory) { CatridgeTier tier = getTierOfToken(tokenId); return tierNames[tier]; } // ******************************************* // * * // * WRITE FUNCTIONS * // * * // ******************************************* function mintCatridge(address player, bytes32 bossId) external returns (uint256) { require(msg.sender == khugaBashAddress, OnlyKhugaBashCanMint()); // Check if player already has a Catridge for this boss uint256 existingToken = playerBossToToken[player][bossId]; if (existingToken != 0) { return existingToken; } // Mint new token _tokenIdCounter++; uint256 tokenId = _tokenIdCounter; _mint(player, tokenId); // Record token information tokenToBoss[tokenId] = bossId; playerBossToToken[player][bossId] = tokenId; emit CatridgeMinted(player, bossId, tokenId); return tokenId; } // ******************************************* // * * // * ON-CHAIN METADATA * // * * // ******************************************* function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_ownerOf(tokenId) != address(0), TokenDoesNotExist()); bytes32 bossId = tokenToBoss[tokenId]; BossMetadata memory metadata = bossMetadata[bossId]; string memory tierName = tierNames[metadata.tier]; string memory json = Base64.encode( bytes( string( abi.encodePacked( '{"name": "', tierName, ' Catridge: ', metadata.name, '", ', '"description": "', metadata.description, '", ', '"image": "', metadata.imageURI, '", ', '"attributes": [', '{"trait_type": "Boss", "value": "', metadata.name, '"}, ', '{"trait_type": "Tier", "value": "', tierName, '"}, ', '{"display_type": "boost_number", "trait_type": "Rarity", "value": ', LibString.toString(uint8(metadata.tier)), '}', '], ' ) ) ) ); return string(abi.encodePacked("data:application/json;base64,", json)); } function name() public pure override returns (string memory) { return "Khuga Bash Catridge"; } function symbol() public pure override returns (string memory) { return "CATRIDGE"; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC721 implementation with storage hitchhiking. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC721.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC721/ERC721.sol) /// /// @dev Note: /// - The ERC721 standard allows for self-approvals. /// For performance, this implementation WILL NOT revert for such actions. /// Please add any checks with overrides if desired. /// - For performance, methods are made payable where permitted by the ERC721 standard. /// - The `safeTransfer` functions use the identity precompile (0x4) /// to copy memory internally. /// /// If you are overriding: /// - NEVER violate the ERC721 invariant: /// the balance of an owner MUST always be equal to their number of ownership slots. /// The transfer functions do not have an underflow guard for user token balances. /// - 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 ERC721 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev An account can hold up to 4294967295 tokens. uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Only the token owner or an approved account can manage the token. error NotOwnerNorApproved(); /// @dev The token does not exist. error TokenDoesNotExist(); /// @dev The token already exists. error TokenAlreadyExists(); /// @dev Cannot query the balance for the zero address. error BalanceQueryForZeroAddress(); /// @dev Cannot mint or transfer to the zero address. error TransferToZeroAddress(); /// @dev The token must be owned by `from`. error TransferFromIncorrectOwner(); /// @dev The recipient's balance has overflowed. error AccountBalanceOverflow(); /// @dev Cannot safely transfer to a contract that does not implement /// the ERC721Receiver interface. error TransferToNonERC721ReceiverImplementer(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when token `id` is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 indexed id); /// @dev Emitted when `owner` enables `account` to manage the `id` token. event Approval(address indexed owner, address indexed account, uint256 indexed id); /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership data slot of `id` is given by: /// ``` /// mstore(0x00, id) /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) /// let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) /// ``` /// Bits Layout: /// - [0..159] `addr` /// - [160..255] `extraData` /// /// The approved address slot is given by: `add(1, ownershipSlot)`. /// /// See: https://notes.ethereum.org/%40vbuterin/verkle_tree_eip /// /// The balance slot of `owner` is given by: /// ``` /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) /// mstore(0x00, owner) /// let balanceSlot := keccak256(0x0c, 0x1c) /// ``` /// Bits Layout: /// - [0..31] `balance` /// - [32..255] `aux` /// /// The `operator` approval slot of `owner` is given by: /// ``` /// mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) /// mstore(0x00, owner) /// let operatorApprovalSlot := keccak256(0x0c, 0x30) /// ``` uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192; /// @dev Pre-shifted and pre-masked constant. uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC721 METADATA */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the token collection name. function name() public view virtual returns (string memory); /// @dev Returns the token collection symbol. function symbol() public view virtual returns (string memory); /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. function tokenURI(uint256 id) public view virtual returns (string memory); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC721 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of token `id`. /// /// Requirements: /// - Token `id` must exist. function ownerOf(uint256 id) public view virtual returns (address result) { result = _ownerOf(id); /// @solidity memory-safe-assembly assembly { if iszero(result) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } } } /// @dev Returns the number of tokens owned by `owner`. /// /// Requirements: /// - `owner` must not be the zero address. function balanceOf(address owner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Revert if the `owner` is the zero address. if iszero(owner) { mstore(0x00, 0x8f4eb604) // `BalanceQueryForZeroAddress()`. revert(0x1c, 0x04) } mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) result := and(sload(keccak256(0x0c, 0x1c)), _MAX_ACCOUNT_BALANCE) } } /// @dev Returns the account approved to manage token `id`. /// /// Requirements: /// - Token `id` must exist. function getApproved(uint256 id) public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) if iszero(shl(96, sload(ownershipSlot))) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } result := sload(add(1, ownershipSlot)) } } /// @dev Sets `account` as the approved account to manage token `id`. /// /// Requirements: /// - Token `id` must exist. /// - The caller must be the owner of the token, /// or an approved operator for the token owner. /// /// Emits an {Approval} event. function approve(address account, uint256 id) public payable virtual { _approve(msg.sender, account, id); } /// @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(0x1c, operator) mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x30)) } } /// @dev Sets whether `operator` is approved to manage the tokens of the caller. /// /// Emits an {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(0x1c, operator) mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x30), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) // forgefmt: disable-next-item log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) } } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 id) public payable virtual { _beforeTokenTransfer(from, to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) from := and(bitmaskAddress, from) to := and(bitmaskAddress, to) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, caller())) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) let owner := and(bitmaskAddress, ownershipPacked) // Revert if the token does not exist, or if `from` is not the owner. if iszero(mul(owner, eq(owner, from))) { // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`. mstore(shl(2, iszero(owner)), 0xceea21b6a1148100) revert(0x1c, 0x04) } // Load, check, and update the token approval. { mstore(0x00, from) let approvedAddress := sload(add(1, ownershipSlot)) // Revert if the caller is not the owner, nor approved. if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Update with the new owner. sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) // Decrement the balance of `from`. { let fromBalanceSlot := keccak256(0x0c, 0x1c) sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) } // Increment the balance of `to`. { mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) // Revert if `to` is the zero address, or if the account balance overflows. if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. mstore(shl(2, iszero(to)), 0xea553b3401336cea) revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceSlotPacked) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } _afterTokenTransfer(from, to, id); } /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. function safeTransferFrom(address from, address to, uint256 id) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function safeTransferFrom(address from, address to, uint256 id, bytes calldata data) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL QUERY FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns if token `id` exists. function _exists(uint256 id) internal view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := iszero(iszero(shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))) } } /// @dev Returns the owner of token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _ownerOf(uint256 id) internal view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL DATA HITCHHIKING FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // For performance, no events are emitted for the hitchhiking setters. // Please emit your own events if required. /// @dev Returns the auxiliary data for `owner`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _getAux(address owner) internal view virtual returns (uint224 result) { /// @solidity memory-safe-assembly assembly { mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) result := shr(32, sload(keccak256(0x0c, 0x1c))) } } /// @dev Set the auxiliary data for `owner` to `value`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _setAux(address owner, uint224 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) let balanceSlot := keccak256(0x0c, 0x1c) let packed := sload(balanceSlot) sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed))))) } } /// @dev Returns the extra data for token `id`. /// Minting, transferring, burning a token will not change the extra data. /// The extra data can be set on a non-existent token. function _getExtraData(uint256 id) internal view virtual returns (uint96 result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20))))) } } /// @dev Sets the extra data for token `id` to `value`. /// Minting, transferring, burning a token will not change the extra data. /// The extra data can be set on a non-existent token. function _setExtraData(uint256 id, uint96 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let packed := sload(ownershipSlot) sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed))))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL MINT FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Mints token `id` to `to`. /// /// Requirements: /// /// - Token `id` must not exist. /// - `to` cannot be the zero address. /// /// Emits a {Transfer} event. function _mint(address to, uint256 id) internal virtual { _beforeTokenTransfer(address(0), to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. to := shr(96, shl(96, to)) // Load the ownership data. mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) // Revert if the token already exists. if shl(96, ownershipPacked) { mstore(0x00, 0xc991cbb1) // `TokenAlreadyExists()`. revert(0x1c, 0x04) } // Update with the owner. sstore(ownershipSlot, or(ownershipPacked, to)) // Increment the balance of the owner. { mstore(0x00, to) let balanceSlot := keccak256(0x0c, 0x1c) let balanceSlotPacked := add(sload(balanceSlot), 1) // Revert if `to` is the zero address, or if the account balance overflows. if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. mstore(shl(2, iszero(to)), 0xea553b3401336cea) revert(0x1c, 0x04) } sstore(balanceSlot, balanceSlotPacked) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) } _afterTokenTransfer(address(0), to, id); } /// @dev Mints token `id` to `to`, and updates the extra data for token `id` to `value`. /// Does NOT check if token `id` already exists (assumes `id` is auto-incrementing). /// /// Requirements: /// /// - `to` cannot be the zero address. /// /// Emits a {Transfer} event. function _mintAndSetExtraDataUnchecked(address to, uint256 id, uint96 value) internal virtual { _beforeTokenTransfer(address(0), to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. to := shr(96, shl(96, to)) // Update with the owner and extra data. mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) sstore(add(id, add(id, keccak256(0x00, 0x20))), or(shl(160, value), to)) // Increment the balance of the owner. { mstore(0x00, to) let balanceSlot := keccak256(0x0c, 0x1c) let balanceSlotPacked := add(sload(balanceSlot), 1) // Revert if `to` is the zero address, or if the account balance overflows. if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. mstore(shl(2, iszero(to)), 0xea553b3401336cea) revert(0x1c, 0x04) } sstore(balanceSlot, balanceSlotPacked) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) } _afterTokenTransfer(address(0), to, id); } /// @dev Equivalent to `_safeMint(to, id, "")`. function _safeMint(address to, uint256 id) internal virtual { _safeMint(to, id, ""); } /// @dev Mints token `id` to `to`. /// /// Requirements: /// /// - Token `id` must not exist. /// - `to` cannot be the zero address. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeMint(address to, uint256 id, bytes memory data) internal virtual { _mint(to, id); if (_hasCode(to)) _checkOnERC721Received(address(0), to, id, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL BURN FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_burn(address(0), id)`. function _burn(uint256 id) internal virtual { _burn(address(0), id); } /// @dev Destroys token `id`, using `by`. /// /// Requirements: /// /// - Token `id` must exist. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _burn(address by, uint256 id) internal virtual { address owner = ownerOf(id); _beforeTokenTransfer(owner, address(0), id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. by := shr(96, shl(96, by)) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) // Reload the owner in case it is changed in `_beforeTokenTransfer`. owner := shr(96, shl(96, ownershipPacked)) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // Load and check the token approval. { mstore(0x00, owner) let approvedAddress := sload(add(1, ownershipSlot)) // If `by` is not the zero address, do the authorization check. // Revert if the `by` is not the owner, nor approved. if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Clear the owner. sstore(ownershipSlot, xor(ownershipPacked, owner)) // Decrement the balance of `owner`. { let balanceSlot := keccak256(0x0c, 0x1c) sstore(balanceSlot, sub(sload(balanceSlot), 1)) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id) } _afterTokenTransfer(owner, address(0), id); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL APPROVAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns whether `account` is the owner of token `id`, or is approved to manage it. /// /// Requirements: /// - Token `id` must exist. function _isApprovedOrOwner(address account, uint256 id) internal view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { result := 1 // Clear the upper 96 bits. account := shr(96, shl(96, account)) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, account)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let owner := shr(96, shl(96, sload(ownershipSlot))) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // Check if `account` is the `owner`. if iszero(eq(account, owner)) { mstore(0x00, owner) // Check if `account` is approved to manage the token. if iszero(sload(keccak256(0x0c, 0x30))) { result := eq(account, sload(add(1, ownershipSlot))) } } } } /// @dev Returns the account approved to manage token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _getApproved(uint256 id) internal view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := sload(add(1, add(id, add(id, keccak256(0x00, 0x20))))) } } /// @dev Equivalent to `_approve(address(0), account, id)`. function _approve(address account, uint256 id) internal virtual { _approve(address(0), account, id); } /// @dev Sets `account` as the approved account to manage token `id`, using `by`. /// /// Requirements: /// - Token `id` must exist. /// - If `by` is not the zero address, `by` must be the owner /// or an approved operator for the token owner. /// /// Emits a {Approval} event. function _approve(address by, address account, uint256 id) internal virtual { /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) account := and(bitmaskAddress, account) by := and(bitmaskAddress, by) // Load the owner of the token. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let owner := and(bitmaskAddress, sload(ownershipSlot)) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // If `by` is not the zero address, do the authorization check. // Revert if `by` is not the owner, nor approved. if iszero(or(iszero(by), eq(by, owner))) { mstore(0x00, owner) if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Sets `account` as the approved account to manage `id`. sstore(add(1, ownershipSlot), account) // Emit the {Approval} event. log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id) } } /// @dev Approve or remove the `operator` as an operator for `by`, /// without authorization checks. /// /// Emits an {ApprovalForAll} event. function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. by := shr(96, shl(96, by)) operator := shr(96, shl(96, operator)) // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`by`, `operator`). mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) mstore(0x00, by) sstore(keccak256(0x0c, 0x30), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, by, operator) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL TRANSFER FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_transfer(address(0), from, to, id)`. function _transfer(address from, address to, uint256 id) internal virtual { _transfer(address(0), from, to, id); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _transfer(address by, address from, address to, uint256 id) internal virtual { _beforeTokenTransfer(from, to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) from := and(bitmaskAddress, from) to := and(bitmaskAddress, to) by := and(bitmaskAddress, by) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) let owner := and(bitmaskAddress, ownershipPacked) // Revert if the token does not exist, or if `from` is not the owner. if iszero(mul(owner, eq(owner, from))) { // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`. mstore(shl(2, iszero(owner)), 0xceea21b6a1148100) revert(0x1c, 0x04) } // Load, check, and update the token approval. { mstore(0x00, from) let approvedAddress := sload(add(1, ownershipSlot)) // If `by` is not the zero address, do the authorization check. // Revert if the `by` is not the owner, nor approved. if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Update with the new owner. sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) // Decrement the balance of `from`. { let fromBalanceSlot := keccak256(0x0c, 0x1c) sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) } // Increment the balance of `to`. { mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) // Revert if `to` is the zero address, or if the account balance overflows. if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. mstore(shl(2, iszero(to)), 0xea553b3401336cea) revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceSlotPacked) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } _afterTokenTransfer(from, to, id); } /// @dev Equivalent to `_safeTransfer(from, to, id, "")`. function _safeTransfer(address from, address to, uint256 id) internal virtual { _safeTransfer(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeTransfer(address from, address to, uint256 id, bytes memory data) internal virtual { _transfer(address(0), from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Equivalent to `_safeTransfer(by, from, to, id, "")`. function _safeTransfer(address by, address from, address to, uint256 id) internal virtual { _safeTransfer(by, from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeTransfer(address by, address from, address to, uint256 id, bytes memory data) internal virtual { _transfer(by, from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HOOKS FOR OVERRIDING */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Hook that is called before any token transfers, including minting and burning. function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {} /// @dev Hook that is called after any token transfers, including minting and burning. function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {} /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PRIVATE HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) let onERC721ReceivedSelector := 0x150b7a02 mstore(m, onERC721ReceivedSelector) mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), 0x80) let n := mload(data) mstore(add(m, 0xa0), n) if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) } // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } } // Load the returndata and compare it. if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. revert(0x1c, 0x04) } } } }
// 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; /// @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; 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 { /// @solidity memory-safe-assembly assembly { // Assumes that the string does not start from the scratch space. let retStart := sub(a, 0x20) let retUnpaddedSize := add(mload(a), 0x40) // Right pad with zeroes. Just in case the string is produced // by a method that doesn't zero right pad. mstore(add(retStart, retUnpaddedSize), 0) mstore(retStart, 0x20) // Store the return offset. // End the transaction, returning the string. return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library 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 { /// @solidity memory-safe-assembly 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 { /// @solidity memory-safe-assembly 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. 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. 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 a slice representing a static struct in the calldata. Performs bounds checks. function staticStructInCalldata(bytes calldata a, uint256 offset) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { let l := sub(a.length, 0x20) result.offset := add(a.offset, offset) result.length := sub(a.length, offset) if or(shr(64, or(l, a.offset)), gt(offset, l)) { revert(l, 0x00) } } } /// @dev Returns a slice representing a dynamic struct in the calldata. Performs bounds checks. function dynamicStructInCalldata(bytes calldata a, uint256 offset) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { let l := sub(a.length, 0x20) let s := calldataload(add(a.offset, offset)) // Relative offset of `result` from `a.offset`. result.offset := add(a.offset, s) result.length := sub(a.length, s) if or(shr(64, or(s, or(l, a.offset))), gt(offset, l)) { revert(l, 0x00) } } } /// @dev Returns bytes in calldata. Performs bounds checks. function bytesInCalldata(bytes calldata a, uint256 offset) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { let l := sub(a.length, 0x20) let s := calldataload(add(a.offset, offset)) // Relative offset of `result` from `a.offset`. result.offset := add(add(a.offset, s), 0x20) result.length := calldataload(add(a.offset, s)) // forgefmt: disable-next-item if or(shr(64, or(result.length, or(s, or(l, a.offset)))), or(gt(add(s, result.length), l), gt(offset, l))) { revert(l, 0x00) } } } /// @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 } } }
{ "viaIR": false, "codegen": "yul", "remappings": [ "solady/=lib/solady/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/" ], "evmVersion": "cancun", "outputSelection": { "*": { "*": [ "abi" ] } }, "optimizer": { "enabled": true, "mode": "3", "fallback_to_optimizing_for_size": false, "disable_system_request_memoization": true }, "metadata": {}, "libraries": {}, "enableEraVMExtensions": false, "forceEVMLA": false }
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountBalanceOverflow","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotOwnerNorApproved","type":"error"},{"inputs":[],"name":"OnlyKhugaBashCanMint","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"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":"player","type":"address"},{"indexed":true,"internalType":"bytes32","name":"bossId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"CatridgeMinted","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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bossMetadata","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"enum CatridgeNFT.CatridgeTier","name":"tier","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTierNameOfToken","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTierOfToken","outputs":[{"internalType":"enum CatridgeNFT.CatridgeTier","name":"","type":"uint8"}],"stateMutability":"view","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":[],"name":"khugaBashAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"bytes32","name":"bossId","type":"bytes32"}],"name":"mintCatridge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"playerBossToToken","outputs":[{"internalType":"uint256","name":"","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":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"isApproved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"bossId","type":"bytes32"},{"internalType":"string","name":"bossName","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"enum CatridgeNFT.CatridgeTier","name":"tier","type":"uint8"}],"name":"setBossMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_khugaBashAddress","type":"address"}],"name":"setKhugaBashAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum CatridgeNFT.CatridgeTier","name":"tier","type":"uint8"},{"internalType":"string","name":"_name","type":"string"}],"name":"setTierName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum CatridgeNFT.CatridgeTier","name":"","type":"uint8"}],"name":"tierNames","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenToBoss","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
9c4d535b00000000000000000000000000000000000000000000000000000000000000000100046711cd9542b035f5e2b83ac11371dfd83172907d280033751109942b6700000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x00020000000000020008000000000002000000000901034f00010000000103550000006001100270000003dd0010019d0000008003000039000000400030043f0000000100200190000000370000c13d000003dd01100197000000040010008c000007160000413d000000000209043b000000e002200270000003ed0020009c0000011c0000a13d000003ee0020009c000001670000213d000003fa0020009c000002010000213d000004000020009c000002ca0000213d000004030020009c000003570000613d000004040020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000800000001001d000000000010043f00000424010000410000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000008020000290000000102200210000000000101043b0000000001210019000000000101041a0000041a01100198000001fa0000c13d000005430000013d0000000001000416000000000001004b000007160000c13d0000000006000411000003de01000041000000000061041b0000000001000414000003dd0010009c000003dd01008041000000c001100210000003df011001c70000800d020000390000000303000039000003e00400004100000000050000190f6e0f640000040f0000000100200190000007160000613d0000000503000039000000200030043f000003e101000041000000000101041a000000010210019000000001041002700000007f0440618f0000001f0040008c00000000010000390000000101002039000000000012004b000002250000c13d000000200040008c0000006f0000413d000800000004001d000003e101000041000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b00000008020000290000001f0220003900000005022002700000000002210019000000000021004b00000005030000390000006f0000813d000000000001041b0000000101100039000000000021004b0000006b0000413d000003e301000041000003e102000041000000000012041b000000200030043f000003e401000041000000000101041a000000010010019000000001041002700000007f0440618f0000001f0040008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d0000001f0040008c000000980000a13d000800000004001d000003e401000041000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b00000008020000290000001f0220003900000005022002700000000002210019000000000021004b0000000503000039000000980000813d000000000001041b0000000101100039000000000021004b000000940000413d000003e501000041000003e402000041000000000012041b000000200030043f000003e601000041000000000101041a000000010010019000000001041002700000007f0440618f0000001f0040008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d000000200040008c000000c10000413d000800000004001d000003e601000041000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b00000008020000290000001f0220003900000005022002700000000002210019000000000021004b0000000503000039000000c10000813d000000000001041b0000000101100039000000000021004b000000bd0000413d000003e701000041000003e602000041000000000012041b000000200030043f000003e801000041000000000101041a000000010010019000000001041002700000007f0440618f0000001f0040008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d000000200040008c000000ea0000413d000800000004001d000003e801000041000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b00000008020000290000001f0220003900000005022002700000000002210019000000000021004b0000000503000039000000ea0000813d000000000001041b0000000101100039000000000021004b000000e60000413d000003e901000041000003e802000041000000000012041b0000000401000039000000000010043f000000200030043f000003ea01000041000000000101041a000000010010019000000001031002700000007f0330618f0000001f0030008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d0000001f0030008c000001140000a13d000800000003001d000003ea01000041000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b00000008020000290000001f0220003900000005022002700000000002210019000000000021004b000001140000813d000000000001041b0000000101100039000000000021004b000001100000413d000003eb01000041000003ea02000041000000000012041b000000200100003900000100001004430000012000000443000003ec0100004100000f6f0001042e000004050020009c000001d40000a13d000004060020009c0000022b0000213d0000040c0020009c000002dd0000213d0000040f0020009c000004690000613d000004100020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000800000001001d000000000010043f00000424010000410000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000008030000290000000102300210000000000101043b0000000001210019000000000101041a0000041a00100198000005830000613d000000000030043f0000000201000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000000000101041a000000000010043f0000000401000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b0000000301100039000000000101041a000000ff0110018f000000050010008c000001fa0000413d0000044801000041000000000010043f0000002101000039000000040010043f000004490100004100000f7000010430000003ef0020009c0000023e0000213d000003f50020009c000003080000213d000003f80020009c000004820000613d000003f90020009c000007160000c13d000000840010008c000007160000413d0000000402900370000000000202043b000800000002001d0000041a0020009c000007160000213d0000002402900370000000000202043b000700000002001d0000041a0020009c000007160000213d0000004402900370000000000202043b000600000002001d0000006402900370000000000202043b000004270020009c000007160000213d0000002303200039000000000013004b000007160000813d000400040020003d0000000403900360000000000303043b000500000003001d000004270030009c000007160000213d0000000502200029000300240020003d000000030010006b000007160000213d0000000801000029000000070200002900000006030000290f6e0e0b0000040f0000043d010000410000000000100443000000070100002900000004001004430000000001000414000003dd0010009c000003dd01008041000000c0011002100000043e011001c700008002020000390f6e0f690000040f00000001002001900000062a0000613d000000000101043b000000000001004b000003420000613d00000005010000290000001f011000390000045d011001970000003f011000390000045d01100197000000400400043d0000000001140019000000000041004b00000000030000390000000103004039000004270010009c00000c290000213d000000010030019000000c290000c13d000000400010043f000000050100002900000000011404360000000305000029000000000050007c000007160000213d00000005050000290000045d035001980000001f0550018f0000000002310019000000040600002900000020066000390000000106600367000001c50000613d000000000706034f0000000008010019000000007907043c0000000008980436000000000028004b000001c10000c13d000000000005004b000001d20000613d000000000336034f0000000305500210000000000602043300000000065601cf000000000656022f000000000303043b0000010005500089000000000353022f00000000035301cf000000000363019f00000000003204350000000501100029000005030000013d000004110020009c000002730000a13d000004120020009c000002b50000213d000004150020009c000004b20000613d000004160020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000800000001001d000000000010043f00000424010000410000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000008020000290000000102200210000000000101043b0000000001210019000000000201041a0000041a00200198000005430000613d0000000101100039000000000101041a0000041a01100197000000400200043d0000000000120435000003dd0020009c000003dd02008041000000400120021000000444011001c700000f6f0001042e000003fb0020009c000003160000213d000003fe0020009c000004c60000613d000003ff0020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000000000010043f0000000401000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000901043b000000000109041a000000010210019000000001041002700000007f0440618f0000001f0040008c00000000030000390000000103002039000000000331013f00000001003001900000062b0000613d0000044801000041000000000010043f0000002201000039000000040010043f000004490100004100000f7000010430000004070020009c000003230000213d0000040a0020009c000004db0000613d0000040b0020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000000000010043f0000000201000039000000200010043f000000400200003900000000010000190000055e0000013d000003f00020009c000003440000213d000003f30020009c0000050a0000613d000003f40020009c000007160000c13d000000240010008c000007160000413d0000000401900370000000000101043b000800000001001d0000041a0010009c000007160000213d000003de01000041000000000101041a0000000002000411000000000012004b000006260000c13d0000041b010000410000000c0010043f0000000801000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c0011002100000041f011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000600000001001d000000000101041a000700000001001d000004200100004100000000001004430000000001000414000003dd0010009c000003dd01008041000000c00110021000000421011001c70000800b020000390f6e0f690000040f00000001002001900000062a0000613d000000000101043b000000070010006c000007180000a13d0000042201000041000000000010043f0000041e0100004100000f7000010430000004170020009c0000060a0000613d000004180020009c0000061e0000613d000004190020009c000007160000c13d000000440010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000800000001001d0000041a0010009c000007160000213d0000002401900370000000000301043b000000000100041a0000041a011001970000000002000411000000000012004b0000064e0000c13d000700000003001d0000000801000029000000000010043f0000000301000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b0000000702000029000000000020043f000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000000000101041a000600000001001d000000000001004b000009390000c13d0000000101000039000000000201041a000500000002001d000000010220003a0000075f0000c13d0000044801000041000000000010043f0000001101000039000000040010043f000004490100004100000f7000010430000004130020009c000005250000613d000004140020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000800000001001d0000041a0010009c000007160000213d0f6e0e920000040f000000000100041a0000044f0110019700000008011001af000000000010041b000000000100001900000f6f0001042e000004010020009c000005470000613d000004020020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b0000041a0010009c000007160000213d000000000001004b000006520000c13d0000044301000041000000000010043f0000041e0100004100000f70000104300000040d0020009c000005630000613d0000040e0020009c000007160000c13d0000041b010000410000000c0010043f0000000001000411000000000010043f000004200100004100000000001004430000000001000414000003dd0010009c000003dd01008041000000c00110021000000421011001c70000800b020000390f6e0f690000040f00000001002001900000062a0000613d000000000101043b000800000001001d0000000001000414000003dd0010009c000003dd01008041000000c0011002100000041f011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b00000008020000290000044b0220009a000000000021041b0000000001000414000003dd0010009c000003dd01008041000000c001100210000003df011001c70000800d0200003900000002030000390000044c040000410000033e0000013d000003f60020009c000005670000613d000003f70020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000000040010008c000004710000a13d000007160000013d000003fc0020009c000005870000613d000003fd0020009c000007160000c13d0000000001000416000000000001004b000007160000c13d000000c001000039000000400010043f0000000801000039000000800010043f0000044101000041000004ba0000013d000004080020009c0000058d0000613d000004090020009c000007160000c13d0000041b010000410000000c0010043f0000000001000411000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c0011002100000041f011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000000000001041b0000000001000414000003dd0010009c000003dd01008041000000c001100210000003df011001c70000800d020000390000000203000039000004460400004100000000050004110f6e0f640000040f0000000100200190000007160000613d000000000100001900000f6f0001042e000003f10020009c000005f90000613d000003f20020009c000007160000c13d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b0000041a0010009c000007160000213d0000041b020000410000000c0020043f000000000010043f0000000c0100003900000020020000390000055e0000013d000000a40010008c000007160000413d0000000002000416000000000002004b000007160000c13d0000002402900370000000000202043b000004270020009c000007160000213d0000002303200039000000000013004b000007160000813d0000000407200039000000000379034f000000000503043b000004270050009c000007160000213d00000000025200190000002402200039000000000012004b000007160000213d0000004402900370000000000202043b000004270020009c000007160000213d0000002303200039000000000013004b000007160000813d0000000406200039000000000369034f000000000303043b000004270030009c000007160000213d00000000023200190000002402200039000000000012004b000007160000213d0000006402900370000000000402043b000004270040009c000007160000213d0000002302400039000000000012004b000007160000813d0000000402400039000000000229034f000000000202043b000004270020009c000007160000213d00000024044000390000000008420019000000000018004b000007160000213d0000008401900370000000000101043b000000040010008c000007160000213d000000000f09034f000003de08000041000000000808041a0000000009000411000000000089004b000006260000c13d0000010008000039000000400080043f0000001f095000390000045d099001970000003f099000390000045d09900197000004450090009c00000c290000213d0000010009900039000000400090043f000000200770003900000000097f034f000001000050043f0000045d0a5001980000001f0b50018f0000012007a00039000003ad0000613d000001200c000039000000000d09034f00000000de0d043c000000000cec043600000000007c004b000003a90000c13d00000000000b004b000003ba0000613d0000000009a9034f000000030ab00210000000000b070433000000000bab01cf000000000bab022f000000000909043b000001000aa000890000000009a9022f0000000009a901cf0000000009b9019f000000000097043500000120055000390000000000050435000000800080043f0000001f053000390000045d055001970000003f055000390000045d07500197000000400500043d0000000007750019000000000057004b00000000080000390000000108004039000004270070009c00000c290000213d000000010080019000000c290000c13d000000400070043f000000200660003900000000086f034f00000000063504360000045d093001980000001f0a30018f0000000007960019000003d80000613d000000000b08034f000000000c06001900000000bd0b043c000000000cdc043600000000007c004b000003d40000c13d00000000000a004b000003e50000613d000000000898034f0000000309a00210000000000a070433000000000a9a01cf000000000a9a022f000000000808043b0000010009900089000000000898022f00000000089801cf0000000008a8019f000000000087043500000000033600190000000000030435000000a00050043f0000001f032000390000045d033001970000003f033000390000045d05300197000000400300043d0000000005530019000000000035004b00000000060000390000000106004039000004270050009c00000c290000213d000000010060019000000c290000c13d000000400050043f00000000064f034f00000000042304360000045d072001980000001f0820018f0000000005740019000004020000613d000000000906034f000000000a040019000000009b09043c000000000aba043600000000005a004b000003fe0000c13d000000000008004b0000040f0000613d000000000676034f0000000307800210000000000805043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f000000000065043500000000022400190000000000020435000000c00030043f000000e00010043f0000000401f00370000000000101043b000000000010043f0000000401000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000700000001001d000000800100043d000500000001001d0000000021010434000600000002001d000800000001001d000004270010009c00000c290000213d0000000701000029000000000101041a000000010010019000000001021002700000007f0220618f000400000002001d0000001f0020008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d0000000401000029000000200010008c000004550000413d0000000701000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000008030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000004010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b000004550000813d000000000002041b0000000102200039000000000012004b000004510000413d00000008010000290000001f0010008c00000a030000a13d0000000701000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000200200008a0000000802200180000000000101043b00000c050000c13d000000200300003900000c120000013d000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b0f6e0dd10000040f0f6e0db90000040f0f6e0d6c0000040f0000002002000039000000400300043d000800000003001d00000000022304360f6e0d160000040f00000008020000290000000001210049000003dd0010009c000003dd010080410000006001100210000003dd0020009c000003dd020080410000004002200210000000000121019f00000f6f0001042e000000440010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000800000001001d0000041a0010009c000007160000213d0000002401900370000000000201043b000000000002004b0000000001000039000000010100c039000700000002001d000000000012004b000007160000c13d00000008010000290000001c0010043f0000042301000041000000080010043f0000000001000411000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c0011002100000043f011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b0000000702000029000000000021041b000000000020043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c70000800d0200003900000003030000390000044004000041000000000500041100000008060000290000033f0000013d0000000001000416000000000001004b000007160000c13d000000c001000039000000400010043f0000001301000039000000800010043f0000045301000041000000a00010043f0000002001000039000000c00010043f0000008001000039000000e0020000390f6e0d160000040f000000c00110008a000003dd0010009c000003dd01008041000000600110021000000442011001c700000f6f0001042e000003de01000041000000000101041a0000000005000411000000000015004b000006260000c13d0000000001000414000003dd0010009c000003dd01008041000000c001100210000003df011001c70000800d020000390000000303000039000003e00400004100000000060000190f6e0f640000040f0000000100200190000007160000613d000003de01000041000000000001041b000000000100001900000f6f0001042e000000640010008c000007160000413d0000000401900370000000000101043b000800000001001d0000041a0010009c000007160000213d0000002401900370000000000101043b000700000001001d0000041a0010009c000007160000213d0000004401900370000000000301043b00000008010000290000000702000029000600000003001d0f6e0e0b0000040f0000043d010000410000000000100443000000070100002900000004001004430000000001000414000003dd0010009c000003dd01008041000000c0011002100000043e011001c700008002020000390f6e0f690000040f00000001002001900000062a0000613d000000000101043b000000000001004b000003420000613d000000400100043d0000044a0010009c00000c290000813d0000002002100039000000400020043f000000000401001900000000000104350000000801000029000000070200002900000006030000290f6e0e9c0000040f000000000100001900000f6f0001042e000000440010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b0000041a0010009c000007160000213d0000002402900370000000000202043b0000041a0020009c000007160000213d0000001c0020043f0000042302000041000000080020043f000000000010043f0000000c0100003900000030020000390f6e0f4f0000040f000000000101041a000000000001004b0000000001000039000000010100c039000000800010043f0000041c0100004100000f6f0001042e000000440010008c000007160000413d0000000401900370000000000101043b000800000001001d0000041a0010009c000007160000213d0000002401900370000000000101043b000700000001001d000000000010043f000000000100041100000424011001c70000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000007020000290000000102200210000000000101043b0000000002210019000000000102041a0000041a05100198000006a90000c13d0000045201000041000000000010043f0000041e0100004100000f7000010430000000440010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b0000041a0010009c000007160000213d000000000010043f0000000301000039000000200010043f0000004002000039000000000100001900080000000903530f6e0f4f0000040f000000080200035f0000002402200370000000000202043b000000000020043f000000200010043f000000000100001900000040020000390f6e0f4f0000040f000000000101041a000000800010043f0000041c0100004100000f6f0001042e0f6e0d480000040f0f6e0e0b0000040f000000000100001900000f6f0001042e000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b000800000001001d000000000010043f00000424010000410000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c70000801002000039000700000003001d0f6e0f690000040f0000000100200190000007160000613d00000008030000290000000102300210000000000101043b0000000001210019000000000101041a0000041a001001980000065d0000c13d0000044d01000041000000000010043f0000044e0100004100000f70000104300000000001000416000000000001004b000007160000c13d000003de01000041000000000101041a000006220000013d000000440010008c000007160000413d0000000002000416000000000002004b000007160000c13d0000000402900370000000000202043b000000040020008c000007160000213d0000002403900370000000000303043b000004270030009c000007160000213d0000002304300039000000000014004b000007160000813d000700040030003d0000000704900360000000000404043b000800000004001d000004270040009c000007160000213d0000002404300039000600000004001d0000000803400029000000000013004b000007160000213d000003de01000041000000000101041a0000000003000411000000000013004b000006260000c13d000000000020043f0000000501000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000500000001001d000000000101041a000000010010019000000001021002700000007f0220618f000400000002001d0000001f0020008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d0000000401000029000000200010008c000005e50000413d0000000501000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000008030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000004010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b000005e50000813d000000000002041b0000000102200039000000000012004b000005e10000413d00000008010000290000001f0010008c000008060000a13d0000000501000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000200200008a0000000802200180000000000101043b000009410000c13d00000000030000190000094c0000013d000000240010008c000007160000413d0000000401900370000000000101043b0000041a0010009c000007160000213d000003de02000041000000000202041a0000000003000411000000000023004b000006260000c13d000000000001004b0000071b0000c13d0000041d01000041000000000010043f0000041e0100004100000f7000010430000000240010008c000007160000413d0000000001000416000000000001004b000007160000c13d0000000401900370000000000101043b0000045a00100198000007160000c13d000000e0011002700000045b0010009c00000000020000390000000102006039000004170010009c00000001022061bf0000045c0010009c00000001022061bf000000800020043f0000041c0100004100000f6f0001042e0000000001000416000000000001004b000007160000c13d000000000100041a0000041a01100197000000800010043f0000041c0100004100000f6f0001042e0000044701000041000000000010043f0000041e0100004100000f7000010430000000000001042f000000400a00043d00000000064a0436000000000002004b000006c40000613d000500000004001d00060000000a001d000800000006001d000700000009001d000000000090043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d0000000505000029000000000005004b000000000200001900000008060000290000000709000029000000060a000029000006c90000613d000000000101043b00000000020000190000000003260019000000000401041a000000000043043500000001011000390000002002200039000000000052004b000006460000413d000006c90000013d0000045401000041000000000010043f0000044e0100004100000f700001043000000424020000410000001c0020043f000000000010043f0000000c010000390000001c020000390f6e0f4f0000040f000000000101041a000003dd01100197000000800010043f0000041c0100004100000f6f0001042e000000000030043f0000000201000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000000000101041a000000000010043f0000000401000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000501043b000000400400043d000004260040009c00000c290000213d0000008006400039000000400060043f000000000105041a000000010210019000000001071002700000007f0770618f0000001f0070008c00000000030000390000000103002039000000000331013f0000000100300190000002250000c13d000800000005001d000600000004001d000500000006001d000400000007001d0000000000760435000000000002004b0000078f0000613d0000000801000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d0000000406000029000000000006004b0000000002000019000007960000613d0000000602000029000000a003200039000000000101043b00000000020000190000000004230019000000000501041a000000000054043500000001011000390000002002200039000000000062004b000006a10000413d000007960000013d0000000001000411000000000001004b000007070000613d000000000051004b000007070000613d000500000002001d000600000005001d000000000050043f0000000001000414000003dd0010009c000003dd01008041000000c0011002100000043f011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000000000101041a000000000001004b00000006050000290000000502000029000007070000c13d0000045101000041000000000010043f0000041e0100004100000f70000104300000045e011001970000000000160435000000000004004b000000200200003900000000020060390000003f01200039000000200500008a000000000151016f0000000008a10019000000000018004b00000000010000390000000101004039000004270080009c00000c290000213d000000010010019000000c290000c13d000000400080043f0000000101900039000000000201041a0000000103200190000000010b2002700000007f0bb0618f0000001f00b0008c00000000040000390000000104002039000000000442013f0000000100400190000002250000c13d0000000007b80436000000000003004b0000071e0000613d00030000000b001d00060000000a001d000700000009001d000400000008001d000500000007001d000800000006001d000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000030b00002900000000000b004b0000000002000019000000200500008a0000000806000029000000050700002900000004080000290000000709000029000000060a000029000007230000613d000000000101043b00000000020000190000000003270019000000000401041a0000000000430435000000010110003900000020022000390000000000b2004b000006ff0000413d000007230000013d00000001012000390000000806000029000000000061041b0000000001000414000003dd0010009c000003dd01008041000000c001100210000003df011001c70000800d020000390000000403000039000004500400004100000007070000290f6e0f640000040f0000000100200190000003420000c13d000000000100001900000f70000104300000000601000029000000000001041b00000008010000290f6e0f380000040f000000000100001900000f6f0001042e0000045e01200197000000000017043500000000000b004b000000200200003900000000020060390000003f01200039000000000151016f0000000002810019000000000012004b00000000010000390000000101004039000004270020009c00000c290000213d000000010010019000000c290000c13d000500000007001d000300000002001d000000400020043f0000000201900039000000000201041a000000010320019000000001042002700000007f0440618f000200000004001d0000001f0040008c00000000040000390000000104002039000000000442013f0000000100400190000002250000c13d00060000000a001d000700000009001d000400000008001d000800000006001d000000030400002900000002050000290000000004540436000100000004001d000000000003004b000007d20000613d000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d0000000206000029000000000006004b00000000020000190000000105000029000007d80000613d000000000101043b00000000020000190000000003250019000000000401041a000000000043043500000001011000390000002002200039000000000062004b000007570000413d000007d80000013d000000000021041b000600000002001d000000000020043f00000424010000410000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b0000000502000029000000010220021000000000011200190000000201100039000000000201041a0000041a00200198000008020000c13d0000000803000029000000000232019f000000000021041b000000000030043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000456011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000000000201041a0000000102200039000003dd0320019700000008003000ba000008ea0000c13d000000080000006b00000000010000390000000401006039000004590200004100000000002104350000041e0100004100000f70000104300000045e011001970000000602000029000000a0022000390000000000120435000000040000006b000000200200003900000000020060390000003f012000390000045d021001970000000501200029000000000021004b00000000020000390000000102004039000004270010009c0000000603000029000000080400002900000c290000213d000000010020019000000c290000c13d000000400010043f00000005010000290000000001130436000400000001001d0000000101400039000000000201041a000000010320019000000001042002700000007f0440618f000500000004001d0000001f0040008c00000000040000390000000104002039000000000442013f0000000100400190000002250000c13d000000400400043d000300000004001d00000005050000290000000004540436000200000004001d000000000003004b000008a90000613d000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d0000000505000029000000000005004b00000000020000190000000206000029000008af0000613d000000000101043b00000000020000190000000003260019000000000401041a000000000043043500000001011000390000002002200039000000000052004b000007ca0000413d000008af0000013d0000045e0120019700000001020000290000000000120435000000020000006b000000200200003900000000020060390000003f012000390000045d021001970000000301200029000000000021004b00000000020000390000000102004039000004270010009c00000008080000290000000703000029000000060400002900000c290000213d000000010020019000000c290000c13d000000400010043f0000000302300039000000000202041a000000800300003900000000033104360000008005100039000000000404043300000000004504350000045d074001970000001f0640018f000000a005100039000000000058004b000008140000813d000000000007004b000007fe0000613d00000008096000290000000008650019000000200880008a000000200990008a000000000a780019000000000b790019000000000b0b04330000000000ba0435000000200770008c000007f80000c13d000000000006004b0000082b0000613d0000000008050019000008200000013d0000045501000041000000000010043f0000041e0100004100000f7000010430000000080000006b00000000010000190000080d0000613d000000070100002900000020011000390000000101100367000000000101043b000000080400002900000003024002100000045f0220027f0000045f02200167000000000221016f00000001014002100000095b0000013d0000000008750019000000000007004b0000081d0000613d0000000809000029000000000a050019000000009b090434000000000aba043600000000008a004b000008190000c13d000000000006004b0000082b0000613d000800080070002d0000000306600210000000000708043300000000076701cf000000000767022f000000080900002900000000090904330000010006600089000000000969022f00000000066901cf000000000676019f0000000000680435000000000654001900000000000604350000001f044000390000045d044001970000000005540019000000000415004900000000004304350000000403000029000000000403043300000000034504360000045d064001970000001f0540018f000000050030006b000008490000813d000000000006004b000008450000613d00000005085000290000000007530019000000200770008a000000200880008a0000000009670019000000000a680019000000000a0a04330000000000a90435000000200660008c0000083f0000c13d000000000005004b000008600000613d0000000007030019000008550000013d0000000007630019000000000006004b000008520000613d00000005080000290000000009030019000000008a0804340000000009a90436000000000079004b0000084e0000c13d000000000005004b000008600000613d000500050060002d0000000305500210000000000607043300000000065601cf000000000656022f000000050800002900000000080804330000010005500089000000000858022f00000000055801cf000000000565019f0000000000570435000000ff0220018f000000000534001900000000000504350000001f044000390000045d0440019700000000033400190000000004130049000000400510003900000000004504350000000304000029000000000404043300000000034304360000045d064001970000001f0540018f000000010030006b000008800000813d000000000006004b0000087c0000613d00000001085000290000000007530019000000200770008a000000200880008a0000000009670019000000000a680019000000000a0a04330000000000a90435000000200660008c000008760000c13d000000000005004b000008970000613d00000000070300190000088c0000013d0000000007630019000000000006004b000008890000613d00000001080000290000000009030019000000008a0804340000000009a90436000000000079004b000008850000c13d000000000005004b000008970000613d000100010060002d0000000305500210000000000607043300000000065601cf000000000656022f000000010800002900000000080804330000010005500089000000000858022f00000000055801cf000000000565019f000000000057043500000000053400190000000000050435000000040020008c000001610000213d000000600510003900000000002504350000001f024000390000045d0220019700000000031300490000000002230019000003dd0020009c000003dd020080410000006002200210000003dd0010009c000003dd010080410000004001100210000000000112019f00000f6f0001042e0000045e0120019700000002020000290000000000120435000000050000006b000000200200003900000000020060390000003f012000390000045d021001970000000301200029000000000021004b00000000020000390000000102004039000004270010009c000000080300002900000c290000213d000000010020019000000c290000c13d000000400010043f0000000401000029000000030200002900000000002104350000000201300039000000000201041a000000010320019000000001042002700000007f0440618f000500000004001d0000001f0040008c00000000040000390000000104002039000000000442013f0000000100400190000002250000c13d000000400400043d000300000004001d00000005050000290000000004540436000200000004001d000000000003004b000009600000613d000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d0000000505000029000000000005004b00000000020000190000000206000029000009660000613d000000000101043b00000000020000190000000003260019000000000401041a000000000043043500000001011000390000002002200039000000000052004b000008e20000413d000009660000013d000000000021041b0000000001000414000003dd0010009c000003dd01008041000000c001100210000003df011001c70000800d02000039000000040300003900000457040000410000000005000019000000080600002900000006070000290f6e0f640000040f0000000100200190000007160000613d0000000601000029000000000010043f0000000201000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b0000000702000029000000000021041b0000000801000029000000000010043f0000000301000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b0000000702000029000000000020043f000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b0000000602000029000000000021041b000000400100043d0000000000210435000003dd0010009c000003dd0100804100000040011002100000000002000414000003dd0020009c000003dd02008041000000c002200210000000000112019f000003e2011001c70000800d0200003900000003030000390000045804000041000000080500002900000007060000290f6e0f640000040f0000000100200190000007160000613d000000400100043d00000006020000290000000000210435000003dd0010009c000003dd01008041000000400110021000000444011001c700000f6f0001042e0000000104000367000000000300001900000006060000290000000005630019000000000554034f000000000505043b000000000051041b00000001011000390000002003300039000000000023004b000009440000413d000000080020006c000009580000813d00000008020000290000000302200210000000f80220018f0000045f0220027f0000045f0220016700000006033000290000000103300367000000000303043b000000000223016f000000000021041b000000010100003900000008020000290000000102200210000000000112019f0000000502000029000000000012041b000000000100001900000f6f0001042e0000045e0120019700000002020000290000000000120435000000050000006b000000200200003900000000020060390000003f012000390000045d021001970000000301200029000000000021004b00000000020000390000000102004039000004270010009c0000000603000029000000080400002900000c290000213d000000010020019000000c290000c13d000000400010043f0000004001300039000500000001001d000000030200002900000000002104350000000301400039000000000101041a000000ff0110018f000000040010008c000001610000213d00000006020000290000006002200039000800000002001d0000000000120435000000000010043f0000000501000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000000101043b000000000201041a000000010320019000000001042002700000007f0440618f000300000004001d0000001f0040008c00000000040000390000000104002039000000000442013f0000000100400190000002250000c13d000000400400043d000100000004001d00000003050000290000000004540436000200000004001d000000000003004b000009b80000613d000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d0000000306000029000000000006004b00000000020000190000000205000029000009be0000613d000000000101043b00000000020000190000000003250019000000000401041a000000000043043500000001011000390000002002200039000000000062004b000009b00000413d000009be0000013d0000045e0120019700000002020000290000000000120435000000030000006b000000200200003900000000020060390000003f012000390000045d021001970000000101200029000000000021004b00000000020000390000000102004039000004270010009c00000c290000213d000000010020019000000c290000c13d000000400010043f00000008020000290000000002020433000000040020008c000001610000213d000000040300002900000000070304330000000503000029000000000803043300000006030000290000000005030433000000a003100039000000400030043f000000800310003900000000000304350000000004030019000000090020008c0000000a3220011a000000f806300210000000010340008a00000000090304330000042809900197000000000669019f00000429066001c70000000000630435000009d70000213d00000000014100490000008101100039000000210240008a000800000002001d0000000000120435000000400100043d00000020021000390000042a06000041000600000002001d0000000000620435000000010200002900000000060204330000045d0b6001970000001f0a60018f0000002a09100039000000020090006b00000a100000813d00000000000b004b000009ff0000613d000000020da00029000000000ca90019000000200cc0008a000000200dd0008a000000000ebc0019000000000fbd0019000000000f0f04330000000000fe0435000000200bb0008c000009f90000c13d00000000000a004b00000a260000613d000000020b00002900000a1c0000013d000000080000006b000000000100001900000a080000613d00000006010000290000000001010433000000080400002900000003024002100000045f0220027f0000045f02200167000000000121016f0000000102400210000000000121019f00000c200000013d000000000cb9001900000000000b004b00000a180000613d000000020d00002900000000de0d04340000000009e904360000000000c9004b00000a140000c13d00000000000a004b00000a260000613d000000020bb0002900000000090c0019000000030aa00210000000000c090433000000000cac01cf000000000cac022f000000000b0b0433000001000aa00089000000000bab022f000000000aab01cf000000000aca019f0000000000a9043500000000091600190000002a069000390000042b0a0000410000000000a60435000000006a0504340000045d0da001970000001f0ca0018f000000350b9000390000000000b6004b00000a400000813d00000000000d004b00000a3c0000613d000000000fc60019000000000ecb0019000000200ee0008a000000200ff0008a0000000002de00190000000004df001900000000040404330000000000420435000000200dd0008c00000a360000c13d00000000000c004b00000a560000613d000000000d06001900000a4c0000013d000000000edb001900000000000d004b00000a480000613d000000000f06001900000000f20f0434000000000b2b04360000000000eb004b00000a440000c13d00000000000c004b00000a560000613d000000000dd60019000000000b0e00190000000302c0021000000000040b043300000000042401cf000000000424022f000000000c0d04330000010002200089000000000c2c022f00000000022c01cf000000000242019f00000000002b043500000000029a001900000035042000390000042c09000041000000000094043500000038042000390000042d0900004100000000009404350000002a0920003900000000a80804340000045d0d8001970000001f0c80018f000000480b2000390000000000ba004b00000a730000813d00000000000d004b00000a700000613d0000000002ca00190000000004cb0019000000200e40008a000000200f20008a0000000002de00190000000004df001900000000040404330000000000420435000000200dd0008c00000a6a0000c13d00000000000c004b00000a7f0000c13d00000a890000013d000000000edb001900000000000d004b00000a7b0000613d000000000f0a001900000000f20f0434000000000b2b04360000000000eb004b00000a770000c13d00000000000c004b00000a890000613d000000000ada0019000000000b0e00190000000302c0021000000000040b043300000000042401cf000000000424022f000000000a0a04330000010002200089000000000a2a022f00000000022a01cf000000000242019f00000000002b043500000000028900190000001e042000390000042c08000041000000000084043500000021042000390000042e0800004100000000008404350000000b0820003900000000970704340000045d0c7001970000001f0b70018f0000002b0a2000390000000000a9004b00000aa60000813d00000000000c004b00000aa30000613d0000000002b900190000000004ba0019000000200d40008a000000200e20008a0000000002cd00190000000004ce001900000000040404330000000000420435000000200cc0008c00000a9d0000c13d00000000000b004b00000ab20000c13d00000abc0000013d000000000dca001900000000000c004b00000aae0000613d000000000e09001900000000e20e0434000000000a2a04360000000000da004b00000aaa0000c13d00000000000b004b00000abc0000613d0000000009c90019000000000a0d00190000000302b0021000000000040a043300000000042401cf000000000424022f00000000090904330000010002200089000000000929022f00000000022901cf000000000242019f00000000002a0435000000000278001900000020042000390000042c07000041000000000074043500000023042000390000042f070000410000000000740435000000520420003900000430070000410000000000740435000000320420003900000431070000410000000000740435000000130720003900000000050504330000045d0a5001970000001f0950018f0000005308200039000000000086004b00000adf0000813d00000000000a004b00000adc0000613d00000000029600190000000004980019000000200b40008a000000200c20008a0000000002ab00190000000004ac001900000000040404330000000000420435000000200aa0008c00000ad60000c13d000000000009004b00000aeb0000c13d00000af50000013d000000000ba8001900000000000a004b00000ae70000613d000000000c06001900000000c20c043400000000082804360000000000b8004b00000ae30000c13d000000000009004b00000af50000613d0000000006a6001900000000080b00190000000302900210000000000408043300000000042401cf000000000424022f00000000060604330000010002200089000000000626022f00000000022601cf000000000242019f000000000028043500000000025700190000004004200039000004320500004100000000005404350000006404200039000004300500004100000000005404350000004404200039000004330500004100000000005404350000000d05200039000000010400002900000000060404330000045d096001970000001f0860018f0000006507200039000000020070006b00000b160000813d000000000009004b00000b130000613d00000002028000290000000004870019000000200a40008a000000200b20008a00000000029a001900000000049b001900000000040404330000000000420435000000200990008c00000b0d0000c13d000000000008004b00000b220000c13d00000b2d0000013d000000000a970019000000000009004b00000b1e0000613d000000020b00002900000000b20b043400000000072704360000000000a7004b00000b1a0000c13d000000000008004b00000b2d0000613d000200020090002d00000000070a00190000000302800210000000000407043300000000042401cf000000000424022f000000020800002900000000080804330000010002200089000000000828022f00000000022801cf000000000242019f000000000027043500000000026500190000005804200039000004320500004100000000005404350000009c04200039000004340500004100000000005404350000007c04200039000004350500004100000000005404350000005c04200039000004360500004100000000005404350000003305200039000000080400002900000000040404330000045d084001970000001f0740018f0000009e06200039000000000063004b00000b510000813d000000000008004b00000b4e0000613d00000000027300190000000009760019000000200990008a000000200a20008a0000000002890019000000000b8a0019000000000b0b04330000000000b20435000000200880008c00000b480000c13d000000000007004b00000b5d0000c13d00000b670000013d0000000009860019000000000008004b00000b590000613d000000000a03001900000000a20a04340000000006260436000000000096004b00000b550000c13d000000000007004b00000b670000613d000000000383001900000000060900190000000302700210000000000706043300000000072701cf000000000727022f00000000030304330000010002200089000000000323022f00000000022301cf000000000272019f000000000026043500000000024500190000006b03200039000004370400004100000000004304350000006c032000390000043804000041000000000043043500000000021200490000004f0320003900000000003104350000008e022000390000045d022001970000000003120019000000000023004b00000000040000390000000104004039000004270030009c00000c290000213d000000010040019000000c290000c13d000000400030043f0000000004010433000000000004004b00000b820000c13d0000006001000039000000000903001900000bc50000013d00000439020000410000001f0020043f0000043a020000410000003f0020043f00000006064000290000000007060433000000000006043500000020053000390000000202400039000000030220011a000000020220021000000000083200190000002009800039000700000005001d000000000a00043d000004280aa001970000000301100039000000000b010433000000120cb002700000003f0cc0018f000000000c0c0433000000f80cc00210000000000aca019f0000000000a0043f0000000c0ab002700000003f0aa0018f000000000a0a0433000000f80aa00210000000010c00043d000004280cc00197000000000aac019f0000000100a0043f000000060ab002700000003f0aa0018f000000000a0a0433000000f80aa00210000000020c00043d000004280cc00197000000000aac019f0000000200a0043f0000003f0ab0018f000000000a0a0433000000f80aa00210000000030b00043d000004280bb00197000000000aab019f0000000300a0043f000000000a00043d0000000000a504350000000405500039000000000095004b00000b900000413d00000000007604350000004001800039000000400010043f000000031040011a000000000001004b0000000004000019000000ff0110c18f000000020410c11900000000014500490000043b04000041000000000041043500000000000504350000000000230435000000400900043d000000000103001900000020029000390000043c03000041000000000032043500000000010104330000045d041001970000001f0310018f0000003d02900039000000070020006b00000bde0000813d000000000004004b00000bda0000613d00000007063000290000000005320019000000200550008a000000200660008a0000000007450019000000000846001900000000080804330000000000870435000000200440008c00000bd40000c13d000000000003004b00000bf50000613d000000000502001900000bea0000013d0000000005420019000000000004004b00000be70000613d0000000706000029000000000702001900000000680604340000000007870436000000000057004b00000be30000c13d000000000003004b00000bf50000613d000700070040002d0000000303300210000000000405043300000000043401cf000000000434022f000000070600002900000000060604330000010003300089000000000636022f00000000033601cf000000000343019f0000000000350435000000000221001900000000000204350000001d02100039000800000009001d00000000002904350000003d0210003900000000010900190f6e0d5a0000040f0000002001000039000000400200043d000700000002001d000000000212043600000008010000290f6e0d160000040f0000000702000029000004790000013d000000010320008a0000000503300270000000000431001900000020030000390000000104400039000000050600002900000000056300190000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000c0b0000c13d000000080020006c00000c1d0000813d00000008020000290000000302200210000000f80220018f0000045f0220027f0000045f0220016700000005033000290000000003030433000000000223016f000000000021041b0000000801000029000000010110021000000001011001bf0000000702000029000000000012041b000000a00100043d000500000001001d0000000021010434000600000002001d000800000001001d000004270010009c00000c2f0000a13d0000044801000041000000000010043f0000004101000039000000040010043f000004490100004100000f700001043000000007010000290000000101100039000400000001001d000000000101041a000000010010019000000001021002700000007f0220618f000300000002001d0000001f0020008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d0000000301000029000000200010008c00000c5c0000413d0000000401000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000008030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000003010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b00000c5c0000813d000000000002041b0000000102200039000000000012004b00000c580000413d00000008010000290000001f0010008c00000c700000a13d0000000401000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000200200008a0000000802200180000000000101043b00000c7d0000c13d000000200300003900000c8a0000013d000000080000006b000000000100001900000c750000613d00000006010000290000000001010433000000080400002900000003024002100000045f0220027f0000045f02200167000000000121016f0000000102400210000000000121019f00000c980000013d000000010320008a0000000503300270000000000431001900000020030000390000000104400039000000050600002900000000056300190000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000c830000c13d000000080020006c00000c950000813d00000008020000290000000302200210000000f80220018f0000045f0220027f0000045f0220016700000005033000290000000003030433000000000223016f000000000021041b0000000801000029000000010110021000000001011001bf0000000402000029000000000012041b000000c00100043d000800000001001d0000000021010434000500000002001d000600000001001d000004270010009c00000c290000213d00000007010000290000000201100039000400000001001d000000000101041a000000010010019000000001021002700000007f0220618f000300000002001d0000001f0020008c00000000020000390000000102002039000000000121013f0000000100100190000002250000c13d0000000301000029000000200010008c00000cce0000413d0000000401000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d00000006030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000003010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b00000cce0000813d000000000002041b0000000102200039000000000012004b00000cca0000413d00000006010000290000001f0010008c00000ce20000a13d0000000401000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f0000000100200190000007160000613d000000200200008a0000000602200180000000000101043b00000cef0000c13d000000200300003900000cfb0000013d000000060000006b000000000100001900000ce70000613d00000005010000290000000001010433000000060400002900000003024002100000045f0220027f0000045f02200167000000000121016f0000000102400210000000000121019f00000d090000013d000000010320008a000000050330027000000000043100190000002003000039000000010440003900000008053000290000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000cf40000c13d000000060020006c00000d060000813d00000006020000290000000302200210000000f80220018f0000045f0220027f0000045f0220016700000008033000290000000003030433000000000223016f000000000021041b0000000601000029000000010110021000000001011001bf0000000402000029000000000012041b000000e00100043d000000040010008c000001610000213d00000007020000290000000302200039000000000302041a0000045e03300197000000000113019f000000000012041b000000000100001900000f6f0001042e000000004301043400000000013204360000045d063001970000001f0530018f000000000014004b00000d2c0000813d000000000006004b00000d280000613d00000000085400190000000007510019000000200770008a000000200880008a0000000009670019000000000a680019000000000a0a04330000000000a90435000000200660008c00000d220000c13d000000000005004b00000d420000613d000000000701001900000d380000013d0000000007610019000000000006004b00000d350000613d00000000080400190000000009010019000000008a0804340000000009a90436000000000079004b00000d310000c13d000000000005004b00000d420000613d00000000046400190000000305500210000000000607043300000000065601cf000000000656022f00000000040404330000010005500089000000000454022f00000000045401cf000000000464019f0000000000470435000000000431001900000000000404350000001f033000390000045d023001970000000001210019000000000001042d000004600010009c00000d580000213d000000630010008c00000d580000a13d00000001030003670000000401300370000000000101043b0000041a0010009c00000d580000213d0000002402300370000000000202043b0000041a0020009c00000d580000213d0000004403300370000000000303043b000000000001042d000000000100001900000f70000104300000001f022000390000045d022001970000000001120019000000000021004b00000000020000390000000102004039000004270010009c00000d660000213d000000010020019000000d660000c13d000000400010043f000000000001042d0000044801000041000000000010043f0000004101000039000000040010043f000004490100004100000f70000104300003000000000002000000000201041a000000010320019000000001062002700000007f0660618f0000001f0060008c00000000040000390000000104002039000000000043004b00000dab0000c13d000000400500043d0000000004650436000000000003004b00000d960000613d000100000004001d000300000006001d000200000005001d000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f000000010020019000000db70000613d0000000306000029000000000006004b00000d9c0000613d000000000201043b0000000001000019000000020500002900000001070000290000000003170019000000000402041a000000000043043500000001022000390000002001100039000000000061004b00000d8e0000413d00000d9e0000013d0000045e012001970000000000140435000000000006004b0000002001000039000000000100603900000d9e0000013d000000000100001900000002050000290000003f011000390000045d021001970000000001520019000000000021004b00000000020000390000000102004039000004270010009c00000db10000213d000000010020019000000db10000c13d000000400010043f0000000001050019000000000001042d0000044801000041000000000010043f0000002201000039000000040010043f000004490100004100000f70000104300000044801000041000000000010043f0000004101000039000000040010043f000004490100004100000f7000010430000000000100001900000f7000010430000000050010008c00000dc90000813d000000000010043f0000000501000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f000000010020019000000dcf0000613d000000000101043b000000000001042d0000044801000041000000000010043f0000002101000039000000040010043f000004490100004100000f7000010430000000000100001900000f70000104300001000000000002000100000001001d000000000010043f00000424010000410000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f000000010020019000000e050000613d00000001030000290000000102300210000000000101043b0000000001210019000000000101041a0000041a0010019800000e070000613d000000000030043f0000000201000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f000000010020019000000e050000613d000000000101043b000000000101041a000000000010043f0000000401000039000000200010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000425011001c700008010020000390f6e0f690000040f000000010020019000000e050000613d000000000101043b0000000301100039000000000101041a000000ff0110018f000000000001042d000000000100001900000f70000104300000044d01000041000000000010043f0000044e0100004100000f70000104300007000000000002000400000002001d000600000001001d000700000003001d000000000030043f000000000100041100000424011001c70000001c0010043f0000000001000414000003dd0010009c000003dd01008041000000c001100210000003e2011001c700008010020000390f6e0f690000040f000000010020019000000e7e0000613d00000006020000290000041a0320019700000007020000290000000102200210000000000101043b0000000002210019000000000502041a0000041a01500197000000000031004b00000e800000c13d000000000001004b00000e800000613d000000000030043f0000000106200039000000000706041a0000000001000411000000000031004b000500000003001d00000e470000613d000000000071004b00000e470000613d000100000007001d000200000006001d000300000005001d000600000002001d0000000001000414000003dd0010009c000003dd01008041000000c0011002100000043f011001c700008010020000390f6e0f690000040f000000010020019000000e7e0000613d000000000101043b000000000101041a000000000001004b0000000503000029000000060200002900000003050000290000000206000029000000010700002900000e8e0000613d00000004010000290000041a04100197000000000007004b00000e4c0000613d000000000006041b000000000134013f000000000151013f000000000012041b0000000001000414000003dd0010009c000003dd01008041000000c00110021000000456011001c70000801002000039000600000004001d0f6e0f690000040f000000010020019000000e7e0000613d000000000101043b000000000201041a000000010220008a000000000021041b0000000601000029000000000010043f0000000001000414000003dd0010009c000003dd01008041000000c00110021000000456011001c700008010020000390f6e0f690000040f000000010020019000000e7e0000613d000000000101043b000000000201041a0000000102200039000003dd03200197000000060600002900000000006300aa00000e870000613d000000000021041b0000000001000414000003dd0010009c000003dd01008041000000c001100210000003df011001c70000800d0200003900000004030000390000045704000041000000050500002900000007070000290f6e0f640000040f000000010020019000000e7e0000613d000000000001042d000000000100001900000f7000010430000000000001004b00000000010000390000000401006039000004610200004100000000002104350000041e0100004100000f7000010430000000000006004b00000000010000390000000401006039000004590200004100000000002104350000041e0100004100000f70000104300000045101000041000000000010043f0000041e0100004100000f7000010430000003de01000041000000000101041a0000000002000411000000000012004b00000e980000c13d000000000001042d0000044701000041000000000010043f0000041e0100004100000f700001043000030000000000020000000006020019000000400800043d000000800280003900000080050000390000000000520435000000600280003900000000003204350000041a0110019700000040028000390000000000120435000000200180003900000000020004110000000000210435000004620100004100000000001804350000000019040434000000a0028000390000000000920435000000000009004b000300000008001d00000ee10000613d000200000006001d000003dd0090009c000003dd0200004100000000020940190000006002200210000003dd0010009c000003dd010080410000004001100210000000000112019f0000000002000414000003dd0020009c000003dd02008041000000c002200210000000000112019f0000000402000039000100000009001d0f6e0f690000040f000000010900002900000003080000290000006002100270000003dd02200197000000000092004b00000000020980190000001f0320018f000000c0058000390000046304200198000000000245001900000ed30000613d000000000601034f000000006706043c0000000005750436000000000025004b00000ecf0000c13d000000000003004b000000020600002900000ee10000613d000000000141034f0000000303300210000000000402043300000000043401cf000000000434022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000141019f00000000001204350000001c01800039000003dd0010009c000003dd010080410000004001100210000000a402900039000003dd0020009c000003dd020080410000006002200210000000000112019f0000000002000414000003dd0020009c000003dd02008041000000c002200210000000000112019f00000000020600190f6e0f640000040f000000030a0000290000006003100270000003dd03300197000000200030008c000000200400003900000000040340190000001f0540018f000000200640019000000000046a001900000f010000613d000000000701034f00000000080a0019000000007907043c0000000008980436000000000048004b00000efd0000c13d000000000005004b00000f0e0000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f0000000000540435000000000003004b00000001022061bf000000010020019000000f160000613d00000000010a0433000004640010009c00000f340000c13d000000000001042d0000001f0430018f000004630530019800000000025a001900000f200000613d000000000601034f0000000307000029000000006806043c0000000007870436000000000027004b00000f1c0000c13d000000000004004b00000f2d0000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000000302000029000003dd0020009c000003dd020080410000004002200210000000000121019f00000f70000104300000046501000041000000000010043f0000041e0100004100000f70000104300001000000000002000003de02000041000000000502041a00000000020004140000041a06100197000003dd0020009c000003dd02008041000000c001200210000003df011001c70000800d020000390000000303000039000003e004000041000100000006001d0f6e0f640000040f000000010020019000000f4c0000613d000003de010000410000000102000029000000000021041b000000000001042d000000000100001900000f7000010430000000000001042f000003dd0010009c000003dd010080410000004001100210000003dd0020009c000003dd020080410000006002200210000000000112019f0000000002000414000003dd0020009c000003dd02008041000000c002200210000000000112019f000003df011001c700008010020000390f6e0f690000040f000000010020019000000f620000613d000000000101043b000000000001042d000000000100001900000f700001043000000f67002104210000000102000039000000000001042d0000000002000019000000000001042d00000f6c002104230000000102000039000000000001042d0000000002000019000000000001042d00000f6e0000043200000f6f0001042e00000f700001043000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392702000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e005b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc0200000000000000000000000000000000000020000000000000000000000000436f6d6d6f6e000000000000000000000000000000000000000000000000000c1471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017b556e636f6d6d6f6e00000000000000000000000000000000000000000000001089832631fb3c3307a103ba2c84ab569c64d6182a18893dcd163f0f1c2090733a5261726500000000000000000000000000000000000000000000000000000008a9bc9a3a348c357ba16b37005d7e6b3236198c0e939f4af8c5f19b8deeb8ebc045706963000000000000000000000000000000000000000000000000000000083eec716f11ba9e820c81ca75eb978ffb45831ef8b7a53e5e422c26008e1ca6d54c6567656e64617279000000000000000000000000000000000000000000001200000002000000000000000000000000000000400000010000000000000000000000000000000000000000000000000000000000000000000000000057ab46ec00000000000000000000000000000000000000000000000000000000a22cb46400000000000000000000000000000000000000000000000000000000e985e9c400000000000000000000000000000000000000000000000000000000f2fde38a00000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000fee81cf400000000000000000000000000000000000000000000000000000000e985e9c500000000000000000000000000000000000000000000000000000000f04e283e00000000000000000000000000000000000000000000000000000000c87b56dc00000000000000000000000000000000000000000000000000000000c87b56dd00000000000000000000000000000000000000000000000000000000de5f880d00000000000000000000000000000000000000000000000000000000a22cb46500000000000000000000000000000000000000000000000000000000b88d4fde00000000000000000000000000000000000000000000000000000000715018a5000000000000000000000000000000000000000000000000000000008da5cb5a000000000000000000000000000000000000000000000000000000008da5cb5b0000000000000000000000000000000000000000000000000000000095d89b4100000000000000000000000000000000000000000000000000000000715018a6000000000000000000000000000000000000000000000000000000007a60cf8e000000000000000000000000000000000000000000000000000000006d84fe52000000000000000000000000000000000000000000000000000000006d84fe530000000000000000000000000000000000000000000000000000000070a082310000000000000000000000000000000000000000000000000000000057ab46ed000000000000000000000000000000000000000000000000000000006352211e000000000000000000000000000000000000000000000000000000001d9aa5d70000000000000000000000000000000000000000000000000000000042842e0d0000000000000000000000000000000000000000000000000000000054ce3bf40000000000000000000000000000000000000000000000000000000054ce3bf50000000000000000000000000000000000000000000000000000000054d1f13d0000000000000000000000000000000000000000000000000000000042842e0e0000000000000000000000000000000000000000000000000000000043a5bcde0000000000000000000000000000000000000000000000000000000023b872dc0000000000000000000000000000000000000000000000000000000023b872dd0000000000000000000000000000000000000000000000000000000025692962000000000000000000000000000000000000000000000000000000001d9aa5d800000000000000000000000000000000000000000000000000000000230cf2630000000000000000000000000000000000000000000000000000000006fdde0200000000000000000000000000000000000000000000000000000000095ea7b200000000000000000000000000000000000000000000000000000000095ea7b30000000000000000000000000000000000000000000000000000000017e92f670000000000000000000000000000000000000000000000000000000006fdde0300000000000000000000000000000000000000000000000000000000081812fc0000000000000000000000000000000000000000000000000000000001ffc9a7000000000000000000000000000000000000000000000000000000000476bbcd00000000000000000000000000000000000000000000000000000000053b94bb000000000000000000000000ffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000389a75e10000000000000000000000000000000000000020000000800000000000000000000000000000000000000000000000000000000000000000000000007448fbae00000000000000000000000000000000000000040000001c000000000000000002000000000000000000000000000000000000200000000c0000000000000000796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d955391320200000200000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000006f5e88180000000000000000000000000000000000000000000000000a5a2e7a000000007d8825530a5a2e7a0000000000000000000000000000000000000000000000000200000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff7f000000000000000000000000000000000000000000000000ffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff30000000000000000000000000000000000000000000000000000000000000007b226e616d65223a2022000000000000000000000000000000000000000000002043617472696467653a20000000000000000000000000000000000000000000222c200000000000000000000000000000000000000000000000000000000000226465736372697074696f6e223a20220000000000000000000000000000000022696d616765223a2022000000000000000000000000000000000000000000002261747472696275746573223a205b000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000007b2274726169745f74797065223a2022426f7373222c202276616c7565223a20227d2c20000000000000000000000000000000000000000000000000000000007b2274726169745f74797065223a202254696572222c202276616c7565223a203a20000000000000000000000000000000000000000000000000000000000000202274726169745f74797065223a2022526172697479222c202276616c7565227b22646973706c61795f74797065223a2022626f6f73745f6e756d626572222c7d000000000000000000000000000000000000000000000000000000000000005d2c2000000000000000000000000000000000000000000000000000000000004142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3d3d000000000000000000000000000000000000000000000000000000000000646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b83020000020000000000000000000000000000002400000000000000000000000002000000000000000000000000000000000000300000000c000000000000000017307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3143415452494447450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000008f4eb6040000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000fffffffffffffefffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c920000000000000000000000000000000000000000000000000000000082b429004e487b71000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffe0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd5d00dbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1dceea21b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000008c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925000000000000000000000000000000000000000000000000000000004b6e7f1800000000000000000000000000000000000000000000000000000000ceea21b64b687567612042617368204361747269646765000000000000000000000000007f7c871f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c991cbb1020000000000000000000000000000000000001c0000000c0000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efd89480546d2104236880c775ae371f225a757792869fc5b202a88abcde9475eb000000000000000000000000000000000000000000000000ea553b3401336cea00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000080ac58cd000000000000000000000000000000000000000000000000000000005b5e139fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000ceea21b6a114810000000000000000000000000000000000000000000000000000000000150b7a0200000000000000000000000000000000000000000000000000000000ffffffe0150b7a020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d1a57ed6814a2096ebd3ae246a2127cc7c3b8d7ee30baa7a3b2c9e9cd1c6f5b14e6c31eb
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.