Search is not available for this dataset
chain_id
uint64
1
1
block_number
uint64
19.5M
20M
block_hash
stringlengths
64
64
transaction_hash
stringlengths
64
64
deployer_address
stringlengths
40
40
factory_address
stringlengths
40
40
contract_address
stringlengths
40
40
creation_bytecode
stringlengths
0
98.3k
runtime_bytecode
stringlengths
0
49.2k
creation_sourcecode
stringlengths
0
976k
1
20,290,294
f5152160ee00eafb38c2f1b10aec517396dc6ff214daeb9b002f14c344fc133c
b5beec2fccd2275d80ed16d153e34006cb90d1bdfd0cef534e883839c1f12a29
41ed843a086f44b8cb23decc8170c132bc257874
29ef46035e9fa3d570c598d3266424ca11413b0c
51e9387d3672fafacdc1fd6171f283754dc436b7
3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "contracts/Forwarder.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" }, "contracts/ERC20Interface.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n" }, "contracts/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n" }, "contracts/IForwarder.sol": { "content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,296
b0eddc9a4644bce8c6ed57c54112bebc1f3c6d692d2367e2a4c82ae93fcd2c99
43e7f2e0a2aa028d91f7db238310d6129d07dd057990c4e38200859ab92cf35b
54c1c72df0ab9934ae0144155ecad3f0b66e5155
beaed7aa0470d0339693e9ee4fe93b4d8ed9a29c
ad87c931271a5f9a3f6a06d822955a4242dce3f1
60a060405234801561001057600080fd5b5060405161069b38038061069b83398101604081905261002f916102dc565b3360805280511561005b576100558161004661006b565b6001600160a01b03169061018a565b50610065565b61006361006b565b505b506103cd565b60805160408051600481526024810182526020810180516001600160e01b0316635c60da1b60e01b1790529051600092839283926001600160a01b03909216916100b59190610388565b600060405180830381855afa9150503d80600081146100f0576040519150601f19603f3d011682016040523d82523d6000602084013e6100f5565b606091505b509150915081610118576040516373a769bf60e01b815260040160405180910390fd5b8051602014610148578051604051630f9cc98f60e31b815260040161013f91815260200190565b60405180910390fd5b8080602001905181019061015c91906103a4565b92506001600160a01b03831661018557604051630fb678c360e41b815260040160405180910390fd5b505090565b606061019f6001600160a01b038416836101a6565b9392505050565b6060600080846001600160a01b0316846040516101c39190610388565b600060405180830381855af49150503d80600081146101fe576040519150601f19603f3d011682016040523d82523d6000602084013e610203565b606091505b50909250905061021485838361021d565b95945050505050565b6060826102325761022d82610279565b61019f565b815115801561024957506001600160a01b0384163b155b1561027257604051639996b31560e01b81526001600160a01b038516600482015260240161013f565b5092915050565b8051156102895780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b634e487b7160e01b600052604160045260246000fd5b60005b838110156102d35781810151838201526020016102bb565b50506000910152565b6000602082840312156102ee57600080fd5b81516001600160401b038082111561030557600080fd5b818401915084601f83011261031957600080fd5b81518181111561032b5761032b6102a2565b604051601f8201601f19908116603f01168101908382118183101715610353576103536102a2565b8160405282815287602084870101111561036c57600080fd5b61037d8360208301602088016102b8565b979650505050505050565b6000825161039a8184602087016102b8565b9190910192915050565b6000602082840312156103b657600080fd5b81516001600160a01b038116811461019f57600080fd5b6080516102b46103e76000396000609601526102b46000f3fe608060405261000c61000e565b005b61001e610019610020565b6101ee565b565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f5c60da1b0000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016916100c19190610212565b600060405180830381855afa9150503d80600081146100fc576040519150601f19603f3d011682016040523d82523d6000602084013e610101565b606091505b50915091508161013d576040517f73a769bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516020146101865780516040517f7ce64c7800000000000000000000000000000000000000000000000000000000815260040161017d91815260200190565b60405180910390fd5b8080602001905181019061019a9190610241565b925073ffffffffffffffffffffffffffffffffffffffff83166101e9576040517ffb678c3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505090565b3660008037600080366000845af43d6000803e80801561020d573d6000f35b3d6000fd5b6000825160005b818110156102335760208186018101518583015201610219565b506000920191825250919050565b60006020828403121561025357600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461027757600080fd5b939250505056fea26469706673582212202ec1949ecfe82485aa612adf872fb1e39804952056e27578b0f565714823e88064736f6c63430008160033000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000641794bb3c000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e1000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000233c8fe42703e8000000000000000000000000000000000000000000000000000000000000
608060405261000c61000e565b005b61001e610019610020565b6101ee565b565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f5c60da1b0000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000beaed7aa0470d0339693e9ee4fe93b4d8ed9a29c16916100c19190610212565b600060405180830381855afa9150503d80600081146100fc576040519150601f19603f3d011682016040523d82523d6000602084013e610101565b606091505b50915091508161013d576040517f73a769bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516020146101865780516040517f7ce64c7800000000000000000000000000000000000000000000000000000000815260040161017d91815260200190565b60405180910390fd5b8080602001905181019061019a9190610241565b925073ffffffffffffffffffffffffffffffffffffffff83166101e9576040517ffb678c3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505090565b3660008037600080366000845af43d6000803e80801561020d573d6000f35b3d6000fd5b6000825160005b818110156102335760208186018101518583015201610219565b506000920191825250919050565b60006020828403121561025357600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461027757600080fd5b939250505056fea26469706673582212202ec1949ecfe82485aa612adf872fb1e39804952056e27578b0f565714823e88064736f6c63430008160033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/proxy/Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback\n * function and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n" }, "contracts/base/proxy/ImmutableBeaconProxy.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {Proxy} from \"@openzeppelin/contracts/proxy/Proxy.sol\";\nimport {IBeacon} from \"contracts/interfaces/base/proxy/IBeacon.sol\";\nimport {SafeCall} from \"contracts/libraries/SafeCall.sol\";\n\ncontract ImmutableBeaconProxy is Proxy {\n using {SafeCall.safeDelegateCall} for address;\n\n address private immutable beacon;\n\n error BeaconCallFailed();\n error BeaconReturnedUnexpectedNumberOfBytes(uint256);\n error BeaconReturnedAddressZero();\n\n constructor(bytes memory initDataWithSelector) {\n beacon = msg.sender;\n\n if (initDataWithSelector.length > 0) {\n _implementation().safeDelegateCall(initDataWithSelector);\n } else {\n // Make sure msg.sender implements IBeacon interface\n _implementation();\n }\n }\n\n function _implementation() internal view override returns (address impl) {\n (bool success, bytes memory result) = beacon.staticcall(\n abi.encodeCall(IBeacon.implementation, ())\n );\n\n if (!success) revert BeaconCallFailed();\n if (result.length != 32) revert BeaconReturnedUnexpectedNumberOfBytes(result.length);\n\n impl = abi.decode(result, (address));\n if (impl == address(0)) revert BeaconReturnedAddressZero();\n }\n}\n" }, "contracts/interfaces/accountAbstraction/interpreter/Command.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {CommandLibrary} from \"contracts/libraries/CommandLibrary.sol\";\n\n/**\n * @title Command\n * @notice Contains arguments for a low-level call.\n * @dev This struct allows deferring the call's execution, suspending it by passing it to another function or contract.\n * @dev `target` The address to be called.\n * @dev `value` Value to send in the call.\n * @dev `payload` Encoded call with function selector and arguments.\n */\nstruct Command {\n address target;\n uint256 value;\n bytes payload;\n}\n\nusing CommandLibrary for Command global;\n" }, "contracts/interfaces/base/proxy/IBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IBeacon {\n error ImplementationAddressIsZero();\n\n /**\n * This upgrade will affect all Beacon Proxies that use this Beacon\n * @param newImplementation New implementation to delegate calls from Beacon Proxies\n */\n function upgradeTo(address newImplementation) external;\n\n /**\n * Returns address of the current used by Beacon Proxies\n */\n function implementation() external view returns (address);\n}\n" }, "contracts/libraries/CommandLibrary.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Command} from \"contracts/interfaces/accountAbstraction/interpreter/Command.sol\";\nimport {SafeCall} from \"contracts/libraries/SafeCall.sol\";\n\n/**\n * @notice Utility to convert often-used methods into a Command object\n */\nlibrary CommandPresets {\n function approve(\n address _token,\n address _to,\n uint256 _amount\n ) internal pure returns (Command memory cmd_) {\n cmd_.target = _token;\n cmd_.payload = abi.encodeCall(IERC20.approve, (_to, _amount));\n }\n\n function transfer(\n address _token,\n address _to,\n uint256 _amount\n ) internal pure returns (Command memory cmd_) {\n cmd_.target = _token;\n cmd_.payload = abi.encodeCall(IERC20.transfer, (_to, _amount));\n }\n}\n\nlibrary CommandExecutor {\n using SafeCall for Command[];\n\n function execute(Command[] calldata _cmds) external {\n _cmds.safeCallAll();\n }\n}\n\nlibrary CommandLibrary {\n using CommandLibrary for Command[];\n\n function last(Command[] memory _self) internal pure returns (Command memory) {\n return _self[_self.length - 1];\n }\n\n function asArray(Command memory _self) internal pure returns (Command[] memory result_) {\n result_ = new Command[](1);\n result_[0] = _self;\n }\n\n function concat(\n Command memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](2);\n result_[0] = _self;\n result_[1] = _cmd;\n }\n\n function concat(\n Command memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_cmds.length + 1);\n result_[0] = _self;\n for (uint256 i = 1; i < result_.length; i++) {\n result_[i] = _cmds[i - 1];\n }\n }\n\n function append(\n Command[] memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_self.length + _cmds.length);\n uint256 i;\n for (; i < _self.length; i++) {\n result_[i] = _self[i];\n }\n for (; i < result_.length; i++) {\n result_[i] = _cmds[i - _self.length];\n }\n }\n\n function push(\n Command[] memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_self.length + 1);\n for (uint256 i; i < _self.length; i++) {\n result_[i] = _self[i];\n }\n result_[_self.length] = _cmd;\n }\n\n function unshift(\n Command[] memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](1 + _self.length);\n result_[0] = _cmd;\n for (uint256 i = 1; i < result_.length; i++) {\n result_[i] = _self[i - 1];\n }\n }\n\n function unshift(\n Command[] memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_cmds.length + _self.length);\n uint256 i;\n for (; i < _cmds.length; i++) {\n result_[i] = _cmds[i];\n }\n for (; i < result_.length; i++) {\n result_[i] = _self[i - _cmds.length];\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n if (_amount != 0) {\n result_ = CommandPresets.approve(_token, _self.target, _amount).concat(_self);\n } else {\n result_ = _self.asArray();\n }\n }\n\n function populateWithRevokeAndApprove(\n Command memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n return\n CommandPresets.approve(_token, _self.target, 0).concat(\n _self.populateWithApprove(_token, _amount)\n );\n }\n\n function populateWithApprove(\n Command[] memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n if (_amount != 0) {\n result_ = _self.unshift(\n CommandPresets.approve(_token, _self[_self.length - 1].target, _amount)\n );\n } else {\n result_ = _self;\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[2] memory _tokens,\n uint256[2] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(_self);\n } else {\n if (_amounts[0] != 0) {\n result_ = populateWithApprove(_self, _tokens[0], _amounts[0]);\n } else {\n result_ = populateWithApprove(_self, _tokens[1], _amounts[1]);\n }\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[3] memory _tokens,\n uint256[3] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0 && _amounts[2] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(CommandPresets.approve(_tokens[2], _self.target, _amounts[2]))\n .push(_self);\n } else {\n if (_amounts[0] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[1], _tokens[2]],\n [_amounts[1], _amounts[2]]\n );\n } else if (_amounts[1] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[2]],\n [_amounts[0], _amounts[2]]\n );\n } else {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1]],\n [_amounts[0], _amounts[1]]\n );\n }\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[4] memory _tokens,\n uint256[4] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0 && _amounts[2] != 0 && _amounts[3] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(CommandPresets.approve(_tokens[2], _self.target, _amounts[2]))\n .push(CommandPresets.approve(_tokens[3], _self.target, _amounts[3]))\n .push(_self);\n } else {\n if (_amounts[0] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[1], _tokens[2], _tokens[3]],\n [_amounts[1], _amounts[2], _amounts[3]]\n );\n } else if (_amounts[1] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[2], _tokens[3]],\n [_amounts[0], _amounts[2], _amounts[3]]\n );\n } else if (_amounts[2] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1], _tokens[3]],\n [_amounts[0], _amounts[1], _amounts[3]]\n );\n } else {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1], _tokens[2]],\n [_amounts[0], _amounts[1], _amounts[2]]\n );\n }\n }\n }\n}\n" }, "contracts/libraries/SafeCall.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {Command} from \"contracts/interfaces/accountAbstraction/interpreter/Command.sol\";\n\n/**\n * @notice Safe methods performing a low-level calls that revert\n * if the call was not successful\n */\nlibrary SafeCall {\n using Address for address;\n\n function safeCallAll(Command[] memory _cmds) internal {\n for (uint256 i; i < _cmds.length; i++) {\n safeCall(_cmds[i]);\n }\n }\n\n function safeCall(Command memory _cmd) internal returns (bytes memory result_) {\n result_ = safeCall(_cmd.target, _cmd.value, _cmd.payload);\n }\n\n function safeCall(address _target, bytes memory _data) internal returns (bytes memory result_) {\n result_ = safeCall(_target, 0, _data);\n }\n\n function safeCall(\n address _target,\n uint256 _value,\n bytes memory _data\n ) internal returns (bytes memory result_) {\n result_ = _target.functionCallWithValue(_data, _value);\n }\n\n function safeDelegateCall(\n address _target,\n bytes memory _data\n ) internal returns (bytes memory result_) {\n result_ = _target.functionDelegateCall(_data);\n }\n}\n" } }, "settings": { "viaIR": false, "optimizer": { "enabled": true, "runs": 1000000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
20,290,298
421002ba22d0693e807c08fa5fed916e8b3d8aa712b5ee10016476d63b382443
4a3ac4925e04699b72f41270030a0355c7d121643c9c5038784ecccbc1aba595
54c1c72df0ab9934ae0144155ecad3f0b66e5155
54c1c72df0ab9934ae0144155ecad3f0b66e5155
c21e24c380b0e53e4738c8c1c1f8c27d94fb6d38
610180604052600160ff1b60805262000019600062000101565b6101005262000029600162000101565b6101205262000039600262000101565b6101405262000049600362000101565b610160523480156200005a57600080fd5b50604051620034d0380380620034d08339810160408190526200007d916200015c565b806001600160a01b038116620000a6576040516302f4924160e51b815260040160405180910390fd5b6001600160a01b0390811660a05282161580620000ca57506001600160a01b038116155b15620000e9576040516302f4924160e51b815260040160405180910390fd5b6001600160a01b0391821660c0521660e05262000194565b600060fe1960ff831601620001325760405163a57c436b60e01b815260ff8316600482015260240160405180910390fd5b600160ff83161b92915050565b80516001600160a01b03811681146200015757600080fd5b919050565b600080604083850312156200017057600080fd5b6200017b836200013f565b91506200018b602084016200013f565b90509250929050565b60805160a05160c05160e05161010051610120516101405161016051613219620002b76000396000818161066d0152818161070c015281816107da01528181610d8101528181610dd10152610e0001526000818161062f0152818161072d015281816107ad01528181610b1c01528181610d310152610db00152600081816104cd01528181610c9101528181610ce101528181610d1001528181610d600152610fc601526000818161098601528181610cc001528181610e210152610f34015260008181610373015261080d01526000818161014a0152818161046d015281816106b101528181610ed901526110c40152600081816102d401526119e5015260008181610c7001528181610f55015281816112a90152611a7a01526132196000f3fe60806040526004361061012c5760003560e01c806377e747ca116100a557806390631d8e11610074578063d9caed1211610059578063d9caed12146103dd578063ec8accbc146103fd578063f966aac51461041d57600080fd5b806390631d8e146103aa578063c1611f62146103bd57600080fd5b806377e747ca146102f65780638129fc1c1461034c578063866517e8146103615780638da5cb5b1461039557600080fd5b80633db0a3e4116100fc57806356a5c6e8116100e157806356a5c6e8146102825780635c1c6dcd146102a25780636290865d146102c257600080fd5b80633db0a3e414610240578063506450e91461026057600080fd5b80624006e0146101385780632c86d98e146101965780632cd16a8a146101f3578063354030231461021d57600080fd5b3661013357005b600080fd5b34801561014457600080fd5b5061016c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156101a257600080fd5b506000546001546101c79173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520161018d565b3480156101ff57600080fd5b5061020861043d565b6040805192835260208301919091520161018d565b61023061022b3660046120ef565b610453565b604051901515815260200161018d565b34801561024c57600080fd5b5061023061025b366004612108565b610697565b34801561026c57600080fd5b5061028061027b36600461217d565b6109b6565b005b34801561028e57600080fd5b5061028061029d36600461217d565b610a4b565b3480156102ae57600080fd5b506102806102bd3660046121dd565b610b12565b3480156102ce57600080fd5b5061016c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561030257600080fd5b5061030b610b60565b60408051958652602086019490945273ffffffffffffffffffffffffffffffffffffffff92831693850193909352166060830152608082015260a00161018d565b34801561035857600080fd5b50610280610ba8565b34801561036d57600080fd5b5061016c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156103a157600080fd5b5061016c610eb2565b6102806103b836600461223a565b610ec1565b3480156103c957600080fd5b506102806103d836600461217d565b611017565b3480156103e957600080fd5b506102806103f83660046122fb565b6110ac565b34801561040957600080fd5b5061028061041836600461217d565b611143565b34801561042957600080fd5b5061028061043836600461217d565b611235565b60008061044861127f565b600354915091509091565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146104cb576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006104fe6104f761127f565b82906112ce565b610546578061050b61127f565b6040517f8e653d8c000000000000000000000000000000000000000000000000000000008152600481019290925260248201526044016104c2565b8260000361059c576000546040517f3b9b86ec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911660048201526024016104c2565b82600260008282546105ae919061236b565b909155506105bc9050610eb2565b73ffffffffffffffffffffffffffffffffffffffff167fd81dc1ab773745d6113d7b56db63d143b38c598946eaf907995eeba71ee2879984600254600060010154610607919061237e565b6040805192835260208301919091520160405180910390a26001546002540361065c576106537f00000000000000000000000000000000000000000000000000000000000000006112da565b60019150610691565b6001546002541115610691576106917f00000000000000000000000000000000000000000000000000000000000000006112da565b50919050565b60003373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461070a576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000176107586104f761127f565b610765578061050b61127f565b60008390036107a0576040517fe1d362ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107d06107ab61127f565b7f00000000000000000000000000000000000000000000000000000000000000001490565b156107fe576107fe7f00000000000000000000000000000000000000000000000000000000000000006112da565b60005b838110156109805760007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16634763f39d8787858181106108595761085961239e565b905060200281019061086b91906123cd565b6040518263ffffffff1660e01b815260040161088791906129c1565b6000604051808303816000875af11580156108a6573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526108ec9190810190612bc6565b6040517fd670be0c000000000000000000000000000000000000000000000000000000008152909150734ba21ef812547ea7440f4caef9aaabc406f7ef1d9063d670be0c9061093f908490600401612d8d565b60006040518083038186803b15801561095757600080fd5b505af4925050508015610968575060015b610977576000935050506109af565b50600101610801565b506109aa7f00000000000000000000000000000000000000000000000000000000000000006112da565b600191505b5092915050565b3330146109ef576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f842600355565b6000600255610a05610eb2565b73ffffffffffffffffffffffffffffffffffffffff167f89e8e0cb75caa917b6632d3053b50971462790ea99d9fe21b4b27ce71017515660405160405180910390a25050565b333014610a84576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a8d42600355565b6000610a97610eb2565b9050610aa16112f6565b50600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600181905560405173ffffffffffffffffffffffffffffffffffffffff8316917fa29911196d428d7968f8bde7515181a391bfa16e26042f789f3f2da7665e25de91a2505050565b610b1a6113be565b7f0000000000000000000000000000000000000000000000000000000000000000610b466104f761127f565b610b53578061050b61127f565b610b5c8261142e565b5050565b6000806000806000610b7061127f565b600354610b7b610eb2565b600054600154939992985090965073ffffffffffffffffffffffffffffffffffffffff1694509092509050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546002919068010000000000000000900460ff1680610bf75750805467ffffffffffffffff808416911610155b15610c2e576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80547fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001667ffffffffffffffff83161768010000000000000000178155610cbb7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000003063ec8accbc611440565b610d0b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000003063ec8accbc611440565b610d5b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000003063c1611f62611440565b610dab7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000003063506450e9611440565b610dfb7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000003063f966aac5611440565b610e4b7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000306356a5c6e8611440565b80547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050565b6000610ebc611544565b905090565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610f32576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000017610f806104f761127f565b610f8d578061050b61127f565b60005b83811015610fc057610fb8858583818110610fad57610fad61239e565b90506040020161156e565b600101610f90565b506110107f000000000000000000000000000000000000000000000000000000000000000086868686604051602001610ffc9493929190612e42565b6040516020818303038152906040526116ae565b5050505050565b333014611050576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61105942600355565b6000600255611066610eb2565b73ffffffffffffffffffffffffffffffffffffffff167f2077f6e031a8faa17b96131641b087822c10522fe1a94841987eccbe8f619f7f60405160405180910390a25050565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461111d576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b61113e73ffffffffffffffffffffffffffffffffffffffff841683836118a5565b505050565b33301461117c576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61118542600355565b6000808061119584860186612f02565b9250925092506111a4836118f4565b508051600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9283161790556020820151600155604051908416907f5f0651ae754e97c1f9b53e213b4ac64372e4f4441d6e6851b17bd129b4426076906112269085908590612fc9565b60405180910390a25050505050565b33301461126e576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127742600355565b610a05610eb2565b7fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30d54806112cb57507f000000000000000000000000000000000000000000000000000000000000000090565b90565b81811615155b92915050565b6112f381604051806020016040528060008152506116ae565b50565b600080611301611544565b91508173ffffffffffffffffffffffffffffffffffffffff1603611351576040517fbd704aae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61137a60007f608a8c8eefc529e0455c0b7a17a3c2a1a40a7f0cd5045e3b46a4aa8ae853476d55565b60405173ffffffffffffffffffffffffffffffffffffffff8216907f870217a7bae08cb1e27777025a86e87ce4df51b0e2c6cc144ed2976e78a5c79a90600090a290565b6113c6611544565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461142c576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b565b6112f38161143b836119d4565b611a43565b600061144c8585611a76565b60008181527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e6020526040902054909150156114be576040517fb57df58c00000000000000000000000000000000000000000000000000000000815260048101869052602481018590526044016104c2565b60009081527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e6020908152604090912080547fffffffffffffffff0000000000000000000000000000000000000000000000001663ffffffff939093169390911b77ffffffffffffffffffffffffffffffffffffffff0000000016929092171790555050565b6000610ebc7f608a8c8eefc529e0455c0b7a17a3c2a1a40a7f0cd5045e3b46a4aa8ae853476d5490565b80602001356000036115d2576115876020820182613061565b6040517f3b9b86ec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911660048201526024016104c2565b60006115ff6115e46020840184613061565b73ffffffffffffffffffffffffffffffffffffffff16611b57565b61163557611630306116146020850185613061565b73ffffffffffffffffffffffffffffffffffffffff1690611ba7565b611637565b475b90508160200135811015610b5c576116526020830183613061565b6040517f43bb149000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260208301356024820152604481018290526064016104c2565b6116b782611bdc565b6116f0576040517f815506a8000000000000000000000000000000000000000000000000000000008152600481018390526024016104c2565b60006117036116fd61127f565b84611a76565b60008181527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e602052604090205490915061177d5761174061127f565b6040517f8d157bec0000000000000000000000000000000000000000000000000000000081526004810191909152602481018490526044016104c2565b7f1c0c6794b8c626515ef0eaa59cf29f712f686771b359ff1a5a05738b92d054846117a661127f565b60408051918252602082018690520160405180910390a17fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30d83905560008181527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e602090815260409182902054915160e083901b7fffffffff000000000000000000000000000000000000000000000000000000001681529082901c73ffffffffffffffffffffffffffffffffffffffff169163ffffffff169061186e90859060040161307e565b600060405180830381600087803b15801561188857600080fd5b505af115801561189c573d6000803e3d6000fd5b50505050505050565b81601452806034526fa9059cbb00000000000000000000000060005260206000604460106000875af13d1560016000511417166118ea576390b8ec186000526004601cfd5b6000603452505050565b600073ffffffffffffffffffffffffffffffffffffffff8216611943576040517f55e7da0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61194b611544565b9050611975827f608a8c8eefc529e0455c0b7a17a3c2a1a40a7f0cd5045e3b46a4aa8ae853476d55565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f76122449b9f9900601b55986d5b53d8d3f84b676f9d216a64334a914d21accd160405160405180910390a3919050565b6060600060405180606001604052807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001611a2f85611c31565b90529050611a3c81611cdd565b9392505050565b600081806020019051810190611a599190612bc6565b90508260200135611a6982611cf6565b6020015261113e81611d40565b60007f00000000000000000000000000000000000000000000000000000000000000008314158015611aae5750611aac83611bdc565b155b15611ae8576040517f815506a8000000000000000000000000000000000000000000000000000000008152600481018490526024016104c2565b611af182611bdc565b611b2a576040517f815506a8000000000000000000000000000000000000000000000000000000008152600481018390526024016104c2565b50604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b600073ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14806112d457505073ffffffffffffffffffffffffffffffffffffffff161590565b6000816014526f70a0823100000000000000000000000060005260208060246010865afa601f3d111660205102905092915050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611a3c8382167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810181169015011590565b60606000611c426020840184613061565b9050600080611c546040860186613091565b905011611c8757611c82611c7d8373ffffffffffffffffffffffffffffffffffffffff16611d77565b611db9565b611cc9565b611c946040850185613091565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050505b9050611cd58183611e79565b949350505050565b60606112d4826000015183602001518460400151611eab565b604080516060808201835260008083526020830152918101919091528160018351611d2191906130f6565b81518110611d3157611d3161239e565b60200260200101519050919050565b60005b8151811015610b5c57611d6e828281518110611d6157611d6161239e565b6020026020010151611cdd565b50600101611d43565b6060611d8282611ece565b805161307882526002017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe90910190815292915050565b606060006040518060400160405280601481526020017f656d70747944617461466f724f70657261746f7200000000000000000000000081525083604051602001611e05929190613109565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815282825280516020918201207fffffffff00000000000000000000000000000000000000000000000000000000169083015280516004818403018152602490920190529392505050565b604051606090611e9490849060009085851b90602001613160565b604051602081830303815290604052905092915050565b6060611cd573ffffffffffffffffffffffffffffffffffffffff85168385611f5b565b60606040519050608081016040526f30313233343536373839616263646566600f526002810190506028815260208101600060288201528260601b925060005b808101820184821a600f81165160018301538060041c518253505060018101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed01611f0e575050919050565b606081471015611f99576040517fcd7860590000000000000000000000000000000000000000000000000000000081523060048201526024016104c2565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051611fc291906131d1565b60006040518083038185875af1925050503d8060008114611fff576040519150601f19603f3d011682016040523d82523d6000602084013e612004565b606091505b509150915061201486838361201e565b9695505050505050565b6060826120335761202e826120ad565b611a3c565b8151158015612057575073ffffffffffffffffffffffffffffffffffffffff84163b155b156120a6576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016104c2565b5080611a3c565b8051156120bd5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561210157600080fd5b5035919050565b6000806020838503121561211b57600080fd5b823567ffffffffffffffff8082111561213357600080fd5b818501915085601f83011261214757600080fd5b81358181111561215657600080fd5b8660208260051b850101111561216b57600080fd5b60209290920196919550909350505050565b6000806020838503121561219057600080fd5b823567ffffffffffffffff808211156121a857600080fd5b818501915085601f8301126121bc57600080fd5b8135818111156121cb57600080fd5b86602082850101111561216b57600080fd5b6000602082840312156121ef57600080fd5b813567ffffffffffffffff81111561220657600080fd5b820160608185031215611a3c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146112f357600080fd5b600080600080848603608081121561225157600080fd5b853561225c81612218565b9450602086013567ffffffffffffffff8082111561227957600080fd5b818801915088601f83011261228d57600080fd5b81358181111561229c57600080fd5b8960208260061b85010111156122b157600080fd5b60208301965080955050505060407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0820112156122ed57600080fd5b509295919450926040019150565b60008060006060848603121561231057600080fd5b833561231b81612218565b9250602084013561232b81612218565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156112d4576112d461233c565b81810360008312801583831316838312821617156109af576109af61233c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6183360301811261240157600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261244057600080fd5b830160208101925035905067ffffffffffffffff81111561246057600080fd5b8060051b360382131561247257600080fd5b9250929050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126124ae57600080fd5b830160208101925035905067ffffffffffffffff8111156124ce57600080fd5b80360382131561247257600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261255a57600080fd5b90910192915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261255a57600080fd5b8035825260006125aa6020830183612479565b604060208601526125bf6040860182846124dd565b95945050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126125fd57600080fd5b830160208101925035905067ffffffffffffffff81111561261d57600080fd5b8060061b360382131561247257600080fd5b803561263a81612218565b73ffffffffffffffffffffffffffffffffffffffff168252602090810135910152565b81835260208301925060008160005b848110156126915761267e868361262f565b604095860195919091019060010161266c565b5093949350505050565b60008383855260208086019550808560051b8301018460005b8781101561277e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08584030189526126ed8288612563565b60406126f98283612479565b82875261270983880182846124dd565b91505061271887840184612526565b925085810387870152606061272d8485612563565b81835261273c82840182612597565b91505061274b888501856125c8565b8383038a85015261275d83828461265d565b958501359390940192909252505050988401989250908301906001016126b4565b5090979650505050505050565b60008383855260208086019550808560051b8301018460005b8781101561277e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08584030189526127dd8288612563565b60406127e98283612479565b8287526127f983880182846124dd565b91505061280887840184612526565b925085810387870152606061281d8485612563565b81835261282c82840182612597565b9150508784013588830152612843838501856125c8565b94508282038484015261285782868361265d565b9d89019d97505050938601935050506001016127a4565b60008383855260208086019550808560051b830101846000805b888110156129b3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868503018a526128c18389612563565b60406128cd8283612479565b8288526128dd83890182846124dd565b915050878301357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61843603018112612913578586fd5b878203898901529092019160a061292a8480612479565b82845261293a83850182846124dd565b9250505061294a89850185612479565b8383038b85015261295c8382846124dd565b868601359585019590955250505060608084013590820152608092830135929161298584612218565b73ffffffffffffffffffffffffffffffffffffffff9390931691015299850199935091840191600101612888565b509198975050505050505050565b6020815260006129d1838461240b565b60a060208501528060c08501527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612a0b57600080fd5b60051b808260e086013783019050612a26602085018561240b565b60c0858403016040860152612a3f60e08401828461269b565b92505050612a50604085018561240b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe080868503016060870152612a8684838561278b565b9350612a95606088018861240b565b9350915080868503016080870152612aae84848461286e565b9350612abd608088018861240b565b93509150808685030160a08701525061201483838361286e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516060810167ffffffffffffffff81118282101715612b2957612b29612ad7565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612b7657612b76612ad7565b604052919050565b600067ffffffffffffffff821115612b9857612b98612ad7565b5060051b60200190565b60005b83811015612bbd578181015183820152602001612ba5565b50506000910152565b60006020808385031215612bd957600080fd5b825167ffffffffffffffff80821115612bf157600080fd5b818501915085601f830112612c0557600080fd5b8151612c18612c1382612b7e565b612b2f565b81815260059190911b83018401908481019088831115612c3757600080fd5b8585015b83811015612d3657805185811115612c535760008081fd5b860160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d038101821315612c8a5760008081fd5b612c92612b06565b8a840151612c9f81612218565b81526040848101518c830152928401519289841115612cbe5760008081fd5b83850194508e603f860112612cd557600093508384fd5b8b850151935089841115612ceb57612ceb612ad7565b612cfb8c84601f87011601612b2f565b92508383528e81858701011115612d125760008081fd5b612d21848d8501838801612ba2565b81019190915285525050918601918601612c3b565b5098975050505050505050565b60008151808452612d5b816020860160208601612ba2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b83811015612e34578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805173ffffffffffffffffffffffffffffffffffffffff16845287810151888501528601516060878501819052612e2081860183612d43565b968901969450505090860190600101612db6565b509098975050505050505050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201819052810183905260008460a08301825b86811015612e9757612e84828461262f565b6040928301929190910190600101612e72565b5091506125bf9050604083018461262f565b600060408284031215612ebb57600080fd5b6040516040810181811067ffffffffffffffff82111715612ede57612ede612ad7565b6040529050808235612eef81612218565b8152602092830135920191909152919050565b600080600060808486031215612f1757600080fd5b8335612f2281612218565b925060208481013567ffffffffffffffff811115612f3f57600080fd5b8501601f81018713612f5057600080fd5b8035612f5e612c1382612b7e565b8082825260208201915060208360061b850101925089831115612f8057600080fd5b6020840193505b82841015612fab57612f998a85612ea9565b82528482019150604084019350612f87565b8096505050505050612fc08560408601612ea9565b90509250925092565b606080825283519082018190526000906020906080840190828701845b8281101561302c57613019848351805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b6040939093019290840190600101612fe6565b5050508092505050611a3c6020830184805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b60006020828403121561307357600080fd5b8135611a3c81612218565b602081526000611a3c6020830184612d43565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126130c657600080fd5b83018035915067ffffffffffffffff8211156130e157600080fd5b60200191503681900382131561247257600080fd5b818103818111156112d4576112d461233c565b6000835161311b818460208801612ba2565b83519083019061312f818360208801612ba2565b7f28290000000000000000000000000000000000000000000000000000000000009101908152600201949350505050565b60008451613172818460208901612ba2565b7fffffffffffffffffffffffff000000000000000000000000000000000000000094909416919093019081527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000091909116600c82015260200192915050565b60008251612401818460208701612ba256fea26469706673582212202593872145cc58d10334b40f2ea100ca2ecd0823025b53854b61afbd56854d6464736f6c63430008160033000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e10000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a
60806040526004361061012c5760003560e01c806377e747ca116100a557806390631d8e11610074578063d9caed1211610059578063d9caed12146103dd578063ec8accbc146103fd578063f966aac51461041d57600080fd5b806390631d8e146103aa578063c1611f62146103bd57600080fd5b806377e747ca146102f65780638129fc1c1461034c578063866517e8146103615780638da5cb5b1461039557600080fd5b80633db0a3e4116100fc57806356a5c6e8116100e157806356a5c6e8146102825780635c1c6dcd146102a25780636290865d146102c257600080fd5b80633db0a3e414610240578063506450e91461026057600080fd5b80624006e0146101385780632c86d98e146101965780632cd16a8a146101f3578063354030231461021d57600080fd5b3661013357005b600080fd5b34801561014457600080fd5b5061016c7f000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e181565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156101a257600080fd5b506000546001546101c79173ffffffffffffffffffffffffffffffffffffffff169082565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091520161018d565b3480156101ff57600080fd5b5061020861043d565b6040805192835260208301919091520161018d565b61023061022b3660046120ef565b610453565b604051901515815260200161018d565b34801561024c57600080fd5b5061023061025b366004612108565b610697565b34801561026c57600080fd5b5061028061027b36600461217d565b6109b6565b005b34801561028e57600080fd5b5061028061029d36600461217d565b610a4b565b3480156102ae57600080fd5b506102806102bd3660046121dd565b610b12565b3480156102ce57600080fd5b5061016c7f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a81565b34801561030257600080fd5b5061030b610b60565b60408051958652602086019490945273ffffffffffffffffffffffffffffffffffffffff92831693850193909352166060830152608082015260a00161018d565b34801561035857600080fd5b50610280610ba8565b34801561036d57600080fd5b5061016c7f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a81565b3480156103a157600080fd5b5061016c610eb2565b6102806103b836600461223a565b610ec1565b3480156103c957600080fd5b506102806103d836600461217d565b611017565b3480156103e957600080fd5b506102806103f83660046122fb565b6110ac565b34801561040957600080fd5b5061028061041836600461217d565b611143565b34801561042957600080fd5b5061028061043836600461217d565b611235565b60008061044861127f565b600354915091509091565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e116146104cb576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000026104fe6104f761127f565b82906112ce565b610546578061050b61127f565b6040517f8e653d8c000000000000000000000000000000000000000000000000000000008152600481019290925260248201526044016104c2565b8260000361059c576000546040517f3b9b86ec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911660048201526024016104c2565b82600260008282546105ae919061236b565b909155506105bc9050610eb2565b73ffffffffffffffffffffffffffffffffffffffff167fd81dc1ab773745d6113d7b56db63d143b38c598946eaf907995eeba71ee2879984600254600060010154610607919061237e565b6040805192835260208301919091520160405180910390a26001546002540361065c576106537f00000000000000000000000000000000000000000000000000000000000000046112da565b60019150610691565b6001546002541115610691576106917f00000000000000000000000000000000000000000000000000000000000000086112da565b50919050565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e1161461070a576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b7f00000000000000000000000000000000000000000000000000000000000000087f0000000000000000000000000000000000000000000000000000000000000004176107586104f761127f565b610765578061050b61127f565b60008390036107a0576040517fe1d362ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107d06107ab61127f565b7f00000000000000000000000000000000000000000000000000000000000000041490565b156107fe576107fe7f00000000000000000000000000000000000000000000000000000000000000086112da565b60005b838110156109805760007f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a73ffffffffffffffffffffffffffffffffffffffff16634763f39d8787858181106108595761085961239e565b905060200281019061086b91906123cd565b6040518263ffffffff1660e01b815260040161088791906129c1565b6000604051808303816000875af11580156108a6573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526108ec9190810190612bc6565b6040517fd670be0c000000000000000000000000000000000000000000000000000000008152909150734ba21ef812547ea7440f4caef9aaabc406f7ef1d9063d670be0c9061093f908490600401612d8d565b60006040518083038186803b15801561095757600080fd5b505af4925050508015610968575060015b610977576000935050506109af565b50600101610801565b506109aa7f00000000000000000000000000000000000000000000000000000000000000016112da565b600191505b5092915050565b3330146109ef576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f842600355565b6000600255610a05610eb2565b73ffffffffffffffffffffffffffffffffffffffff167f89e8e0cb75caa917b6632d3053b50971462790ea99d9fe21b4b27ce71017515660405160405180910390a25050565b333014610a84576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a8d42600355565b6000610a97610eb2565b9050610aa16112f6565b50600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600181905560405173ffffffffffffffffffffffffffffffffffffffff8316917fa29911196d428d7968f8bde7515181a391bfa16e26042f789f3f2da7665e25de91a2505050565b610b1a6113be565b7f0000000000000000000000000000000000000000000000000000000000000004610b466104f761127f565b610b53578061050b61127f565b610b5c8261142e565b5050565b6000806000806000610b7061127f565b600354610b7b610eb2565b600054600154939992985090965073ffffffffffffffffffffffffffffffffffffffff1694509092509050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546002919068010000000000000000900460ff1680610bf75750805467ffffffffffffffff808416911610155b15610c2e576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80547fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001667ffffffffffffffff83161768010000000000000000178155610cbb7f80000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000023063ec8accbc611440565b610d0b7f00000000000000000000000000000000000000000000000000000000000000017f00000000000000000000000000000000000000000000000000000000000000023063ec8accbc611440565b610d5b7f00000000000000000000000000000000000000000000000000000000000000027f00000000000000000000000000000000000000000000000000000000000000043063c1611f62611440565b610dab7f00000000000000000000000000000000000000000000000000000000000000027f00000000000000000000000000000000000000000000000000000000000000083063506450e9611440565b610dfb7f00000000000000000000000000000000000000000000000000000000000000047f00000000000000000000000000000000000000000000000000000000000000083063f966aac5611440565b610e4b7f00000000000000000000000000000000000000000000000000000000000000087f0000000000000000000000000000000000000000000000000000000000000001306356a5c6e8611440565b80547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050565b6000610ebc611544565b905090565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e11614610f32576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b7f00000000000000000000000000000000000000000000000000000000000000017f800000000000000000000000000000000000000000000000000000000000000017610f806104f761127f565b610f8d578061050b61127f565b60005b83811015610fc057610fb8858583818110610fad57610fad61239e565b90506040020161156e565b600101610f90565b506110107f000000000000000000000000000000000000000000000000000000000000000286868686604051602001610ffc9493929190612e42565b6040516020818303038152906040526116ae565b5050505050565b333014611050576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61105942600355565b6000600255611066610eb2565b73ffffffffffffffffffffffffffffffffffffffff167f2077f6e031a8faa17b96131641b087822c10522fe1a94841987eccbe8f619f7f60405160405180910390a25050565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e1161461111d576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b61113e73ffffffffffffffffffffffffffffffffffffffff841683836118a5565b505050565b33301461117c576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61118542600355565b6000808061119584860186612f02565b9250925092506111a4836118f4565b508051600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9283161790556020820151600155604051908416907f5f0651ae754e97c1f9b53e213b4ac64372e4f4441d6e6851b17bd129b4426076906112269085908590612fc9565b60405180910390a25050505050565b33301461126e576040517f980d854800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127742600355565b610a05610eb2565b7fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30d54806112cb57507f800000000000000000000000000000000000000000000000000000000000000090565b90565b81811615155b92915050565b6112f381604051806020016040528060008152506116ae565b50565b600080611301611544565b91508173ffffffffffffffffffffffffffffffffffffffff1603611351576040517fbd704aae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61137a60007f608a8c8eefc529e0455c0b7a17a3c2a1a40a7f0cd5045e3b46a4aa8ae853476d55565b60405173ffffffffffffffffffffffffffffffffffffffff8216907f870217a7bae08cb1e27777025a86e87ce4df51b0e2c6cc144ed2976e78a5c79a90600090a290565b6113c6611544565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461142c576040517f32b2baa30000000000000000000000000000000000000000000000000000000081523360048201526024016104c2565b565b6112f38161143b836119d4565b611a43565b600061144c8585611a76565b60008181527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e6020526040902054909150156114be576040517fb57df58c00000000000000000000000000000000000000000000000000000000815260048101869052602481018590526044016104c2565b60009081527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e6020908152604090912080547fffffffffffffffff0000000000000000000000000000000000000000000000001663ffffffff939093169390911b77ffffffffffffffffffffffffffffffffffffffff0000000016929092171790555050565b6000610ebc7f608a8c8eefc529e0455c0b7a17a3c2a1a40a7f0cd5045e3b46a4aa8ae853476d5490565b80602001356000036115d2576115876020820182613061565b6040517f3b9b86ec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911660048201526024016104c2565b60006115ff6115e46020840184613061565b73ffffffffffffffffffffffffffffffffffffffff16611b57565b61163557611630306116146020850185613061565b73ffffffffffffffffffffffffffffffffffffffff1690611ba7565b611637565b475b90508160200135811015610b5c576116526020830183613061565b6040517f43bb149000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116600482015260208301356024820152604481018290526064016104c2565b6116b782611bdc565b6116f0576040517f815506a8000000000000000000000000000000000000000000000000000000008152600481018390526024016104c2565b60006117036116fd61127f565b84611a76565b60008181527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e602052604090205490915061177d5761174061127f565b6040517f8d157bec0000000000000000000000000000000000000000000000000000000081526004810191909152602481018490526044016104c2565b7f1c0c6794b8c626515ef0eaa59cf29f712f686771b359ff1a5a05738b92d054846117a661127f565b60408051918252602082018690520160405180910390a17fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30d83905560008181527fde4001bbdfdfed078acd4ae5c1023679bf2e3e2982cfd37f7c839d62304fe30e602090815260409182902054915160e083901b7fffffffff000000000000000000000000000000000000000000000000000000001681529082901c73ffffffffffffffffffffffffffffffffffffffff169163ffffffff169061186e90859060040161307e565b600060405180830381600087803b15801561188857600080fd5b505af115801561189c573d6000803e3d6000fd5b50505050505050565b81601452806034526fa9059cbb00000000000000000000000060005260206000604460106000875af13d1560016000511417166118ea576390b8ec186000526004601cfd5b6000603452505050565b600073ffffffffffffffffffffffffffffffffffffffff8216611943576040517f55e7da0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61194b611544565b9050611975827f608a8c8eefc529e0455c0b7a17a3c2a1a40a7f0cd5045e3b46a4aa8ae853476d55565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f76122449b9f9900601b55986d5b53d8d3f84b676f9d216a64334a914d21accd160405160405180910390a3919050565b6060600060405180606001604052807f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a73ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001611a2f85611c31565b90529050611a3c81611cdd565b9392505050565b600081806020019051810190611a599190612bc6565b90508260200135611a6982611cf6565b6020015261113e81611d40565b60007f80000000000000000000000000000000000000000000000000000000000000008314158015611aae5750611aac83611bdc565b155b15611ae8576040517f815506a8000000000000000000000000000000000000000000000000000000008152600481018490526024016104c2565b611af182611bdc565b611b2a576040517f815506a8000000000000000000000000000000000000000000000000000000008152600481018390526024016104c2565b50604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b600073ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14806112d457505073ffffffffffffffffffffffffffffffffffffffff161590565b6000816014526f70a0823100000000000000000000000060005260208060246010865afa601f3d111660205102905092915050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611a3c8382167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810181169015011590565b60606000611c426020840184613061565b9050600080611c546040860186613091565b905011611c8757611c82611c7d8373ffffffffffffffffffffffffffffffffffffffff16611d77565b611db9565b611cc9565b611c946040850185613091565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050505b9050611cd58183611e79565b949350505050565b60606112d4826000015183602001518460400151611eab565b604080516060808201835260008083526020830152918101919091528160018351611d2191906130f6565b81518110611d3157611d3161239e565b60200260200101519050919050565b60005b8151811015610b5c57611d6e828281518110611d6157611d6161239e565b6020026020010151611cdd565b50600101611d43565b6060611d8282611ece565b805161307882526002017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe90910190815292915050565b606060006040518060400160405280601481526020017f656d70747944617461466f724f70657261746f7200000000000000000000000081525083604051602001611e05929190613109565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815282825280516020918201207fffffffff00000000000000000000000000000000000000000000000000000000169083015280516004818403018152602490920190529392505050565b604051606090611e9490849060009085851b90602001613160565b604051602081830303815290604052905092915050565b6060611cd573ffffffffffffffffffffffffffffffffffffffff85168385611f5b565b60606040519050608081016040526f30313233343536373839616263646566600f526002810190506028815260208101600060288201528260601b925060005b808101820184821a600f81165160018301538060041c518253505060018101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed01611f0e575050919050565b606081471015611f99576040517fcd7860590000000000000000000000000000000000000000000000000000000081523060048201526024016104c2565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051611fc291906131d1565b60006040518083038185875af1925050503d8060008114611fff576040519150601f19603f3d011682016040523d82523d6000602084013e612004565b606091505b509150915061201486838361201e565b9695505050505050565b6060826120335761202e826120ad565b611a3c565b8151158015612057575073ffffffffffffffffffffffffffffffffffffffff84163b155b156120a6576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016104c2565b5080611a3c565b8051156120bd5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561210157600080fd5b5035919050565b6000806020838503121561211b57600080fd5b823567ffffffffffffffff8082111561213357600080fd5b818501915085601f83011261214757600080fd5b81358181111561215657600080fd5b8660208260051b850101111561216b57600080fd5b60209290920196919550909350505050565b6000806020838503121561219057600080fd5b823567ffffffffffffffff808211156121a857600080fd5b818501915085601f8301126121bc57600080fd5b8135818111156121cb57600080fd5b86602082850101111561216b57600080fd5b6000602082840312156121ef57600080fd5b813567ffffffffffffffff81111561220657600080fd5b820160608185031215611a3c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146112f357600080fd5b600080600080848603608081121561225157600080fd5b853561225c81612218565b9450602086013567ffffffffffffffff8082111561227957600080fd5b818801915088601f83011261228d57600080fd5b81358181111561229c57600080fd5b8960208260061b85010111156122b157600080fd5b60208301965080955050505060407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0820112156122ed57600080fd5b509295919450926040019150565b60008060006060848603121561231057600080fd5b833561231b81612218565b9250602084013561232b81612218565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156112d4576112d461233c565b81810360008312801583831316838312821617156109af576109af61233c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6183360301811261240157600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261244057600080fd5b830160208101925035905067ffffffffffffffff81111561246057600080fd5b8060051b360382131561247257600080fd5b9250929050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126124ae57600080fd5b830160208101925035905067ffffffffffffffff8111156124ce57600080fd5b80360382131561247257600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261255a57600080fd5b90910192915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261255a57600080fd5b8035825260006125aa6020830183612479565b604060208601526125bf6040860182846124dd565b95945050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126125fd57600080fd5b830160208101925035905067ffffffffffffffff81111561261d57600080fd5b8060061b360382131561247257600080fd5b803561263a81612218565b73ffffffffffffffffffffffffffffffffffffffff168252602090810135910152565b81835260208301925060008160005b848110156126915761267e868361262f565b604095860195919091019060010161266c565b5093949350505050565b60008383855260208086019550808560051b8301018460005b8781101561277e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08584030189526126ed8288612563565b60406126f98283612479565b82875261270983880182846124dd565b91505061271887840184612526565b925085810387870152606061272d8485612563565b81835261273c82840182612597565b91505061274b888501856125c8565b8383038a85015261275d83828461265d565b958501359390940192909252505050988401989250908301906001016126b4565b5090979650505050505050565b60008383855260208086019550808560051b8301018460005b8781101561277e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08584030189526127dd8288612563565b60406127e98283612479565b8287526127f983880182846124dd565b91505061280887840184612526565b925085810387870152606061281d8485612563565b81835261282c82840182612597565b9150508784013588830152612843838501856125c8565b94508282038484015261285782868361265d565b9d89019d97505050938601935050506001016127a4565b60008383855260208086019550808560051b830101846000805b888110156129b3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868503018a526128c18389612563565b60406128cd8283612479565b8288526128dd83890182846124dd565b915050878301357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61843603018112612913578586fd5b878203898901529092019160a061292a8480612479565b82845261293a83850182846124dd565b9250505061294a89850185612479565b8383038b85015261295c8382846124dd565b868601359585019590955250505060608084013590820152608092830135929161298584612218565b73ffffffffffffffffffffffffffffffffffffffff9390931691015299850199935091840191600101612888565b509198975050505050505050565b6020815260006129d1838461240b565b60a060208501528060c08501527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612a0b57600080fd5b60051b808260e086013783019050612a26602085018561240b565b60c0858403016040860152612a3f60e08401828461269b565b92505050612a50604085018561240b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe080868503016060870152612a8684838561278b565b9350612a95606088018861240b565b9350915080868503016080870152612aae84848461286e565b9350612abd608088018861240b565b93509150808685030160a08701525061201483838361286e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516060810167ffffffffffffffff81118282101715612b2957612b29612ad7565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612b7657612b76612ad7565b604052919050565b600067ffffffffffffffff821115612b9857612b98612ad7565b5060051b60200190565b60005b83811015612bbd578181015183820152602001612ba5565b50506000910152565b60006020808385031215612bd957600080fd5b825167ffffffffffffffff80821115612bf157600080fd5b818501915085601f830112612c0557600080fd5b8151612c18612c1382612b7e565b612b2f565b81815260059190911b83018401908481019088831115612c3757600080fd5b8585015b83811015612d3657805185811115612c535760008081fd5b860160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d038101821315612c8a5760008081fd5b612c92612b06565b8a840151612c9f81612218565b81526040848101518c830152928401519289841115612cbe5760008081fd5b83850194508e603f860112612cd557600093508384fd5b8b850151935089841115612ceb57612ceb612ad7565b612cfb8c84601f87011601612b2f565b92508383528e81858701011115612d125760008081fd5b612d21848d8501838801612ba2565b81019190915285525050918601918601612c3b565b5098975050505050505050565b60008151808452612d5b816020860160208601612ba2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b83811015612e34578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805173ffffffffffffffffffffffffffffffffffffffff16845287810151888501528601516060878501819052612e2081860183612d43565b968901969450505090860190600101612db6565b509098975050505050505050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201819052810183905260008460a08301825b86811015612e9757612e84828461262f565b6040928301929190910190600101612e72565b5091506125bf9050604083018461262f565b600060408284031215612ebb57600080fd5b6040516040810181811067ffffffffffffffff82111715612ede57612ede612ad7565b6040529050808235612eef81612218565b8152602092830135920191909152919050565b600080600060808486031215612f1757600080fd5b8335612f2281612218565b925060208481013567ffffffffffffffff811115612f3f57600080fd5b8501601f81018713612f5057600080fd5b8035612f5e612c1382612b7e565b8082825260208201915060208360061b850101925089831115612f8057600080fd5b6020840193505b82841015612fab57612f998a85612ea9565b82528482019150604084019350612f87565b8096505050505050612fc08560408601612ea9565b90509250925092565b606080825283519082018190526000906020906080840190828701845b8281101561302c57613019848351805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b6040939093019290840190600101612fe6565b5050508092505050611a3c6020830184805173ffffffffffffffffffffffffffffffffffffffff168252602090810151910152565b60006020828403121561307357600080fd5b8135611a3c81612218565b602081526000611a3c6020830184612d43565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126130c657600080fd5b83018035915067ffffffffffffffff8211156130e157600080fd5b60200191503681900382131561247257600080fd5b818103818111156112d4576112d461233c565b6000835161311b818460208801612ba2565b83519083019061312f818360208801612ba2565b7f28290000000000000000000000000000000000000000000000000000000000009101908152600201949350505050565b60008451613172818460208901612ba2565b7fffffffffffffffffffffffff000000000000000000000000000000000000000094909416919093019081527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000091909116600c82015260200192915050565b60008251612401818460208701612ba256fea26469706673582212202593872145cc58d10334b40f2ea100ca2ecd0823025b53854b61afbd56854d6464736f6c63430008160033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Storage of the initializable contract.\n *\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n * when using with upgradeable contracts.\n *\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n */\n struct InitializableStorage {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n uint64 _initialized;\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool _initializing;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant INITIALIZABLE_STORAGE =\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n /**\n * @dev The contract is already initialized.\n */\n error InvalidInitialization();\n\n /**\n * @dev The contract is not initializing.\n */\n error NotInitializing();\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint64 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n * production.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n // Cache values to avoid duplicated sloads\n bool isTopLevelCall = !$._initializing;\n uint64 initialized = $._initialized;\n\n // Allowed calls:\n // - initialSetup: the contract is not in the initializing state and no previous version was\n // initialized\n // - construction: the contract is initialized at version 1 (no reininitialization) and the\n // current contract is just being deployed\n bool initialSetup = initialized == 0 && isTopLevelCall;\n bool construction = initialized == 1 && address(this).code.length == 0;\n\n if (!initialSetup && !construction) {\n revert InvalidInitialization();\n }\n $._initialized = 1;\n if (isTopLevelCall) {\n $._initializing = true;\n }\n _;\n if (isTopLevelCall) {\n $._initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint64 version) {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing || $._initialized >= version) {\n revert InvalidInitialization();\n }\n $._initialized = version;\n $._initializing = true;\n _;\n $._initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n _checkInitializing();\n _;\n }\n\n /**\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n */\n function _checkInitializing() internal view virtual {\n if (!_isInitializing()) {\n revert NotInitializing();\n }\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing) {\n revert InvalidInitialization();\n }\n if ($._initialized != type(uint64).max) {\n $._initialized = type(uint64).max;\n emit Initialized(type(uint64).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint64) {\n return _getInitializableStorage()._initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _getInitializableStorage()._initializing;\n }\n\n /**\n * @dev Returns a pointer to the storage namespace.\n */\n // solhint-disable-next-line var-name-mixedcase\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n assembly {\n $.slot := INITIALIZABLE_STORAGE\n }\n }\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n" }, "contracts/accountAbstraction/marginAccount/Account.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport {SafeTransferLib} from \"solady/src/utils/SafeTransferLib.sol\";\n\nimport {IJitCompiler} from \"contracts/interfaces/accountAbstraction/interpreter/IJitCompiler.sol\";\nimport {\n Asset,\n IAccount,\n Script\n} from \"contracts/interfaces/accountAbstraction/marginAccount/IAccount.sol\";\nimport {\n AddressMustNotBeZero,\n AmountMustNotBeZero,\n ArrayMustNotBeEmpty,\n UnauthorizedAccount\n} from \"contracts/interfaces/base/CommonErrors.sol\";\nimport {IInitializable} from \"contracts/interfaces/common/IInitializable.sol\";\n\nimport {OwnableAssignable} from \"contracts/base/auth/OwnableAssignable.sol\";\nimport {State, StateMachine} from \"contracts/base/StateMachine.sol\";\nimport {Command, CommandExecutor} from \"contracts/libraries/CommandLibrary.sol\";\n\nimport {CommandSafeExecutor} from \"./base/CommandSafeExecutor.sol\";\n\ncontract Account is\n IAccount,\n IInitializable,\n Initializable,\n OwnableAssignable,\n StateMachine,\n CommandSafeExecutor\n{\n using SafeTransferLib for address;\n using CommandExecutor for Command[];\n\n Asset public override leverage;\n uint256 private supplied;\n uint256 private stateSwitchTime;\n\n address public immutable marginEngine;\n IJitCompiler public immutable compiler;\n\n /* solhint-disable immutable-vars-naming */\n State private immutable STATE_CLOSED = newStateFromId(0);\n State private immutable STATE_REGISTERED = newStateFromId(1);\n State private immutable STATE_OPENED = newStateFromId(2);\n State private immutable STATE_SUSPENDED = newStateFromId(3);\n /* solhint-enable immutable-vars-naming */\n\n modifier onlyMarginEngine() {\n if (msg.sender != marginEngine) revert UnauthorizedAccount(msg.sender);\n _;\n }\n\n constructor(address _marginEngine, address _compliance) CommandSafeExecutor(_compliance) {\n if (_marginEngine == address(0) || _compliance == address(0)) revert AddressMustNotBeZero();\n marginEngine = _marginEngine;\n // NOTE: jitCompiler share diamond storage with compliance,\n // they are both facets in whitelisting diamond\n compiler = IJitCompiler(_compliance);\n }\n\n function initialize() external override reinitializer(2) {\n // X -> REGISTERED\n createTransition(STATE_UNDEFINED, STATE_REGISTERED, this.registerAccount);\n createTransition(STATE_CLOSED, STATE_REGISTERED, this.registerAccount);\n // X -> OPENED\n createTransition(STATE_REGISTERED, STATE_OPENED, this.openAccount);\n // X -> SUSPENDED\n createTransition(STATE_REGISTERED, STATE_SUSPENDED, this.suspendUnopenedAccount);\n createTransition(STATE_OPENED, STATE_SUSPENDED, this.suspendAccount);\n // X -> CLOSED\n createTransition(STATE_SUSPENDED, STATE_CLOSED, this.closeAccount);\n }\n\n receive() external payable override {}\n\n function register(\n address _user,\n Asset[] calldata _collateral,\n Asset calldata _leverage\n ) external payable override onlyMarginEngine onlyState(STATE_UNDEFINED | STATE_CLOSED) {\n for (uint256 i; i < _collateral.length; i++) {\n _collateral[i].enforceReceived();\n }\n changeState(STATE_REGISTERED, abi.encode(_user, _collateral, _leverage));\n }\n\n function supply(\n uint256 _amount\n )\n external\n payable\n override\n onlyMarginEngine\n onlyState(STATE_REGISTERED)\n returns (bool allocationSuccess_)\n {\n if (_amount == 0) revert AmountMustNotBeZero(leverage.token);\n supplied += _amount;\n\n emit LeverageSupplied(owner(), _amount, int256(leverage.amount) - int256(supplied));\n\n if (supplied == leverage.amount) {\n changeState(STATE_OPENED);\n allocationSuccess_ = true;\n } else if (supplied > leverage.amount) {\n changeState(STATE_SUSPENDED);\n }\n }\n\n function tryClose(\n Script[] calldata strategy\n )\n external\n override\n onlyMarginEngine\n onlyState(STATE_OPENED | STATE_SUSPENDED)\n returns (bool success_)\n {\n if (strategy.length == 0) revert ArrayMustNotBeEmpty();\n if (currentState() == STATE_OPENED) changeState(STATE_SUSPENDED);\n\n for (uint256 i; i < strategy.length; i++) {\n Command[] memory cmds = compiler.compile(strategy[i]);\n // solhint-disable-next-line no-empty-blocks\n try cmds.execute() {} catch {\n return success_ = false;\n }\n }\n\n changeState(STATE_CLOSED);\n return success_ = true;\n }\n\n function withdraw(address token, address recipient, uint256 amount) external onlyMarginEngine {\n token.safeTransfer(recipient, amount);\n }\n\n function execute(Command calldata _cmd) external override onlyOwner onlyState(STATE_OPENED) {\n CommandSafeExecutor.validateAndExecute(_cmd);\n }\n\n function stateInfo() external view override returns (State, uint256) {\n return (currentState(), stateSwitchTime);\n }\n\n function allocationInfo()\n external\n view\n override\n returns (State, uint256, address, address, uint256)\n {\n return (currentState(), stateSwitchTime, owner(), leverage.token, leverage.amount);\n }\n\n function owner() public view override returns (address) {\n return _owner();\n }\n\n // State Machine Transitions\n // NOTE: You MUST NOT change names of these functions because it\n // will break state machine setup in all proxies. To change the\n // name you must increment version of this contract and call\n // reinitializer(nextVersion) for all proxies.\n\n function registerAccount(bytes calldata _args) external transition {\n _beforeStateSwitch();\n\n (address user, Asset[] memory collateral, Asset memory _leverage) = abi.decode(\n _args,\n (address, Asset[], Asset)\n );\n\n _assignOwner(user);\n leverage = _leverage;\n emit AccountRegistered(user, collateral, _leverage);\n }\n\n function openAccount(bytes calldata) external transition {\n _beforeStateSwitch();\n\n delete supplied;\n emit AccountOpened(owner());\n }\n\n function suspendAccount(bytes calldata) external transition {\n _beforeStateSwitch();\n\n emit AccountSuspended(owner());\n }\n\n function suspendUnopenedAccount(bytes calldata) external transition {\n _beforeStateSwitch();\n\n delete supplied;\n\n emit AccountSuspended(owner());\n }\n\n function closeAccount(bytes calldata) external transition {\n _beforeStateSwitch();\n\n address previousOwner = owner();\n\n _unassignOwner();\n delete leverage;\n\n emit AccountClosed(previousOwner);\n }\n\n function _beforeStateSwitch() private {\n stateSwitchTime = block.timestamp; // solhint-disable-line not-rely-on-time\n }\n}\n" }, "contracts/accountAbstraction/marginAccount/base/CommandSafeExecutor.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\nimport {LibString} from \"solady/src/utils/LibString.sol\";\n\nimport {AddressMustNotBeZero} from \"contracts/interfaces/base/CommonErrors.sol\";\n\nimport {CalldataLibrary} from \"contracts/libraries/CalldataLibrary.sol\";\nimport {Command, CommandLibrary} from \"contracts/libraries/CommandLibrary.sol\";\nimport {SafeCall} from \"contracts/libraries/SafeCall.sol\";\n\ncontract CommandSafeExecutor {\n using LibString for address;\n using CalldataLibrary for bytes;\n using CommandLibrary for Command[];\n using SafeCall for Command;\n using SafeCall for Command[];\n\n address public immutable compliance;\n string private constant EMPTY_DATA_SIG_PREFIX = \"emptyDataForOperator\";\n\n constructor(address _compliance) {\n if (_compliance == address(0)) revert AddressMustNotBeZero();\n compliance = _compliance;\n }\n\n function validateAndExecute(Command calldata _cmd) internal {\n execute(_cmd, validate(_cmd));\n }\n\n function execute(Command calldata _cmd, bytes memory _encodedCmds) private {\n Command[] memory cmdsToExecute = abi.decode(_encodedCmds, (Command[]));\n\n cmdsToExecute.last().value = _cmd.value;\n cmdsToExecute.safeCallAll();\n }\n\n function validate(Command calldata _cmd) private returns (bytes memory result_) {\n Command memory cmdToValidate = Command({\n target: compliance,\n value: 0,\n payload: constructPayloadWithOperator(_cmd)\n });\n\n return cmdToValidate.safeCall();\n }\n\n function constructPayloadWithOperator(\n Command calldata _cmd\n ) private pure returns (bytes memory) {\n address operator = _cmd.target;\n\n bytes memory payload = _cmd.payload.length > 0\n ? _cmd.payload\n : constructPayloadForFallback(operator.toHexString());\n\n return payload.appendWord(operator);\n }\n\n function constructPayloadForFallback(\n string memory _operator\n ) private pure returns (bytes memory) {\n string memory signature = string.concat(EMPTY_DATA_SIG_PREFIX, _operator, \"()\");\n bytes4 selector = bytes4(keccak256(bytes(signature)));\n return abi.encodePacked(selector);\n }\n}\n" }, "contracts/base/auth/OwnableAssignable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Address} from \"contracts/libraries/Address.sol\";\nimport {OwnableReadonly} from \"./OwnableReadonly.sol\";\n\nabstract contract OwnableAssignable is OwnableReadonly {\n using Address for bytes32;\n\n bytes32 private constant OWNER = keccak256(\"OwnableAssignable owner slot V1\");\n\n event OwnerHasBeenAssigned(address indexed previousOwner, address indexed newOwner);\n event OwnerHasBeenUnassigned(address indexed previousOwner);\n\n error NewOwnerMustBeNonZeroAddress();\n error OwnerDoesNotExist();\n\n function _assignOwner(address _newOwner) internal returns (address previousOwner_) {\n if (_newOwner == address(0)) revert NewOwnerMustBeNonZeroAddress();\n\n previousOwner_ = _owner();\n _ownerSlot().set(_newOwner);\n emit OwnerHasBeenAssigned(previousOwner_, _newOwner);\n }\n\n function _unassignOwner() internal returns (address previousOwner_) {\n if ((previousOwner_ = _owner()) == address(0)) revert OwnerDoesNotExist();\n\n _ownerSlot().set(address(0));\n emit OwnerHasBeenUnassigned(previousOwner_);\n }\n\n function _ownerSlot() internal pure virtual override returns (bytes32) {\n return OWNER;\n }\n}\n" }, "contracts/base/auth/OwnableReadonly.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {UnauthorizedAccount} from \"contracts/interfaces/base/CommonErrors.sol\";\nimport {Address} from \"contracts/libraries/Address.sol\";\n\n/**\n * @dev We intentionally do not expose \"owner()\" publicly\n * due to possible conflicts with \"OwnershipFacet\"\n * https://github.com/mudgen/diamond-3-hardhat/blob/main/contracts/facets/OwnershipFacet.sol\n */\nabstract contract OwnableReadonly {\n using Address for bytes32;\n\n modifier onlyOwner() {\n enforceIsContractOwner();\n _;\n }\n\n function _owner() internal view returns (address) {\n return _ownerSlot().get();\n }\n\n function _ownerSlot() internal pure virtual returns (bytes32);\n\n function enforceIsContractOwner() private view {\n if (msg.sender != _owner()) revert UnauthorizedAccount(msg.sender);\n }\n}\n" }, "contracts/base/StateMachine.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {LibBit} from \"solady/src/utils/LibBit.sol\";\n\ntype State is uint256;\n\nusing {and as &, neq as !=, eq as ==, or as |, includes, isInitialized, isValid} for State global;\n\nfunction and(State self, State value) pure returns (State) {\n return State.wrap(State.unwrap(self) & State.unwrap(value));\n}\n\nfunction neq(State self, State value) pure returns (bool) {\n return State.unwrap(self) != State.unwrap(value);\n}\n\nfunction eq(State self, State value) pure returns (bool) {\n return State.unwrap(self) == State.unwrap(value);\n}\n\nfunction or(State self, State value) pure returns (State) {\n return State.wrap(State.unwrap(self) | State.unwrap(value));\n}\n\nfunction includes(State bitmap, State state) pure returns (bool) {\n return State.unwrap(bitmap) & State.unwrap(state) != 0;\n}\n\nfunction isInitialized(State self) pure returns (bool answer_) {\n return State.unwrap(self) != 0;\n}\n\nfunction isValid(State self) pure returns (bool) {\n // most significant bit is reserved for the undefined state\n uint256 mask = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n return LibBit.isPo2(State.unwrap(self) & mask);\n}\n\nabstract contract StateMachine {\n struct Storage {\n State currentState;\n mapping(bytes32 transitionId => function(bytes memory) external transition) transitions;\n }\n\n // Undefined state cannot be zero because it will break bitmap comparison math in `onlyState`\n State internal immutable STATE_UNDEFINED = newStateFromIdUnchecked(STATE_UNDEFINED_ID); // solhint-disable-line immutable-vars-naming\n\n uint8 private constant STATE_UNDEFINED_ID = type(uint8).max;\n bytes32 private constant STORAGE_SLOT = keccak256(\"StateMachine storage slot V2\");\n\n event StateChanged(State from, State to);\n\n error TransitionAlreadyExists(State from, State to);\n error TransitionDoesNotExist(State from, State to);\n\n error UnexpectedState(State expectedStatesBitmap, State currentState);\n // If transition function exists on current contract\n // then it must be called only from the current contract.\n error HostedTransitionMustBeCalledFromSelf();\n // A valid state must be in form of 2^n, where n ∈ {x | x ∈ uint8, x < STATE_UNDEFINED_ID}.\n error InvalidState(State);\n error IdIsReservedForUndefinedState(uint256);\n\n modifier onlyState(State _expectedStatesBitmap) {\n if (!_expectedStatesBitmap.includes(currentState()))\n revert UnexpectedState(_expectedStatesBitmap, currentState());\n _;\n }\n\n modifier transition() {\n if (msg.sender != address(this)) revert HostedTransitionMustBeCalledFromSelf();\n _;\n }\n\n function createTransition(\n State _from,\n State _to,\n function(bytes memory) external _transition\n ) internal {\n bytes32 id = getTransitionId(_from, _to);\n if (isTransitionExists(id)) revert TransitionAlreadyExists(_from, _to);\n\n _storage().transitions[id] = _transition;\n }\n\n function deleteTransition(State _from, State _to) internal {\n bytes32 id = getTransitionId(_from, _to);\n if (!isTransitionExists(id)) revert TransitionDoesNotExist(_from, _to);\n\n delete _storage().transitions[id];\n }\n\n function changeState(State _newState) internal {\n changeState(_newState, \"\");\n }\n\n function changeState(State _newState, bytes memory _transitionArgs) internal {\n if (!_newState.isValid()) revert InvalidState(_newState);\n\n bytes32 id = getTransitionId(currentState(), _newState);\n if (!isTransitionExists(id)) revert TransitionDoesNotExist(currentState(), _newState);\n\n emit StateChanged(currentState(), _newState);\n _storage().currentState = _newState;\n\n _storage().transitions[id](_transitionArgs);\n }\n\n function isTransitionExists(State _from, State _to) internal view returns (bool) {\n return isTransitionExists(getTransitionId(_from, _to));\n }\n\n function currentState() internal view returns (State currentState_) {\n currentState_ = _storage().currentState;\n // We substitute 0 with STATE_UNDEFINED here in order to avoid storage\n // initialization with default value to save gas\n if (!currentState_.isInitialized()) return currentState_ = STATE_UNDEFINED;\n }\n\n function newStateFromId(uint8 _stateId) internal pure returns (State) {\n if (_stateId == STATE_UNDEFINED_ID) revert IdIsReservedForUndefinedState(_stateId);\n return newStateFromIdUnchecked(_stateId);\n }\n\n function isTransitionExists(bytes32 _transitionId) private view returns (bool exists_) {\n mapping(bytes32 => function(bytes memory) external) storage map = _storage().transitions;\n assembly {\n // we won't use this memory location after keccak so it's safe to use 0x00 and 0x20\n mstore(0x00, _transitionId)\n mstore(0x20, map.slot)\n let position := keccak256(0x00, 64)\n // callback = map[_transition]\n let callback := sload(position)\n // exists_ = callback != null\n exists_ := iszero(iszero(callback))\n }\n }\n\n function getTransitionId(State _from, State _to) private view returns (bytes32) {\n if (_from != STATE_UNDEFINED && !_from.isValid()) revert InvalidState(_from);\n if (!_to.isValid()) revert InvalidState(_to);\n return keccak256(abi.encodePacked(_from, _to));\n }\n\n function newStateFromIdUnchecked(uint8 _stateId) private pure returns (State) {\n return State.wrap(1 << _stateId);\n }\n\n function _storage() private pure returns (Storage storage s_) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n s_.slot := slot\n }\n }\n}\n" }, "contracts/interfaces/accountAbstraction/compliance/Asset.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {AssetLibrary} from \"contracts/libraries/AssetLibrary.sol\";\n\n/**\n * @title Asset\n * @dev Represents an asset with its token address and the amount.\n * @param token The address of the asset's token.\n * @param amount The amount of the asset.\n */\nstruct Asset {\n address token;\n uint256 amount;\n}\n\nusing AssetLibrary for Asset global;\n" }, "contracts/interfaces/accountAbstraction/interpreter/adapters/IDecreasePositionEvaluator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Asset} from \"contracts/libraries/AssetLibrary.sol\";\nimport {Command} from \"../Command.sol\";\nimport {PositionDescriptor} from \"./PositionDescriptor.sol\";\n\ninterface IDecreasePositionEvaluator {\n /**\n * @notice Request structure for decreasing a position.\n * @dev `descriptor`: The [`PositionDescriptor`](/interfaces/accountAbstraction/interpreter/adapters/PositionDescriptor.sol/struct.PositionDescriptor.html)\n * struct.\n * @dev `liquidity`: Abstract amount that can be interpreted differently in different protocols (e.g., amount of LP tokens to burn).\n * @dev `minOutput`: [`Asset`](/interfaces/accountAbstraction/compliance/Asset.sol/struct.Asset.html) array with minimum amounts that must be retrieved from the position.\n */\n struct DecreasePositionRequest {\n PositionDescriptor descriptor;\n uint256 liquidity;\n Asset[] minOutput;\n }\n\n /**\n * @notice Evaluate a decrease position request.\n * @param _operator Address which initiated the request\n * @param _request The [`DecreasePositionRequest`](#decreasepositionrequest) struct containing decrease position details.\n * @return cmds_ An array of [`Command`](../../Command.sol/struct.Command.html) to execute the request.\n */\n function evaluate(\n address _operator,\n DecreasePositionRequest calldata _request\n ) external returns (Command[] memory cmds_);\n}\n" }, "contracts/interfaces/accountAbstraction/interpreter/adapters/IExchangeEvaluator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Command} from \"../Command.sol\";\n\n/**\n * @title IExchangeEvaluator\n * @notice Interface for compiling commands for token exchanges for different protocols.\n */\ninterface IExchangeEvaluator {\n /**\n * @notice Structure for an exchange token request.\n * @dev `path`: Encoded path of tokens to follow in the exchange, including pool identifiers.\n * 20 bytes(tokenA) + 4 byte(poolId_A_B) + 20 bytes(tokenB) + ...\n * ... + 4 byte(poolId_N-1_N) + 20 bytes(tokenN).\n * @dev `extraData`: Additional data specific to a particular protocol, such as the response from a 1Inch Exchange API.\n * @dev `amountIn`: The amount of tokenA to spend.\n * @dev `minAmountOut`: The minimum amount of tokenN to receive.\n * @dev `recipient`: The recipient of tokenN.\n */\n struct ExchangeRequest {\n bytes path;\n bytes extraData;\n uint256 amountIn;\n uint256 minAmountOut;\n address recipient;\n }\n\n /**\n * @notice Constructs an exchange token request.\n * @param _operator Address which initiated the request\n * @param _request The [`ExchangeRequest`](#exchangerequest) struct containing exchange token details.\n * @return cmds_ An array of [`Command`](../../Command.sol/struct.Command.html) to execute the request.\n */\n function evaluate(\n address _operator,\n ExchangeRequest calldata _request\n ) external view returns (Command[] memory cmds_);\n}\n" }, "contracts/interfaces/accountAbstraction/interpreter/adapters/IIncreasePositionEvaluator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Asset} from \"contracts/libraries/AssetLibrary.sol\";\nimport {Command} from \"../Command.sol\";\nimport {PositionDescriptor} from \"./PositionDescriptor.sol\";\n\ninterface IIncreasePositionEvaluator {\n /**\n * @notice Structure for an increase position request.\n * @dev `descriptor`: The [`PositionDescriptor`](/interfaces/accountAbstraction/interpreter/adapters/PositionDescriptor.sol/struct.PositionDescriptor.html)\n * struct.\n * @dev `input`: An array of [`Asset`](/interfaces/accountAbstraction/compliance/Asset.sol/struct.Asset.html) representing the token-amounts that will be added to the position.\n * @dev `minLiquidityOut`: An abstract amount that can be interpreted differently in different protocols (e.g., minimum amount of LP tokens to receive).\n */\n struct IncreasePositionRequest {\n PositionDescriptor descriptor;\n Asset[] input;\n uint256 minLiquidityOut;\n }\n\n /**\n * @notice Evaluate a increase position request.\n * @param _operator Address which initiated the request\n * @param _request The [`IncreasePositionRequest`](#increasepositionrequest) struct containing increase position details.\n * @return cmds_ An array of [`Command`](../../Command.sol/struct.Command.html) to execute the request.\n */\n function evaluate(\n address _operator,\n IncreasePositionRequest calldata _request\n ) external returns (Command[] memory cmds_);\n}\n" }, "contracts/interfaces/accountAbstraction/interpreter/adapters/PositionDescriptor.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n// TODO CRYPTO-145: Possibly move into appropriate interface?\n/**\n * @notice Used to determine the required position for an operation.\n * @dev `poolId`: An identifier that is unique within a single protocol.\n * @dev `extraData`: Additional data used to specify the position, for example\n * this is used in OneInchV5Evaluator to pass swap tx generated via 1inch API.\n */\nstruct PositionDescriptor {\n uint256 poolId;\n bytes extraData;\n}\n" }, "contracts/interfaces/accountAbstraction/interpreter/Command.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {CommandLibrary} from \"contracts/libraries/CommandLibrary.sol\";\n\n/**\n * @title Command\n * @notice Contains arguments for a low-level call.\n * @dev This struct allows deferring the call's execution, suspending it by passing it to another function or contract.\n * @dev `target` The address to be called.\n * @dev `value` Value to send in the call.\n * @dev `payload` Encoded call with function selector and arguments.\n */\nstruct Command {\n address target;\n uint256 value;\n bytes payload;\n}\n\nusing CommandLibrary for Command global;\n" }, "contracts/interfaces/accountAbstraction/interpreter/IJitCompiler.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IDecreasePositionEvaluator} from \"./adapters/IDecreasePositionEvaluator.sol\";\nimport {IExchangeEvaluator} from \"./adapters/IExchangeEvaluator.sol\";\nimport {IIncreasePositionEvaluator} from \"./adapters/IIncreasePositionEvaluator.sol\";\nimport {Command} from \"./Command.sol\";\nimport {Script} from \"./Script.sol\";\n\n/**\n * @title IJitCompiler\n * @notice Compiles a script or an instruction into an array of [Commands](/interfaces/accountAbstraction/interpreter/Command.sol/struct.Command.html) using protocol evaluator matching `protocol` field in the underlying instruction.\n */\ninterface IJitCompiler {\n /**\n * @notice Instruction designed to increase:\n * 1. Caller's magnitude of the position determined by the [PositionDescriptor](../adapters/PositionDescriptor.sol/struct.PositionDescriptor.html).\n * 2. Callee's balance of token(s).\n * @notice and decrease:\n * 1. Caller's balance of token(s).\n * 2. (*Optional*) callee's supply of the position determined by the [PositionDescriptor](../adapters/PositionDescriptor.sol/struct.PositionDescriptor.html).\n * @dev This instruction will be evaluated in [IncreasePositionEvaluator](../adapters/IIncreasePositionEvaluator.sol/interface.IIncreasePositionEvaluator.html).\n * @dev `protocol` The name of the underlying protocol where instruction should be evaluated. For example: `curvefi`, `oneinchv5`\n * @dev `request` The [`IncreasePositionRequest`](../adapters/IIncreasePositionEvaluator.sol/interface.IIncreasePositionEvaluator.html#increasepositionrequest) containing all information required for instruction evaluation.\n */\n struct IncreasePositionInstruction {\n string protocol;\n IIncreasePositionEvaluator.IncreasePositionRequest request;\n }\n\n /**\n * @notice Instruction designed to increase:\n * 1. Caller's balance of token(s).\n * 2. (*Optional*) callee's supply of the position determined by the [PositionDescriptor](../adapters/PositionDescriptor.sol/struct.PositionDescriptor.html).\n * @notice and decrease:\n * 1. Caller's magnitude of the position determined by the [PositionDescriptor](../adapters/PositionDescriptor.sol/struct.PositionDescriptor.html).\n * 2. Callee's balance of token(s).\n * @dev This instruction will be evaluated in [DecreasePositionEvaluator](../adapters/IDecreasePositionEvaluator.sol/interface.IDecreasePositionEvaluator.html).\n * @dev `protocol` The name of the underlying protocol where instruction should be evaluated. For example: `curvefi`, `oneinchv5`\n * @dev `request` The [`DecreasePositionRequest`](../adapters/IDecreasePositionEvaluator.sol/interface.IDecreasePositionEvaluator.html#decreasepositionrequest) containing all information required for instruction evaluation.\n */\n struct DecreasePositionInstruction {\n string protocol;\n IDecreasePositionEvaluator.DecreasePositionRequest request;\n }\n\n /**\n * @notice Instruction designed to increase:\n * 1. (*Optional*) caller's balance of output token.\n * 2. Callee's balance of input token.\n * @notice and decrease:\n * 1. Caller's balance of input token.\n * 2. (*Optional*) callee's balance of output token.\n * @dev This instruction will be evaluated in [ExchangeEvaluator](../adapters/IExchangeEvaluator.sol/interface.IExchangeEvaluator.html).\n * @dev `protocol` The name of the underlying protocol where instruction should be evaluated. For example: `curvefi`, `oneinchv5`\n * @dev `request` The [`ExchangeRequest`](../adapters/IExchangeEvaluator.sol/interface.IExchangeEvaluator.html#exchangerequest) containing all information required for instruction evaluation.\n */\n struct ExchangeInstruction {\n string protocol;\n IExchangeEvaluator.ExchangeRequest request;\n }\n\n /**\n * @notice Instruction designed to increase:\n * 1. (*Optional*) caller's balance of output token.\n * 2. Callee's balance of input token.\n * @notice and decrease:\n * 1. Caller's balance of input token.\n * 2. (*Optional*) callee's balance of output token.\n * @dev This instruction will be evaluated in [ExchangeEvaluator](../adapters/IExchangeEvaluator.sol/interface.IExchangeEvaluator.html).\n * @dev **Important note:** this instruction has an identical structure to [ExchangeInstruction](#exchangeinstruction), but differs from it in that [ExchangeInstruction](#exchangeinstruction) is static and [ExchangeAllInstruction](#exchangeallinstruction) is dynamic. This means that the `amountIn` field will be set at runtime by the compiler to the caller's balance by the input token.\n * @dev `protocol` The name of the underlying protocol where instruction should be evaluated. For example: `curvefi`, `oneinchv5`\n * @dev `request` The [`ExchangeRequest`](../adapters/IExchangeEvaluator.sol/interface.IExchangeEvaluator.html#exchangerequest) containing all information required for instruction evaluation. The `amountIn` field will be set at runtime by the compiler to the caller's balance by the input token.\n */\n struct ExchangeAllInstruction {\n string protocol;\n IExchangeEvaluator.ExchangeRequest request;\n }\n\n /**\n * @notice Compiles a [Script](../Script.sol/struct.Script.html).\n * @dev **Important note:** don't put two instructions to the same script if one depend on the other because content of the script will be compiled at once meaning that balance changes will be applied only after the compilation of the entire script. If you have two instructions and one depends on the other, put them into different scripts.\n * @param script Script to compile\n * @return An array of [`Commands`](../Command.sol/struct.Command.html) to execute the instruction.\n */\n function compile(Script calldata script) external returns (Command[] memory);\n\n /**\n * @notice Compiles an increase position instruction.\n * @param instruction The [`IncreasePositionInstruction`](#increasepositioninstruction) struct.\n * @return An array of [`Commands`](../Command.sol/struct.Command.html) to execute the instruction.\n */\n function compileIncreasePositionInstruction(\n IncreasePositionInstruction calldata instruction\n ) external returns (Command[] memory);\n\n /**\n * @notice Compiles a decrease position instruction.\n * @param instruction The [`DecreasePositionInstruction`](#decreasepositioninstruction) struct.\n * @return An array of [`Commands`](../Command.sol/struct.Command.html) to execute the instruction.\n */\n function compileDecreasePositionInstruction(\n DecreasePositionInstruction calldata instruction\n ) external returns (Command[] memory);\n\n /**\n * @notice Compiles an exchange instruction.\n * @param instruction The [`ExchangeInstruction`](#exchangeinstruction) struct.\n * @return An array of [`Commands`](../Command.sol/struct.Command.html) to execute the instruction.\n */\n function compileExchangeInstruction(\n ExchangeInstruction calldata instruction\n ) external returns (Command[] memory);\n\n /**\n * @notice Sets the `amountIn` field to the balance of the caller by the input token and compiles an underlying exchange instruction.\n * @dev `amountIn` will be overriden with the balance of the caller by the input token.\n * @param instruction The [`ExchangeAllInstruction`](#exchangeallinstruction) struct.\n * @return An array of [`Commands`](../Command.sol/struct.Command.html) to execute the instruction.\n */\n function compileExchangeAllInstruction(\n ExchangeAllInstruction calldata instruction\n ) external returns (Command[] memory);\n}\n" }, "contracts/interfaces/accountAbstraction/interpreter/Script.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IJitCompiler} from \"./IJitCompiler.sol\";\n\n/**\n * @title Script\n * @notice A structure defining a script with various instructions for a JIT compiler.\n * @notice The [JIT compiler](../IJitCompiler.sol/interface.IJitCompiler.html) will compile it the following way:\n * 1. Flatten content's instructions arrays into a single-dimensional array: `flattened = [...increasePositionInstructions, ...decreasePositionInstructions, ...exchangeInstructions, ...exchangeAllInstructions]`.\n * 2. Execute `flattened[PC]` where `PC = sequence[i]` where `i` is the index of current loop iteration, starting from `i = 0`.\n * 3. Increment current loop interation index: `i = i + 1`.\n * 4. If `i < length(flattened)` go to step 2.\n * @dev `sequence` Auto-incrementing read-only program counter. Determines the order of execution of the instruction within the script.\n * @dev `increasePositionInstructions` An array of [`IncreasePositionInstructions`](../IJitCompiler.sol/interface.IJitCompiler.html#increasepositioninstruction).\n * @dev `decreasePositionInstructions` An array of [`DecreasePositionInstructions`](../IJitCompiler.sol/interface.IJitCompiler.html#decreasepositioninstruction).\n * @dev `exchangeInstructions` An array of [`ExchangeInstructions`](../IJitCompiler.sol/interface.IJitCompiler.html#exchangeinstruction).\n * @dev `exchangeAllInstructions` An array of [`ExchangeAllInstructions`](../IJitCompiler.sol/interface.IJitCompiler.html#exchangeallinstruction).\n */\nstruct Script {\n uint256[] sequence;\n IJitCompiler.IncreasePositionInstruction[] increasePositionInstructions;\n IJitCompiler.DecreasePositionInstruction[] decreasePositionInstructions;\n IJitCompiler.ExchangeInstruction[] exchangeInstructions;\n IJitCompiler.ExchangeAllInstruction[] exchangeAllInstructions;\n}\n" }, "contracts/interfaces/accountAbstraction/marginAccount/IAccount.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {State} from \"contracts/base/StateMachine.sol\";\nimport {Asset} from \"contracts/libraries/AssetLibrary.sol\";\n\nimport {Command} from \"../interpreter/Command.sol\";\nimport {Script} from \"../interpreter/Script.sol\";\n\ninterface IAccount {\n event AccountRegistered(address indexed owner, Asset[] collateral, Asset leverage);\n event LeverageSupplied(address indexed owner, uint256 supplied, int256 remaining);\n event AccountOpened(address indexed owner);\n event AccountSuspended(address indexed owner);\n event AccountClosed(address indexed previousOwner);\n\n /**\n * @notice Receive Ether and log the transaction.\n * @dev This function is called when the margin account receives Ether without a specific function call.\n */\n receive() external payable;\n\n /**\n * @notice After calling this function margin account will be in the registered state\n * Reverts if either not enough assets were transferred before the call\n * or the account is in an invalid state\n * @param user Address that will be assigned as an owner of the account\n * @param collateral Must be transfered to the account beforehand\n * @param requestedLeverage Asset that has to be supplied to the account\n * to switch it's state to the opened\n */\n function register(\n address user,\n Asset[] calldata collateral,\n Asset calldata requestedLeverage\n ) external payable;\n\n /**\n * @notice This method is a step of the margin account opening.\n * Once enough leverage supplied, margin account will be switched to\n * the opened state\n * @dev Reverts if either too much leverage is supplied\n * or account is in an invalid state\n * @param amount Amount to supply\n * @return allocationSuccess Whether enought leverage has been supplied\n * and margin account now ready to use by the owner\n */\n function supply(uint256 amount) external payable returns (bool allocationSuccess);\n\n /**\n * @notice Immediately switches the account to the suspended state and\n * tries to execute provided scripts\n * @dev Reverts if either script's compilation failed in [interpreter](/interfaces/accountAbstraction/interpreter/index.html)\n * or account's state cannot be switched to the suspended state\n * @param strategy If all scripts will be executed successfully\n * the account will be switched to the closed state\n * @return success Whether the account was switched to the closed state\n */\n function tryClose(Script[] calldata strategy) external returns (bool success);\n\n function withdraw(address token, address recipient, uint256 amount) external;\n\n /**\n * @notice Allows margin account's owner to execute any low level call\n * @dev Reverts if either validation failed, call failed or account\n * is in an invalid state\n * @param cmd Parameters of the call: target, value and payload.\n * All the parameters will be validated in validation hub before execution.\n * All the approvals will performed automatically, owner does not need to\n * do it manually\n */\n function execute(Command calldata cmd) external;\n\n /**\n * @notice Returns the owner of the margin account.\n * @return The address of the the margin account owner.\n */\n function owner() external view returns (address);\n\n /**\n * @notice Leverage asset allocated (or being allocated) to the account\n */\n function leverage() external view returns (address, uint256);\n\n /**\n * @return currentState In which state the state machine is running now\n * @return switchTimestamp Time, when state was switched to the underlying state\n */\n function stateInfo() external view returns (State currentState, uint256 switchTimestamp);\n\n function allocationInfo()\n external\n view\n returns (\n State currentState,\n uint256 stateSwitchTimestamp,\n address owner,\n address leverageToken,\n uint256 leverageAmount\n );\n}\n" }, "contracts/interfaces/base/CommonErrors.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @notice An error indicating that the amount for the specified token is zero.\n * @param token The address of the token with a zero amount.\n */\nerror AmountMustNotBeZero(address token);\n\n/**\n * @notice An error indicating that an address must not be zero.\n */\nerror AddressMustNotBeZero();\n\n/**\n * @notice An error indicating that an array must not be empty.\n */\nerror ArrayMustNotBeEmpty();\n\n/**\n * @notice An error indicating storage is already up to date and doesn't need further processing.\n * @dev This error is thrown when attempting to update an entity(s) that is(are) already up to date.\n */\nerror AlreadyUpToDate();\n\n/**\n * @notice An error indicating that an action is unauthorized for the specified account.\n * @param account The address of the unauthorized account.\n */\nerror UnauthorizedAccount(address account);\n" }, "contracts/interfaces/common/IInitializable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IInitializable {\n function initialize() external;\n}\n" }, "contracts/libraries/Address.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nlibrary Address {\n address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function set(bytes32 _slot, address _value) internal {\n assembly {\n sstore(_slot, _value)\n }\n }\n\n function get(bytes32 _slot) internal view returns (address result_) {\n assembly {\n result_ := sload(_slot)\n }\n }\n\n function isEth(address _token) internal pure returns (bool) {\n return _token == ETH || _token == address(0);\n }\n\n function sort(address _a, address _b) internal pure returns (address, address) {\n return _a < _b ? (_a, _b) : (_b, _a);\n }\n\n function sort(address[4] memory _array) internal pure returns (address[4] memory _sorted) {\n // Sorting network for the array of length 4\n (_sorted[0], _sorted[1]) = sort(_array[0], _array[1]);\n (_sorted[2], _sorted[3]) = sort(_array[2], _array[3]);\n\n (_sorted[0], _sorted[2]) = sort(_sorted[0], _sorted[2]);\n (_sorted[1], _sorted[3]) = sort(_sorted[1], _sorted[3]);\n (_sorted[1], _sorted[2]) = sort(_sorted[1], _sorted[2]);\n }\n}\n" }, "contracts/libraries/AssetLibrary.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {SafeTransferLib} from \"solady/src/utils/SafeTransferLib.sol\";\n\nimport {Asset} from \"contracts/interfaces/accountAbstraction/compliance/Asset.sol\";\nimport {AmountMustNotBeZero} from \"contracts/interfaces/base/CommonErrors.sol\";\n\nimport {Address} from \"./Address.sol\";\n\nlibrary AssetLibrary {\n using SafeTransferLib for address;\n using Address for address;\n\n error NotEnoughReceived(address token, uint256 expected, uint256 received);\n\n function forward(Asset calldata _self, address _to) internal {\n if (_self.amount == 0) revert AmountMustNotBeZero(_self.token);\n\n if (_self.token.isEth()) _to.safeTransferETH(_self.amount);\n else _self.token.safeTransferFrom(msg.sender, _to, _self.amount);\n }\n\n function enforceReceived(Asset calldata _self) internal view {\n if (_self.amount == 0) revert AmountMustNotBeZero(_self.token);\n\n uint256 balance = _self.token.isEth()\n ? address(this).balance\n : _self.token.balanceOf(address(this));\n\n if (balance < _self.amount) revert NotEnoughReceived(_self.token, _self.amount, balance);\n }\n}\n" }, "contracts/libraries/CalldataLibrary.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nlibrary CalldataLibrary {\n uint256 private constant WORD_LENGTH = 32;\n\n function appendWord(\n bytes memory _payload,\n address _word\n ) internal pure returns (bytes memory result_) {\n result_ = bytes.concat(_payload, bytes12(0), bytes20(_word));\n }\n\n function extractLastWordAsAddress(bytes calldata _payload) internal pure returns (address) {\n uint256 start = _payload.length - WORD_LENGTH;\n uint256 end = start + WORD_LENGTH;\n\n bytes32 word = bytes32(_payload[start:end]);\n return address(uint160(uint256(word)));\n }\n}\n" }, "contracts/libraries/CommandLibrary.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Command} from \"contracts/interfaces/accountAbstraction/interpreter/Command.sol\";\nimport {SafeCall} from \"contracts/libraries/SafeCall.sol\";\n\n/**\n * @notice Utility to convert often-used methods into a Command object\n */\nlibrary CommandPresets {\n function approve(\n address _token,\n address _to,\n uint256 _amount\n ) internal pure returns (Command memory cmd_) {\n cmd_.target = _token;\n cmd_.payload = abi.encodeCall(IERC20.approve, (_to, _amount));\n }\n\n function transfer(\n address _token,\n address _to,\n uint256 _amount\n ) internal pure returns (Command memory cmd_) {\n cmd_.target = _token;\n cmd_.payload = abi.encodeCall(IERC20.transfer, (_to, _amount));\n }\n}\n\nlibrary CommandExecutor {\n using SafeCall for Command[];\n\n function execute(Command[] calldata _cmds) external {\n _cmds.safeCallAll();\n }\n}\n\nlibrary CommandLibrary {\n using CommandLibrary for Command[];\n\n function last(Command[] memory _self) internal pure returns (Command memory) {\n return _self[_self.length - 1];\n }\n\n function asArray(Command memory _self) internal pure returns (Command[] memory result_) {\n result_ = new Command[](1);\n result_[0] = _self;\n }\n\n function concat(\n Command memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](2);\n result_[0] = _self;\n result_[1] = _cmd;\n }\n\n function concat(\n Command memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_cmds.length + 1);\n result_[0] = _self;\n for (uint256 i = 1; i < result_.length; i++) {\n result_[i] = _cmds[i - 1];\n }\n }\n\n function append(\n Command[] memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_self.length + _cmds.length);\n uint256 i;\n for (; i < _self.length; i++) {\n result_[i] = _self[i];\n }\n for (; i < result_.length; i++) {\n result_[i] = _cmds[i - _self.length];\n }\n }\n\n function push(\n Command[] memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_self.length + 1);\n for (uint256 i; i < _self.length; i++) {\n result_[i] = _self[i];\n }\n result_[_self.length] = _cmd;\n }\n\n function unshift(\n Command[] memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](1 + _self.length);\n result_[0] = _cmd;\n for (uint256 i = 1; i < result_.length; i++) {\n result_[i] = _self[i - 1];\n }\n }\n\n function unshift(\n Command[] memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_cmds.length + _self.length);\n uint256 i;\n for (; i < _cmds.length; i++) {\n result_[i] = _cmds[i];\n }\n for (; i < result_.length; i++) {\n result_[i] = _self[i - _cmds.length];\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n if (_amount != 0) {\n result_ = CommandPresets.approve(_token, _self.target, _amount).concat(_self);\n } else {\n result_ = _self.asArray();\n }\n }\n\n function populateWithRevokeAndApprove(\n Command memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n return\n CommandPresets.approve(_token, _self.target, 0).concat(\n _self.populateWithApprove(_token, _amount)\n );\n }\n\n function populateWithApprove(\n Command[] memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n if (_amount != 0) {\n result_ = _self.unshift(\n CommandPresets.approve(_token, _self[_self.length - 1].target, _amount)\n );\n } else {\n result_ = _self;\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[2] memory _tokens,\n uint256[2] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(_self);\n } else {\n if (_amounts[0] != 0) {\n result_ = populateWithApprove(_self, _tokens[0], _amounts[0]);\n } else {\n result_ = populateWithApprove(_self, _tokens[1], _amounts[1]);\n }\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[3] memory _tokens,\n uint256[3] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0 && _amounts[2] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(CommandPresets.approve(_tokens[2], _self.target, _amounts[2]))\n .push(_self);\n } else {\n if (_amounts[0] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[1], _tokens[2]],\n [_amounts[1], _amounts[2]]\n );\n } else if (_amounts[1] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[2]],\n [_amounts[0], _amounts[2]]\n );\n } else {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1]],\n [_amounts[0], _amounts[1]]\n );\n }\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[4] memory _tokens,\n uint256[4] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0 && _amounts[2] != 0 && _amounts[3] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(CommandPresets.approve(_tokens[2], _self.target, _amounts[2]))\n .push(CommandPresets.approve(_tokens[3], _self.target, _amounts[3]))\n .push(_self);\n } else {\n if (_amounts[0] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[1], _tokens[2], _tokens[3]],\n [_amounts[1], _amounts[2], _amounts[3]]\n );\n } else if (_amounts[1] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[2], _tokens[3]],\n [_amounts[0], _amounts[2], _amounts[3]]\n );\n } else if (_amounts[2] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1], _tokens[3]],\n [_amounts[0], _amounts[1], _amounts[3]]\n );\n } else {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1], _tokens[2]],\n [_amounts[0], _amounts[1], _amounts[2]]\n );\n }\n }\n }\n}\n" }, "contracts/libraries/SafeCall.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {Command} from \"contracts/interfaces/accountAbstraction/interpreter/Command.sol\";\n\n/**\n * @notice Safe methods performing a low-level calls that revert\n * if the call was not successful\n */\nlibrary SafeCall {\n using Address for address;\n\n function safeCallAll(Command[] memory _cmds) internal {\n for (uint256 i; i < _cmds.length; i++) {\n safeCall(_cmds[i]);\n }\n }\n\n function safeCall(Command memory _cmd) internal returns (bytes memory result_) {\n result_ = safeCall(_cmd.target, _cmd.value, _cmd.payload);\n }\n\n function safeCall(address _target, bytes memory _data) internal returns (bytes memory result_) {\n result_ = safeCall(_target, 0, _data);\n }\n\n function safeCall(\n address _target,\n uint256 _value,\n bytes memory _data\n ) internal returns (bytes memory result_) {\n result_ = _target.functionCallWithValue(_data, _value);\n }\n\n function safeDelegateCall(\n address _target,\n bytes memory _data\n ) internal returns (bytes memory result_) {\n result_ = _target.functionDelegateCall(_data);\n }\n}\n" }, "solady/src/utils/LibBit.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Library for bit twiddling and boolean operations.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBit.sol)\n/// @author Inspired by (https://graphics.stanford.edu/~seander/bithacks.html)\nlibrary LibBit {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* BIT TWIDDLING OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Find last set.\n /// Returns the index of the most significant bit of `x`,\n /// counting from the least significant bit position.\n /// If `x` is zero, returns 256.\n /// Equivalent to `log2(x)`, but without reverting for the zero case.\n function fls(uint256 x) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n r := shl(8, iszero(x))\n\n r := or(r, shl(7, lt(0xffffffffffffffffffffffffffffffff, x)))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n\n // For the remaining 32 bits, use a De Bruijn lookup.\n x := shr(r, x)\n x := or(x, shr(1, x))\n x := or(x, shr(2, x))\n x := or(x, shr(4, x))\n x := or(x, shr(8, x))\n x := or(x, shr(16, x))\n\n // forgefmt: disable-next-item\n r := or(r, byte(shr(251, mul(x, shl(224, 0x07c4acdd))),\n 0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f))\n }\n }\n\n /// @dev Count leading zeros.\n /// Returns the number of zeros preceding the most significant one bit.\n /// If `x` is zero, returns 256.\n function clz(uint256 x) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n let t := add(iszero(x), 255)\n\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n\n // For the remaining 32 bits, use a De Bruijn lookup.\n x := shr(r, x)\n x := or(x, shr(1, x))\n x := or(x, shr(2, x))\n x := or(x, shr(4, x))\n x := or(x, shr(8, x))\n x := or(x, shr(16, x))\n\n // forgefmt: disable-next-item\n r := sub(t, or(r, byte(shr(251, mul(x, shl(224, 0x07c4acdd))),\n 0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f)))\n }\n }\n\n /// @dev Find first set.\n /// Returns the index of the least significant bit of `x`,\n /// counting from the least significant bit position.\n /// If `x` is zero, returns 256.\n /// Equivalent to `ctz` (count trailing zeros), which gives\n /// the number of zeros following the least significant one bit.\n function ffs(uint256 x) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n r := shl(8, iszero(x))\n\n // Isolate the least significant bit.\n x := and(x, add(not(x), 1))\n\n r := or(r, shl(7, lt(0xffffffffffffffffffffffffffffffff, x)))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n\n // For the remaining 32 bits, use a De Bruijn lookup.\n // forgefmt: disable-next-item\n r := or(r, byte(shr(251, mul(shr(r, x), shl(224, 0x077cb531))), \n 0x00011c021d0e18031e16140f191104081f1b0d17151310071a0c12060b050a09))\n }\n }\n\n /// @dev Returns the number of set bits in `x`.\n function popCount(uint256 x) internal pure returns (uint256 c) {\n /// @solidity memory-safe-assembly\n assembly {\n let max := not(0)\n let isMax := eq(x, max)\n x := sub(x, and(shr(1, x), div(max, 3)))\n x := add(and(x, div(max, 5)), and(shr(2, x), div(max, 5)))\n x := and(add(x, shr(4, x)), div(max, 17))\n c := or(shl(8, isMax), shr(248, mul(x, div(max, 255))))\n }\n }\n\n /// @dev Returns whether `x` is a power of 2.\n function isPo2(uint256 x) internal pure returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n // Equivalent to `x && !(x & (x - 1))`.\n result := iszero(add(and(x, sub(x, 1)), iszero(x)))\n }\n }\n\n /// @dev Returns `x` reversed at the bit level.\n function reverseBits(uint256 x) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n // Computing masks on-the-fly reduces bytecode size by about 500 bytes.\n let m := not(0)\n r := x\n for { let s := 128 } 1 {} {\n m := xor(m, shl(s, m))\n r := or(and(shr(s, r), m), and(shl(s, r), not(m)))\n s := shr(1, s)\n if iszero(s) { break }\n }\n }\n }\n\n /// @dev Returns `x` reversed at the byte level.\n function reverseBytes(uint256 x) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n // Computing masks on-the-fly reduces bytecode size by about 200 bytes.\n let m := not(0)\n r := x\n for { let s := 128 } 1 {} {\n m := xor(m, shl(s, m))\n r := or(and(shr(s, r), m), and(shl(s, r), not(m)))\n s := shr(1, s)\n if eq(s, 4) { break }\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* BOOLEAN OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns `x & y`.\n function and(bool x, bool y) internal pure returns (bool z) {\n /// @solidity memory-safe-assembly\n assembly {\n z := and(x, y)\n }\n }\n\n /// @dev Returns `x | y`.\n function or(bool x, bool y) internal pure returns (bool z) {\n /// @solidity memory-safe-assembly\n assembly {\n z := or(x, y)\n }\n }\n\n /// @dev Returns a non-zero number if `b` is true, else 0.\n /// If `b` is from plain Solidity, the non-zero number will be 1.\n function toUint(bool b) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n z := b\n }\n }\n}\n" }, "solady/src/utils/LibString.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Library for converting numbers into strings and other string operations.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol)\nlibrary LibString {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `length` of the output is too small to contain all the hex digits.\n error HexLengthInsufficient();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CONSTANTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The constant returned when the `search` is not found in the string.\n uint256 internal constant NOT_FOUND = type(uint256).max;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* DECIMAL OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the base 10 decimal representation of `value`.\n function toString(uint256 value) internal pure returns (string memory str) {\n /// @solidity memory-safe-assembly\n assembly {\n // The maximum value of a uint256 contains 78 digits (1 byte per digit), but\n // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.\n // We will need 1 word for the trailing zeros padding, 1 word for the length,\n // and 3 words for a maximum of 78 digits.\n str := add(mload(0x40), 0x80)\n // Update the free memory pointer to allocate.\n mstore(0x40, add(str, 0x20))\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end of the memory to calculate the length later.\n let end := str\n\n let w := not(0) // Tsk.\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n for { let temp := value } 1 {} {\n str := add(str, w) // `sub(str, 1)`.\n // Write the character to the pointer.\n // The ASCII index of the '0' character is 48.\n mstore8(str, add(48, mod(temp, 10)))\n // Keep dividing `temp` until zero.\n temp := div(temp, 10)\n if iszero(temp) { break }\n }\n\n let length := sub(end, str)\n // Move the pointer 32 bytes leftwards to make room for the length.\n str := sub(str, 0x20)\n // Store the length.\n mstore(str, length)\n }\n }\n\n /// @dev Returns the base 10 decimal representation of `value`.\n function toString(int256 value) internal pure returns (string memory str) {\n if (value >= 0) {\n return toString(uint256(value));\n }\n unchecked {\n str = toString(uint256(-value));\n }\n /// @solidity memory-safe-assembly\n assembly {\n // We still have some spare memory space on the left,\n // as we have allocated 3 words (96 bytes) for up to 78 digits.\n let length := mload(str) // Load the string length.\n mstore(str, 0x2d) // Store the '-' character.\n str := sub(str, 1) // Move back the string pointer by a byte.\n mstore(str, add(length, 1)) // Update the string length.\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HEXADECIMAL OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the hexadecimal representation of `value`,\n /// left-padded to an input length of `length` bytes.\n /// The output is prefixed with \"0x\" encoded using 2 hexadecimal digits per byte,\n /// giving a total length of `length * 2 + 2` bytes.\n /// Reverts if `length` is too small for the output to contain all the digits.\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {\n str = toHexStringNoPrefix(value, length);\n /// @solidity memory-safe-assembly\n assembly {\n let strLength := add(mload(str), 2) // Compute the length.\n mstore(str, 0x3078) // Write the \"0x\" prefix.\n str := sub(str, 2) // Move the pointer.\n mstore(str, strLength) // Write the length.\n }\n }\n\n /// @dev Returns the hexadecimal representation of `value`,\n /// left-padded to an input length of `length` bytes.\n /// The output is prefixed with \"0x\" encoded using 2 hexadecimal digits per byte,\n /// giving a total length of `length * 2` bytes.\n /// Reverts if `length` is too small for the output to contain all the digits.\n function toHexStringNoPrefix(uint256 value, uint256 length)\n internal\n pure\n returns (string memory str)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes\n // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length.\n // We add 0x20 to the total and round down to a multiple of 0x20.\n // (0x20 + 0x20 + 0x02 + 0x20) = 0x62.\n str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f)))\n // Allocate the memory.\n mstore(0x40, add(str, 0x20))\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end to calculate the length later.\n let end := str\n // Store \"0123456789abcdef\" in scratch space.\n mstore(0x0f, 0x30313233343536373839616263646566)\n\n let start := sub(str, add(length, length))\n let w := not(1) // Tsk.\n let temp := value\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n for {} 1 {} {\n str := add(str, w) // `sub(str, 2)`.\n mstore8(add(str, 1), mload(and(temp, 15)))\n mstore8(str, mload(and(shr(4, temp), 15)))\n temp := shr(8, temp)\n if iszero(xor(str, start)) { break }\n }\n\n if temp {\n // Store the function selector of `HexLengthInsufficient()`.\n mstore(0x00, 0x2194895a)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n\n // Compute the string's length.\n let strLength := sub(end, str)\n // Move the pointer and write the length.\n str := sub(str, 0x20)\n mstore(str, strLength)\n }\n }\n\n /// @dev Returns the hexadecimal representation of `value`.\n /// The output is prefixed with \"0x\" and encoded using 2 hexadecimal digits per byte.\n /// As address are 20 bytes long, the output will left-padded to have\n /// a length of `20 * 2 + 2` bytes.\n function toHexString(uint256 value) internal pure returns (string memory str) {\n str = toHexStringNoPrefix(value);\n /// @solidity memory-safe-assembly\n assembly {\n let strLength := add(mload(str), 2) // Compute the length.\n mstore(str, 0x3078) // Write the \"0x\" prefix.\n str := sub(str, 2) // Move the pointer.\n mstore(str, strLength) // Write the length.\n }\n }\n\n /// @dev Returns the hexadecimal representation of `value`.\n /// The output is encoded using 2 hexadecimal digits per byte.\n /// As address are 20 bytes long, the output will left-padded to have\n /// a length of `20 * 2` bytes.\n function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {\n /// @solidity memory-safe-assembly\n assembly {\n // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,\n // 0x02 bytes for the prefix, and 0x40 bytes for the digits.\n // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0.\n str := add(mload(0x40), 0x80)\n // Allocate the memory.\n mstore(0x40, add(str, 0x20))\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end to calculate the length later.\n let end := str\n // Store \"0123456789abcdef\" in scratch space.\n mstore(0x0f, 0x30313233343536373839616263646566)\n\n let w := not(1) // Tsk.\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n for { let temp := value } 1 {} {\n str := add(str, w) // `sub(str, 2)`.\n mstore8(add(str, 1), mload(and(temp, 15)))\n mstore8(str, mload(and(shr(4, temp), 15)))\n temp := shr(8, temp)\n if iszero(temp) { break }\n }\n\n // Compute the string's length.\n let strLength := sub(end, str)\n // Move the pointer and write the length.\n str := sub(str, 0x20)\n mstore(str, strLength)\n }\n }\n\n /// @dev Returns the hexadecimal representation of `value`.\n /// The output is prefixed with \"0x\", encoded using 2 hexadecimal digits per byte,\n /// and the alphabets are capitalized conditionally according to\n /// https://eips.ethereum.org/EIPS/eip-55\n function toHexStringChecksummed(address value) internal pure returns (string memory str) {\n str = toHexString(value);\n /// @solidity memory-safe-assembly\n assembly {\n let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...`\n let o := add(str, 0x22)\n let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `\n let t := shl(240, 136) // `0b10001000 << 240`\n for { let i := 0 } 1 {} {\n mstore(add(i, i), mul(t, byte(i, hashed)))\n i := add(i, 1)\n if eq(i, 20) { break }\n }\n mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))\n o := add(o, 0x20)\n mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))\n }\n }\n\n /// @dev Returns the hexadecimal representation of `value`.\n /// The output is prefixed with \"0x\" and encoded using 2 hexadecimal digits per byte.\n function toHexString(address value) internal pure returns (string memory str) {\n str = toHexStringNoPrefix(value);\n /// @solidity memory-safe-assembly\n assembly {\n let strLength := add(mload(str), 2) // Compute the length.\n mstore(str, 0x3078) // Write the \"0x\" prefix.\n str := sub(str, 2) // Move the pointer.\n mstore(str, strLength) // Write the length.\n }\n }\n\n /// @dev Returns the hexadecimal representation of `value`.\n /// The output is encoded using 2 hexadecimal digits per byte.\n function toHexStringNoPrefix(address value) internal pure returns (string memory str) {\n /// @solidity memory-safe-assembly\n assembly {\n str := mload(0x40)\n\n // Allocate the memory.\n // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,\n // 0x02 bytes for the prefix, and 0x28 bytes for the digits.\n // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80.\n mstore(0x40, add(str, 0x80))\n\n // Store \"0123456789abcdef\" in scratch space.\n mstore(0x0f, 0x30313233343536373839616263646566)\n\n str := add(str, 2)\n mstore(str, 40)\n\n let o := add(str, 0x20)\n mstore(add(o, 40), 0)\n\n value := shl(96, value)\n\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n for { let i := 0 } 1 {} {\n let p := add(o, add(i, i))\n let temp := byte(i, value)\n mstore8(add(p, 1), mload(and(temp, 15)))\n mstore8(p, mload(shr(4, temp)))\n i := add(i, 1)\n if eq(i, 20) { break }\n }\n }\n }\n\n /// @dev Returns the hex encoded string from the raw bytes.\n /// The output is encoded using 2 hexadecimal digits per byte.\n function toHexString(bytes memory raw) internal pure returns (string memory str) {\n str = toHexStringNoPrefix(raw);\n /// @solidity memory-safe-assembly\n assembly {\n let strLength := add(mload(str), 2) // Compute the length.\n mstore(str, 0x3078) // Write the \"0x\" prefix.\n str := sub(str, 2) // Move the pointer.\n mstore(str, strLength) // Write the length.\n }\n }\n\n /// @dev Returns the hex encoded string from the raw bytes.\n /// The output is encoded using 2 hexadecimal digits per byte.\n function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {\n /// @solidity memory-safe-assembly\n assembly {\n let length := mload(raw)\n str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix.\n mstore(str, add(length, length)) // Store the length of the output.\n\n // Store \"0123456789abcdef\" in scratch space.\n mstore(0x0f, 0x30313233343536373839616263646566)\n\n let o := add(str, 0x20)\n let end := add(raw, length)\n\n for {} iszero(eq(raw, end)) {} {\n raw := add(raw, 1)\n mstore8(add(o, 1), mload(and(mload(raw), 15)))\n mstore8(o, mload(and(shr(4, mload(raw)), 15)))\n o := add(o, 2)\n }\n mstore(o, 0) // Zeroize the slot after the string.\n mstore(0x40, add(o, 0x20)) // Allocate the memory.\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* RUNE STRING OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the number of UTF characters in the string.\n function runeCount(string memory s) internal pure returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n if mload(s) {\n mstore(0x00, div(not(0), 255))\n mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506)\n let o := add(s, 0x20)\n let end := add(o, mload(s))\n for { result := 1 } 1 { result := add(result, 1) } {\n o := add(o, byte(0, mload(shr(250, mload(o)))))\n if iszero(lt(o, end)) { break }\n }\n }\n }\n }\n\n /// @dev Returns if this string is a 7-bit ASCII string.\n /// (i.e. all characters codes are in [0..127])\n function is7BitASCII(string memory s) internal pure returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let mask := shl(7, div(not(0), 255))\n result := 1\n let n := mload(s)\n if n {\n let o := add(s, 0x20)\n let end := add(o, n)\n let last := mload(end)\n mstore(end, 0)\n for {} 1 {} {\n if and(mask, mload(o)) {\n result := 0\n break\n }\n o := add(o, 0x20)\n if iszero(lt(o, end)) { break }\n }\n mstore(end, last)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* BYTE STRING OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n // For performance and bytecode compactness, all indices of the following operations\n // are byte (ASCII) offsets, not UTF character offsets.\n\n /// @dev Returns `subject` all occurrences of `search` replaced with `replacement`.\n function replace(string memory subject, string memory search, string memory replacement)\n internal\n pure\n returns (string memory result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let subjectLength := mload(subject)\n let searchLength := mload(search)\n let replacementLength := mload(replacement)\n\n subject := add(subject, 0x20)\n search := add(search, 0x20)\n replacement := add(replacement, 0x20)\n result := add(mload(0x40), 0x20)\n\n let subjectEnd := add(subject, subjectLength)\n if iszero(gt(searchLength, subjectLength)) {\n let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1)\n let h := 0\n if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }\n let m := shl(3, sub(0x20, and(searchLength, 0x1f)))\n let s := mload(search)\n for {} 1 {} {\n let t := mload(subject)\n // Whether the first `searchLength % 32` bytes of\n // `subject` and `search` matches.\n if iszero(shr(m, xor(t, s))) {\n if h {\n if iszero(eq(keccak256(subject, searchLength), h)) {\n mstore(result, t)\n result := add(result, 1)\n subject := add(subject, 1)\n if iszero(lt(subject, subjectSearchEnd)) { break }\n continue\n }\n }\n // Copy the `replacement` one word at a time.\n for { let o := 0 } 1 {} {\n mstore(add(result, o), mload(add(replacement, o)))\n o := add(o, 0x20)\n if iszero(lt(o, replacementLength)) { break }\n }\n result := add(result, replacementLength)\n subject := add(subject, searchLength)\n if searchLength {\n if iszero(lt(subject, subjectSearchEnd)) { break }\n continue\n }\n }\n mstore(result, t)\n result := add(result, 1)\n subject := add(subject, 1)\n if iszero(lt(subject, subjectSearchEnd)) { break }\n }\n }\n\n let resultRemainder := result\n result := add(mload(0x40), 0x20)\n let k := add(sub(resultRemainder, result), sub(subjectEnd, subject))\n // Copy the rest of the string one word at a time.\n for {} lt(subject, subjectEnd) {} {\n mstore(resultRemainder, mload(subject))\n resultRemainder := add(resultRemainder, 0x20)\n subject := add(subject, 0x20)\n }\n result := sub(result, 0x20)\n let last := add(add(result, 0x20), k) // Zeroize the slot after the string.\n mstore(last, 0)\n mstore(0x40, add(last, 0x20)) // Allocate the memory.\n mstore(result, k) // Store the length.\n }\n }\n\n /// @dev Returns the byte index of the first location of `search` in `subject`,\n /// searching from left to right, starting from `from`.\n /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.\n function indexOf(string memory subject, string memory search, uint256 from)\n internal\n pure\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n for { let subjectLength := mload(subject) } 1 {} {\n if iszero(mload(search)) {\n if iszero(gt(from, subjectLength)) {\n result := from\n break\n }\n result := subjectLength\n break\n }\n let searchLength := mload(search)\n let subjectStart := add(subject, 0x20)\n\n result := not(0) // Initialize to `NOT_FOUND`.\n\n subject := add(subjectStart, from)\n let end := add(sub(add(subjectStart, subjectLength), searchLength), 1)\n\n let m := shl(3, sub(0x20, and(searchLength, 0x1f)))\n let s := mload(add(search, 0x20))\n\n if iszero(and(lt(subject, end), lt(from, subjectLength))) { break }\n\n if iszero(lt(searchLength, 0x20)) {\n for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {\n if iszero(shr(m, xor(mload(subject), s))) {\n if eq(keccak256(subject, searchLength), h) {\n result := sub(subject, subjectStart)\n break\n }\n }\n subject := add(subject, 1)\n if iszero(lt(subject, end)) { break }\n }\n break\n }\n for {} 1 {} {\n if iszero(shr(m, xor(mload(subject), s))) {\n result := sub(subject, subjectStart)\n break\n }\n subject := add(subject, 1)\n if iszero(lt(subject, end)) { break }\n }\n break\n }\n }\n }\n\n /// @dev Returns the byte index of the first location of `search` in `subject`,\n /// searching from left to right.\n /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.\n function indexOf(string memory subject, string memory search)\n internal\n pure\n returns (uint256 result)\n {\n result = indexOf(subject, search, 0);\n }\n\n /// @dev Returns the byte index of the first location of `search` in `subject`,\n /// searching from right to left, starting from `from`.\n /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.\n function lastIndexOf(string memory subject, string memory search, uint256 from)\n internal\n pure\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n for {} 1 {} {\n result := not(0) // Initialize to `NOT_FOUND`.\n let searchLength := mload(search)\n if gt(searchLength, mload(subject)) { break }\n let w := result\n\n let fromMax := sub(mload(subject), searchLength)\n if iszero(gt(fromMax, from)) { from := fromMax }\n\n let end := add(add(subject, 0x20), w)\n subject := add(add(subject, 0x20), from)\n if iszero(gt(subject, end)) { break }\n // As this function is not too often used,\n // we shall simply use keccak256 for smaller bytecode size.\n for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {\n if eq(keccak256(subject, searchLength), h) {\n result := sub(subject, add(end, 1))\n break\n }\n subject := add(subject, w) // `sub(subject, 1)`.\n if iszero(gt(subject, end)) { break }\n }\n break\n }\n }\n }\n\n /// @dev Returns the byte index of the first location of `search` in `subject`,\n /// searching from right to left.\n /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.\n function lastIndexOf(string memory subject, string memory search)\n internal\n pure\n returns (uint256 result)\n {\n result = lastIndexOf(subject, search, uint256(int256(-1)));\n }\n\n /// @dev Returns whether `subject` starts with `search`.\n function startsWith(string memory subject, string memory search)\n internal\n pure\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let searchLength := mload(search)\n // Just using keccak256 directly is actually cheaper.\n // forgefmt: disable-next-item\n result := and(\n iszero(gt(searchLength, mload(subject))),\n eq(\n keccak256(add(subject, 0x20), searchLength),\n keccak256(add(search, 0x20), searchLength)\n )\n )\n }\n }\n\n /// @dev Returns whether `subject` ends with `search`.\n function endsWith(string memory subject, string memory search)\n internal\n pure\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let searchLength := mload(search)\n let subjectLength := mload(subject)\n // Whether `search` is not longer than `subject`.\n let withinRange := iszero(gt(searchLength, subjectLength))\n // Just using keccak256 directly is actually cheaper.\n // forgefmt: disable-next-item\n result := and(\n withinRange,\n eq(\n keccak256(\n // `subject + 0x20 + max(subjectLength - searchLength, 0)`.\n add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))),\n searchLength\n ),\n keccak256(add(search, 0x20), searchLength)\n )\n )\n }\n }\n\n /// @dev Returns `subject` repeated `times`.\n function repeat(string memory subject, uint256 times)\n internal\n pure\n returns (string memory result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let subjectLength := mload(subject)\n if iszero(or(iszero(times), iszero(subjectLength))) {\n subject := add(subject, 0x20)\n result := mload(0x40)\n let output := add(result, 0x20)\n for {} 1 {} {\n // Copy the `subject` one word at a time.\n for { let o := 0 } 1 {} {\n mstore(add(output, o), mload(add(subject, o)))\n o := add(o, 0x20)\n if iszero(lt(o, subjectLength)) { break }\n }\n output := add(output, subjectLength)\n times := sub(times, 1)\n if iszero(times) { break }\n }\n mstore(output, 0) // Zeroize the slot after the string.\n let resultLength := sub(output, add(result, 0x20))\n mstore(result, resultLength) // Store the length.\n // Allocate the memory.\n mstore(0x40, add(result, add(resultLength, 0x20)))\n }\n }\n }\n\n /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive).\n /// `start` and `end` are byte offsets.\n function slice(string memory subject, uint256 start, uint256 end)\n internal\n pure\n returns (string memory result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let subjectLength := mload(subject)\n if iszero(gt(subjectLength, end)) { end := subjectLength }\n if iszero(gt(subjectLength, start)) { start := subjectLength }\n if lt(start, end) {\n result := mload(0x40)\n let resultLength := sub(end, start)\n mstore(result, resultLength)\n subject := add(subject, start)\n let w := not(0x1f)\n // Copy the `subject` one word at a time, backwards.\n for { let o := and(add(resultLength, 0x1f), w) } 1 {} {\n mstore(add(result, o), mload(add(subject, o)))\n o := add(o, w) // `sub(o, 0x20)`.\n if iszero(o) { break }\n }\n // Zeroize the slot after the string.\n mstore(add(add(result, 0x20), resultLength), 0)\n // Allocate memory for the length and the bytes,\n // rounded up to a multiple of 32.\n mstore(0x40, add(result, and(add(resultLength, 0x3f), w)))\n }\n }\n }\n\n /// @dev Returns a copy of `subject` sliced from `start` to the end of the string.\n /// `start` is a byte offset.\n function slice(string memory subject, uint256 start)\n internal\n pure\n returns (string memory result)\n {\n result = slice(subject, start, uint256(int256(-1)));\n }\n\n /// @dev Returns all the indices of `search` in `subject`.\n /// The indices are byte offsets.\n function indicesOf(string memory subject, string memory search)\n internal\n pure\n returns (uint256[] memory result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let subjectLength := mload(subject)\n let searchLength := mload(search)\n\n if iszero(gt(searchLength, subjectLength)) {\n subject := add(subject, 0x20)\n search := add(search, 0x20)\n result := add(mload(0x40), 0x20)\n\n let subjectStart := subject\n let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1)\n let h := 0\n if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }\n let m := shl(3, sub(0x20, and(searchLength, 0x1f)))\n let s := mload(search)\n for {} 1 {} {\n let t := mload(subject)\n // Whether the first `searchLength % 32` bytes of\n // `subject` and `search` matches.\n if iszero(shr(m, xor(t, s))) {\n if h {\n if iszero(eq(keccak256(subject, searchLength), h)) {\n subject := add(subject, 1)\n if iszero(lt(subject, subjectSearchEnd)) { break }\n continue\n }\n }\n // Append to `result`.\n mstore(result, sub(subject, subjectStart))\n result := add(result, 0x20)\n // Advance `subject` by `searchLength`.\n subject := add(subject, searchLength)\n if searchLength {\n if iszero(lt(subject, subjectSearchEnd)) { break }\n continue\n }\n }\n subject := add(subject, 1)\n if iszero(lt(subject, subjectSearchEnd)) { break }\n }\n let resultEnd := result\n // Assign `result` to the free memory pointer.\n result := mload(0x40)\n // Store the length of `result`.\n mstore(result, shr(5, sub(resultEnd, add(result, 0x20))))\n // Allocate memory for result.\n // We allocate one more word, so this array can be recycled for {split}.\n mstore(0x40, add(resultEnd, 0x20))\n }\n }\n }\n\n /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string.\n function split(string memory subject, string memory delimiter)\n internal\n pure\n returns (string[] memory result)\n {\n uint256[] memory indices = indicesOf(subject, delimiter);\n /// @solidity memory-safe-assembly\n assembly {\n let w := not(0x1f)\n let indexPtr := add(indices, 0x20)\n let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1)))\n mstore(add(indicesEnd, w), mload(subject))\n mstore(indices, add(mload(indices), 1))\n let prevIndex := 0\n for {} 1 {} {\n let index := mload(indexPtr)\n mstore(indexPtr, 0x60)\n if iszero(eq(index, prevIndex)) {\n let element := mload(0x40)\n let elementLength := sub(index, prevIndex)\n mstore(element, elementLength)\n // Copy the `subject` one word at a time, backwards.\n for { let o := and(add(elementLength, 0x1f), w) } 1 {} {\n mstore(add(element, o), mload(add(add(subject, prevIndex), o)))\n o := add(o, w) // `sub(o, 0x20)`.\n if iszero(o) { break }\n }\n // Zeroize the slot after the string.\n mstore(add(add(element, 0x20), elementLength), 0)\n // Allocate memory for the length and the bytes,\n // rounded up to a multiple of 32.\n mstore(0x40, add(element, and(add(elementLength, 0x3f), w)))\n // Store the `element` into the array.\n mstore(indexPtr, element)\n }\n prevIndex := add(index, mload(delimiter))\n indexPtr := add(indexPtr, 0x20)\n if iszero(lt(indexPtr, indicesEnd)) { break }\n }\n result := indices\n if iszero(mload(delimiter)) {\n result := add(indices, 0x20)\n mstore(result, sub(mload(indices), 2))\n }\n }\n }\n\n /// @dev Returns a concatenated string of `a` and `b`.\n /// Cheaper than `string.concat()` and does not de-align the free memory pointer.\n function concat(string memory a, string memory b)\n internal\n pure\n returns (string memory result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let w := not(0x1f)\n result := mload(0x40)\n let aLength := mload(a)\n // Copy `a` one word at a time, backwards.\n for { let o := and(add(mload(a), 0x20), w) } 1 {} {\n mstore(add(result, o), mload(add(a, o)))\n o := add(o, w) // `sub(o, 0x20)`.\n if iszero(o) { break }\n }\n let bLength := mload(b)\n let output := add(result, mload(a))\n // Copy `b` one word at a time, backwards.\n for { let o := and(add(bLength, 0x20), w) } 1 {} {\n mstore(add(output, o), mload(add(b, o)))\n o := add(o, w) // `sub(o, 0x20)`.\n if iszero(o) { break }\n }\n let totalLength := add(aLength, bLength)\n let last := add(add(result, 0x20), totalLength)\n // Zeroize the slot after the string.\n mstore(last, 0)\n // Stores the length.\n mstore(result, totalLength)\n // Allocate memory for the length and the bytes,\n // rounded up to a multiple of 32.\n mstore(0x40, and(add(last, 0x1f), w))\n }\n }\n\n /// @dev Returns a copy of the string in either lowercase or UPPERCASE.\n /// WARNING! This function is only compatible with 7-bit ASCII strings.\n function toCase(string memory subject, bool toUpper)\n internal\n pure\n returns (string memory result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let length := mload(subject)\n if length {\n result := add(mload(0x40), 0x20)\n subject := add(subject, 1)\n let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff)\n let w := not(0)\n for { let o := length } 1 {} {\n o := add(o, w)\n let b := and(0xff, mload(add(subject, o)))\n mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20)))\n if iszero(o) { break }\n }\n result := mload(0x40)\n mstore(result, length) // Store the length.\n let last := add(add(result, 0x20), length)\n mstore(last, 0) // Zeroize the slot after the string.\n mstore(0x40, add(last, 0x20)) // Allocate the memory.\n }\n }\n }\n\n /// @dev Returns a lowercased copy of the string.\n /// WARNING! This function is only compatible with 7-bit ASCII strings.\n function lower(string memory subject) internal pure returns (string memory result) {\n result = toCase(subject, false);\n }\n\n /// @dev Returns an UPPERCASED copy of the string.\n /// WARNING! This function is only compatible with 7-bit ASCII strings.\n function upper(string memory subject) internal pure returns (string memory result) {\n result = toCase(subject, true);\n }\n\n /// @dev Escapes the string to be used within HTML tags.\n function escapeHTML(string memory s) internal pure returns (string memory result) {\n /// @solidity memory-safe-assembly\n assembly {\n for {\n let end := add(s, mload(s))\n result := add(mload(0x40), 0x20)\n // Store the bytes of the packed offsets and strides into the scratch space.\n // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6.\n mstore(0x1f, 0x900094)\n mstore(0x08, 0xc0000000a6ab)\n // Store \"&quot;&amp;&#39;&lt;&gt;\" into the scratch space.\n mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b))\n } iszero(eq(s, end)) {} {\n s := add(s, 1)\n let c := and(mload(s), 0xff)\n // Not in `[\"\\\"\",\"'\",\"&\",\"<\",\">\"]`.\n if iszero(and(shl(c, 1), 0x500000c400000000)) {\n mstore8(result, c)\n result := add(result, 1)\n continue\n }\n let t := shr(248, mload(c))\n mstore(result, mload(and(t, 0x1f)))\n result := add(result, shr(5, t))\n }\n let last := result\n mstore(last, 0) // Zeroize the slot after the string.\n result := mload(0x40)\n mstore(result, sub(last, add(result, 0x20))) // Store the length.\n mstore(0x40, add(last, 0x20)) // Allocate the memory.\n }\n }\n\n /// @dev Escapes the string to be used within double-quotes in a JSON.\n function escapeJSON(string memory s) internal pure returns (string memory result) {\n /// @solidity memory-safe-assembly\n assembly {\n for {\n let end := add(s, mload(s))\n result := add(mload(0x40), 0x20)\n // Store \"\\\\u0000\" in scratch space.\n // Store \"0123456789abcdef\" in scratch space.\n // Also, store `{0x08:\"b\", 0x09:\"t\", 0x0a:\"n\", 0x0c:\"f\", 0x0d:\"r\"}`.\n // into the scratch space.\n mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672)\n // Bitmask for detecting `[\"\\\"\",\"\\\\\"]`.\n let e := or(shl(0x22, 1), shl(0x5c, 1))\n } iszero(eq(s, end)) {} {\n s := add(s, 1)\n let c := and(mload(s), 0xff)\n if iszero(lt(c, 0x20)) {\n if iszero(and(shl(c, 1), e)) {\n // Not in `[\"\\\"\",\"\\\\\"]`.\n mstore8(result, c)\n result := add(result, 1)\n continue\n }\n mstore8(result, 0x5c) // \"\\\\\".\n mstore8(add(result, 1), c)\n result := add(result, 2)\n continue\n }\n if iszero(and(shl(c, 1), 0x3700)) {\n // Not in `[\"\\b\",\"\\t\",\"\\n\",\"\\f\",\"\\d\"]`.\n mstore8(0x1d, mload(shr(4, c))) // Hex value.\n mstore8(0x1e, mload(and(c, 15))) // Hex value.\n mstore(result, mload(0x19)) // \"\\\\u00XX\".\n result := add(result, 6)\n continue\n }\n mstore8(result, 0x5c) // \"\\\\\".\n mstore8(add(result, 1), mload(add(c, 8)))\n result := add(result, 2)\n }\n let last := result\n mstore(last, 0) // Zeroize the slot after the string.\n result := mload(0x40)\n mstore(result, sub(last, add(result, 0x20))) // Store the length.\n mstore(0x40, add(last, 0x20)) // Allocate the memory.\n }\n }\n\n /// @dev Returns whether `a` equals `b`.\n function eq(string memory a, string memory b) internal pure returns (bool result) {\n assembly {\n result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b)))\n }\n }\n\n /// @dev Packs a single string with its length into a single word.\n /// Returns `bytes32(0)` if the length is zero or greater than 31.\n function packOne(string memory a) internal pure returns (bytes32 result) {\n /// @solidity memory-safe-assembly\n assembly {\n // We don't need to zero right pad the string,\n // since this is our own custom non-standard packing scheme.\n result :=\n mul(\n // Load the length and the bytes.\n mload(add(a, 0x1f)),\n // `length != 0 && length < 32`. Abuses underflow.\n // Assumes that the length is valid and within the block gas limit.\n lt(sub(mload(a), 1), 0x1f)\n )\n }\n }\n\n /// @dev Unpacks a string packed using {packOne}.\n /// Returns the empty string if `packed` is `bytes32(0)`.\n /// If `packed` is not an output of {packOne}, the output behaviour is undefined.\n function unpackOne(bytes32 packed) internal pure returns (string memory result) {\n /// @solidity memory-safe-assembly\n assembly {\n // Grab the free memory pointer.\n result := mload(0x40)\n // Allocate 2 words (1 for the length, 1 for the bytes).\n mstore(0x40, add(result, 0x40))\n // Zeroize the length slot.\n mstore(result, 0)\n // Store the length and bytes.\n mstore(add(result, 0x1f), packed)\n // Right pad with zeroes.\n mstore(add(add(result, 0x20), mload(result)), 0)\n }\n }\n\n /// @dev Packs two strings with their lengths into a single word.\n /// Returns `bytes32(0)` if combined length is zero or greater than 30.\n function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) {\n /// @solidity memory-safe-assembly\n assembly {\n let aLength := mload(a)\n // We don't need to zero right pad the strings,\n // since this is our own custom non-standard packing scheme.\n result :=\n mul(\n // Load the length and the bytes of `a` and `b`.\n or(\n shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))),\n mload(sub(add(b, 0x1e), aLength))\n ),\n // `totalLength != 0 && totalLength < 31`. Abuses underflow.\n // Assumes that the lengths are valid and within the block gas limit.\n lt(sub(add(aLength, mload(b)), 1), 0x1e)\n )\n }\n }\n\n /// @dev Unpacks strings packed using {packTwo}.\n /// Returns the empty strings if `packed` is `bytes32(0)`.\n /// If `packed` is not an output of {packTwo}, the output behaviour is undefined.\n function unpackTwo(bytes32 packed)\n internal\n pure\n returns (string memory resultA, string memory resultB)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Grab the free memory pointer.\n resultA := mload(0x40)\n resultB := add(resultA, 0x40)\n // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words.\n mstore(0x40, add(resultB, 0x40))\n // Zeroize the length slots.\n mstore(resultA, 0)\n mstore(resultB, 0)\n // Store the lengths and bytes.\n mstore(add(resultA, 0x1f), packed)\n mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA))))\n // Right pad with zeroes.\n mstore(add(add(resultA, 0x20), mload(resultA)), 0)\n mstore(add(add(resultB, 0x20), mload(resultB)), 0)\n }\n }\n\n /// @dev Directly returns `a` without copying.\n function directReturn(string memory a) internal pure {\n assembly {\n // Assumes that the string does not start from the scratch space.\n let retStart := sub(a, 0x20)\n let retSize := add(mload(a), 0x40)\n // Right pad with zeroes. Just in case the string is produced\n // by a method that doesn't zero right pad.\n mstore(add(retStart, retSize), 0)\n // Store the return offset.\n mstore(retStart, 0x20)\n // End the transaction, returning the string.\n return(retStart, retSize)\n }\n }\n}\n" }, "solady/src/utils/SafeTransferLib.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Caution! This library won't check that a token has code, responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ETH transfer has failed.\n error ETHTransferFailed();\n\n /// @dev The ERC20 `transferFrom` has failed.\n error TransferFromFailed();\n\n /// @dev The ERC20 `transfer` has failed.\n error TransferFailed();\n\n /// @dev The ERC20 `approve` has failed.\n error ApproveFailed();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CONSTANTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Suggested gas stipend for contract receiving ETH\n /// that disallows any storage writes.\n uint256 internal constant _GAS_STIPEND_NO_STORAGE_WRITES = 2300;\n\n /// @dev Suggested gas stipend for contract receiving ETH to perform a few\n /// storage reads and writes, but low enough to prevent griefing.\n /// Multiply by a small constant (e.g. 2), if needed.\n uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ETH OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Sends `amount` (in wei) ETH to `to`.\n /// Reverts upon failure.\n function safeTransferETH(address to, uint256 amount) internal {\n /// @solidity memory-safe-assembly\n assembly {\n // Transfer the ETH and check if it succeeded or not.\n if iszero(call(gas(), to, amount, 0, 0, 0, 0)) {\n // Store the function selector of `ETHTransferFailed()`.\n mstore(0x00, 0xb12d13eb)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.\n /// The `gasStipend` can be set to a low enough value to prevent\n /// storage writes or gas griefing.\n ///\n /// If sending via the normal procedure fails, force sends the ETH by\n /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.\n ///\n /// Reverts if the current contract has insufficient balance.\n function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {\n /// @solidity memory-safe-assembly\n assembly {\n // If insufficient balance, revert.\n if lt(selfbalance(), amount) {\n // Store the function selector of `ETHTransferFailed()`.\n mstore(0x00, 0xb12d13eb)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n // Transfer the ETH and check if it succeeded or not.\n if iszero(call(gasStipend, to, amount, 0, 0, 0, 0)) {\n mstore(0x00, to) // Store the address in scratch space.\n mstore8(0x0b, 0x73) // Opcode `PUSH20`.\n mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.\n // We can directly use `SELFDESTRUCT` in the contract creation.\n // Compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758\n if iszero(create(amount, 0x0b, 0x16)) {\n // For better gas estimation.\n if iszero(gt(gas(), 1000000)) { revert(0, 0) }\n }\n }\n }\n }\n\n /// @dev Force sends `amount` (in wei) ETH to `to`, with a gas stipend\n /// equal to `_GAS_STIPEND_NO_GRIEF`. This gas stipend is a reasonable default\n /// for 99% of cases and can be overriden with the three-argument version of this\n /// function if necessary.\n ///\n /// If sending via the normal procedure fails, force sends the ETH by\n /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.\n ///\n /// Reverts if the current contract has insufficient balance.\n function forceSafeTransferETH(address to, uint256 amount) internal {\n // Manually inlined because the compiler doesn't inline functions with branches.\n /// @solidity memory-safe-assembly\n assembly {\n // If insufficient balance, revert.\n if lt(selfbalance(), amount) {\n // Store the function selector of `ETHTransferFailed()`.\n mstore(0x00, 0xb12d13eb)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n // Transfer the ETH and check if it succeeded or not.\n if iszero(call(_GAS_STIPEND_NO_GRIEF, to, amount, 0, 0, 0, 0)) {\n mstore(0x00, to) // Store the address in scratch space.\n mstore8(0x0b, 0x73) // Opcode `PUSH20`.\n mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.\n // We can directly use `SELFDESTRUCT` in the contract creation.\n // Compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758\n if iszero(create(amount, 0x0b, 0x16)) {\n // For better gas estimation.\n if iszero(gt(gas(), 1000000)) { revert(0, 0) }\n }\n }\n }\n }\n\n /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.\n /// The `gasStipend` can be set to a low enough value to prevent\n /// storage writes or gas griefing.\n ///\n /// Simply use `gasleft()` for `gasStipend` if you don't need a gas stipend.\n ///\n /// Note: Does NOT revert upon failure.\n /// Returns whether the transfer of ETH is successful instead.\n function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)\n internal\n returns (bool success)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Transfer the ETH and check if it succeeded or not.\n success := call(gasStipend, to, amount, 0, 0, 0, 0)\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC20 OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.\n /// Reverts upon failure.\n ///\n /// The `from` account must have at least `amount` approved for\n /// the current contract to manage.\n function safeTransferFrom(address token, address from, address to, uint256 amount) internal {\n /// @solidity memory-safe-assembly\n assembly {\n let m := mload(0x40) // Cache the free memory pointer.\n\n mstore(0x60, amount) // Store the `amount` argument.\n mstore(0x40, to) // Store the `to` argument.\n mstore(0x2c, shl(96, from)) // Store the `from` argument.\n // Store the function selector of `transferFrom(address,address,uint256)`.\n mstore(0x0c, 0x23b872dd000000000000000000000000)\n\n if iszero(\n and( // The arguments of `and` are evaluated from right to left.\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(eq(mload(0x00), 1), iszero(returndatasize())),\n call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)\n )\n ) {\n // Store the function selector of `TransferFromFailed()`.\n mstore(0x00, 0x7939f424)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n\n mstore(0x60, 0) // Restore the zero slot to zero.\n mstore(0x40, m) // Restore the free memory pointer.\n }\n }\n\n /// @dev Sends all of ERC20 `token` from `from` to `to`.\n /// Reverts upon failure.\n ///\n /// The `from` account must have at least `amount` approved for\n /// the current contract to manage.\n function safeTransferAllFrom(address token, address from, address to)\n internal\n returns (uint256 amount)\n {\n /// @solidity memory-safe-assembly\n assembly {\n let m := mload(0x40) // Cache the free memory pointer.\n\n mstore(0x40, to) // Store the `to` argument.\n mstore(0x2c, shl(96, from)) // Store the `from` argument.\n // Store the function selector of `balanceOf(address)`.\n mstore(0x0c, 0x70a08231000000000000000000000000)\n if iszero(\n and( // The arguments of `and` are evaluated from right to left.\n gt(returndatasize(), 0x1f), // At least 32 bytes returned.\n staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)\n )\n ) {\n // Store the function selector of `TransferFromFailed()`.\n mstore(0x00, 0x7939f424)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n\n // Store the function selector of `transferFrom(address,address,uint256)`.\n mstore(0x00, 0x23b872dd)\n // The `amount` argument is already written to the memory word at 0x6c.\n amount := mload(0x60)\n\n if iszero(\n and( // The arguments of `and` are evaluated from right to left.\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(eq(mload(0x00), 1), iszero(returndatasize())),\n call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)\n )\n ) {\n // Store the function selector of `TransferFromFailed()`.\n mstore(0x00, 0x7939f424)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n\n mstore(0x60, 0) // Restore the zero slot to zero.\n mstore(0x40, m) // Restore the free memory pointer.\n }\n }\n\n /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.\n /// Reverts upon failure.\n function safeTransfer(address token, address to, uint256 amount) internal {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x14, to) // Store the `to` argument.\n mstore(0x34, amount) // Store the `amount` argument.\n // Store the function selector of `transfer(address,uint256)`.\n mstore(0x00, 0xa9059cbb000000000000000000000000)\n\n if iszero(\n and( // The arguments of `and` are evaluated from right to left.\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(eq(mload(0x00), 1), iszero(returndatasize())),\n call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)\n )\n ) {\n // Store the function selector of `TransferFailed()`.\n mstore(0x00, 0x90b8ec18)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n // Restore the part of the free memory pointer that was overwritten.\n mstore(0x34, 0)\n }\n }\n\n /// @dev Sends all of ERC20 `token` from the current contract to `to`.\n /// Reverts upon failure.\n function safeTransferAll(address token, address to) internal returns (uint256 amount) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.\n mstore(0x20, address()) // Store the address of the current contract.\n if iszero(\n and( // The arguments of `and` are evaluated from right to left.\n gt(returndatasize(), 0x1f), // At least 32 bytes returned.\n staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)\n )\n ) {\n // Store the function selector of `TransferFailed()`.\n mstore(0x00, 0x90b8ec18)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n\n mstore(0x14, to) // Store the `to` argument.\n // The `amount` argument is already written to the memory word at 0x34.\n amount := mload(0x34)\n // Store the function selector of `transfer(address,uint256)`.\n mstore(0x00, 0xa9059cbb000000000000000000000000)\n\n if iszero(\n and( // The arguments of `and` are evaluated from right to left.\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(eq(mload(0x00), 1), iszero(returndatasize())),\n call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)\n )\n ) {\n // Store the function selector of `TransferFailed()`.\n mstore(0x00, 0x90b8ec18)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n // Restore the part of the free memory pointer that was overwritten.\n mstore(0x34, 0)\n }\n }\n\n /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.\n /// Reverts upon failure.\n function safeApprove(address token, address to, uint256 amount) internal {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x14, to) // Store the `to` argument.\n mstore(0x34, amount) // Store the `amount` argument.\n // Store the function selector of `approve(address,uint256)`.\n mstore(0x00, 0x095ea7b3000000000000000000000000)\n\n if iszero(\n and( // The arguments of `and` are evaluated from right to left.\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(eq(mload(0x00), 1), iszero(returndatasize())),\n call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)\n )\n ) {\n // Store the function selector of `ApproveFailed()`.\n mstore(0x00, 0x3e3f8f73)\n // Revert with (offset, size).\n revert(0x1c, 0x04)\n }\n // Restore the part of the free memory pointer that was overwritten.\n mstore(0x34, 0)\n }\n }\n\n /// @dev Returns the amount of ERC20 `token` owned by `account`.\n /// Returns zero if the `token` does not exist.\n function balanceOf(address token, address account) internal view returns (uint256 amount) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x14, account) // Store the `account` argument.\n // Store the function selector of `balanceOf(address)`.\n mstore(0x00, 0x70a08231000000000000000000000000)\n amount :=\n mul(\n mload(0x20),\n and( // The arguments of `and` are evaluated from right to left.\n gt(returndatasize(), 0x1f), // At least 32 bytes returned.\n staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)\n )\n )\n }\n }\n}\n" } }, "settings": { "viaIR": false, "optimizer": { "enabled": true, "runs": 1000000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": { "contracts/libraries/CommandLibrary.sol": { "CommandExecutor": "0x4ba21ef812547ea7440f4caef9aaabc406f7ef1d" } } } }}
1
20,290,299
c06f3a1fffec97f61f56f848e15b4cc629fc0f651ab82e0f3453d291c8b8dc2f
5d65a07f48c5c13ee1a10fc10488b4874a2ea33cbffd6072af8edf5309f55e7b
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
d7bd09709f2ac4302c5ba339ab40a9535bc2211e
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,304
66309f730fba02f8e471c31c697cf47327b49fa8b5c5b7f08d76ba630034f14b
0757f79a8d21e19f38df420aa1577bb549dae9c6992a469034895f12e1bdeabe
f758c8a58c50981f8c92c04efabc3d89147e9448
f758c8a58c50981f8c92c04efabc3d89147e9448
c1097cf6b6c6008168325cd1b2b61826236d20c6
6080604052601660065560166007555f6008555f6009556016600a556016600b55600a600c556046600d555f600e556009600a6200003e9190620005fb565b621e84806200004e91906200064b565b600f556009600a620000619190620005fb565b621e84806200007191906200064b565b6010556009600a620000849190620005fb565b620f42406200009491906200064b565b6011556009600a620000a79190620005fb565b621b7740620000b791906200064b565b6012555f601460156101000a81548160ff0219169083151502179055505f601460166101000a81548160ff0219169083151502179055505f6015555f60165534801562000102575f80fd5b505f620001146200043b60201b60201c565b9050805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350620001c06200043b60201b60201c565b60055f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506009600a6200020f9190620005fb565b6305f5e1006200022091906200064b565b60015f620002336200043b60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550600160035f620002856200044260201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160035f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160035f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550620003af6200043b60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6009600a6200040d9190620005fb565b6305f5e1006200041e91906200064b565b6040516200042d9190620006a6565b60405180910390a3620006c1565b5f33905090565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115620004f357808604811115620004cb57620004ca62000469565b5b6001851615620004db5780820291505b8081029050620004eb8562000496565b9450620004ab565b94509492505050565b5f826200050d5760019050620005df565b816200051c575f9050620005df565b8160018114620005355760028114620005405762000576565b6001915050620005df565b60ff84111562000555576200055462000469565b5b8360020a9150848211156200056f576200056e62000469565b5b50620005df565b5060208310610133831016604e8410600b8410161715620005b05782820a905083811115620005aa57620005a962000469565b5b620005df565b620005bf8484846001620004a2565b92509050818404811115620005d957620005d862000469565b5b81810290505b9392505050565b5f819050919050565b5f60ff82169050919050565b5f6200060782620005e6565b91506200061483620005ef565b9250620006437fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620004fc565b905092915050565b5f6200065782620005e6565b91506200066483620005e6565b92508282026200067481620005e6565b915082820484148315176200068e576200068d62000469565b5b5092915050565b620006a081620005e6565b82525050565b5f602082019050620006bb5f83018462000695565b92915050565b6135de80620006cf5f395ff3fe60806040526004361061014e575f3560e01c8063715018a6116100b5578063a9059cbb1161006e578063a9059cbb1461042f578063bf474bed1461046b578063c9567bf914610495578063d34628cc146104ab578063dd62ed3e146104d3578063ec1f3f631461050f57610155565b8063715018a61461035b578063751039fc146103715780637d1db4a5146103875780638da5cb5b146103b15780638f9a55c0146103db57806395d89b411461040557610155565b8063313ce56711610107578063313ce5671461026557806331c2d8471461028f5780633bbac579146102b757806351bc3c85146102f35780636fc3eaec1461030957806370a082311461031f57610155565b806306fdde0314610159578063095ea7b3146101835780630faee56f146101bf578063109daa99146101e957806318160ddd146101ff57806323b872dd1461022957610155565b3661015557005b5f80fd5b348015610164575f80fd5b5061016d610537565b60405161017a9190612571565b60405180910390f35b34801561018e575f80fd5b506101a960048036038101906101a4919061262f565b610574565b6040516101b69190612687565b60405180910390f35b3480156101ca575f80fd5b506101d3610591565b6040516101e091906126af565b60405180910390f35b3480156101f4575f80fd5b506101fd610597565b005b34801561020a575f80fd5b5061021361066b565b60405161022091906126af565b60405180910390f35b348015610234575f80fd5b5061024f600480360381019061024a91906126c8565b61068e565b60405161025c9190612687565b60405180910390f35b348015610270575f80fd5b50610279610762565b6040516102869190612733565b60405180910390f35b34801561029a575f80fd5b506102b560048036038101906102b0919061288c565b61076a565b005b3480156102c2575f80fd5b506102dd60048036038101906102d891906128d3565b610888565b6040516102ea9190612687565b60405180910390f35b3480156102fe575f80fd5b506103076108da565b005b348015610314575f80fd5b5061031d610971565b005b34801561032a575f80fd5b50610345600480360381019061034091906128d3565b6109e0565b60405161035291906126af565b60405180910390f35b348015610366575f80fd5b5061036f610a26565b005b34801561037c575f80fd5b50610385610b74565b005b348015610392575f80fd5b5061039b610ca3565b6040516103a891906126af565b60405180910390f35b3480156103bc575f80fd5b506103c5610ca9565b6040516103d2919061290d565b60405180910390f35b3480156103e6575f80fd5b506103ef610cd0565b6040516103fc91906126af565b60405180910390f35b348015610410575f80fd5b50610419610cd6565b6040516104269190612571565b60405180910390f35b34801561043a575f80fd5b506104556004803603810190610450919061262f565b610d13565b6040516104629190612687565b60405180910390f35b348015610476575f80fd5b5061047f610d30565b60405161048c91906126af565b60405180910390f35b3480156104a0575f80fd5b506104a9610d36565b005b3480156104b6575f80fd5b506104d160048036038101906104cc919061288c565b611255565b005b3480156104de575f80fd5b506104f960048036038101906104f49190612926565b611374565b60405161050691906126af565b60405180910390f35b34801561051a575f80fd5b5061053560048036038101906105309190612964565b6113f6565b005b60606040518060400160405280600681526020017f5765695765690000000000000000000000000000000000000000000000000000815250905090565b5f610587610580611482565b8484611489565b6001905092915050565b60125481565b61059f611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610622906129d9565b60405180910390fd5b5f600d819055507fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de35f6040516106619190612a39565b60405180910390a1565b5f6009600a61067a9190612bae565b6305f5e1006106899190612bf8565b905090565b5f61069a84848461164c565b610757846106a6611482565b610752856040518060600160405280602881526020016135816028913960025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f610709611482565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054611fd39092919063ffffffff16565b611489565b600190509392505050565b5f6009905090565b610772611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f5906129d9565b60405180910390fd5b5f5b8151811015610884575f60045f8484815181106108205761081f612c39565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610800565b5050565b5f60045f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff169050919050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661091a611482565b73ffffffffffffffffffffffffffffffffffffffff1614610939575f80fd5b5f610943306109e0565b90505f8111156109575761095681612035565b5b5f4790505f81111561096d5761096c816122a0565b5b5050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109b1611482565b73ffffffffffffffffffffffffffffffffffffffff16146109d0575f80fd5b5f4790506109dd816122a0565b50565b5f60015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610a2e611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab1906129d9565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b7c611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bff906129d9565b60405180910390fd5b6009600a610c169190612bae565b6305f5e100610c259190612bf8565b600f819055506009600a610c399190612bae565b6305f5e100610c489190612bf8565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6009600a610c7d9190612bae565b6305f5e100610c8c9190612bf8565b604051610c9991906126af565b60405180910390a1565b600f5481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60105481565b60606040518060400160405280600681526020017f5765695765690000000000000000000000000000000000000000000000000000815250905090565b5f610d26610d1f611482565b848461164c565b6001905092915050565b60115481565b610d3e611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc1906129d9565b60405180910390fd5b60148054906101000a900460ff1615610e18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0f90612cb0565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d60135f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610eb43060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166009600a610ea09190612bae565b6305f5e100610eaf9190612bf8565b611489565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f1e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f429190612ce2565b73ffffffffffffffffffffffffffffffffffffffff1663c9c653963060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fc8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fec9190612ce2565b6040518363ffffffff1660e01b8152600401611009929190612d0d565b6020604051808303815f875af1158015611025573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110499190612ce2565b60145f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110d0306109e0565b5f806110da610ca9565b426040518863ffffffff1660e01b81526004016110fc96959493929190612d34565b60606040518083038185885af1158015611118573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061113d9190612da7565b50505060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b360135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016111dd929190612df7565b6020604051808303815f875af11580156111f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061121d9190612e48565b506001601460166101000a81548160ff02191690831515021790555060016014806101000a81548160ff021916908315150217905550565b61125d611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e0906129d9565b60405180910390fd5b5f5b815181101561137057600160045f84848151811061130c5761130b612c39565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506112eb565b5050565b5f60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611436611482565b73ffffffffffffffffffffffffffffffffffffffff1614611455575f80fd5b600854811115801561146957506009548111155b611471575f80fd5b806008819055508060098190555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036114f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ee90612ee3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90612f71565b60405180910390fd5b8060025f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161163f91906126af565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036116ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b190612fff565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611728576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171f9061308d565b60405180910390fd5b5f811161176a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117619061311b565b60405180910390fd5b5f611773610ca9565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156117e157506117b1610ca9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611d235760045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611884575060045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b61188c575f80fd5b5f600e54036118d4576118d160646118c3600a54600e54116118b0576006546118b4565b6008545b8561230890919063ffffffff16565b61237f90919063ffffffff16565b90505b5f600e5411156119095761190660646118f8600d548561230890919063ffffffff16565b61237f90919063ffffffff16565b90505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156119b2575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a05575060035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611afd57600f54821115611a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4690613183565b60405180910390fd5b60105482611a5c856109e0565b611a6691906131a1565b1115611aa7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9e9061321e565b60405180910390fd5b611ae36064611ad5600a54600e5411611ac257600654611ac6565b6008545b8561230890919063ffffffff16565b61237f90919063ffffffff16565b9050600e5f815480929190611af79061323c565b91905055505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b8557503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611bc957611bc66064611bb8600b54600e5411611ba557600754611ba9565b6009545b8561230890919063ffffffff16565b61237f90919063ffffffff16565b90505b5f611bd3306109e0565b9050601460159054906101000a900460ff16158015611c3e575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015611c565750601460169054906101000a900460ff165b8015611c63575060115481115b8015611c725750600c54600e54115b15611d2157601654431115611c89575f6015819055505b600360155410611cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc5906132cd565b60405180910390fd5b611ceb611ce684611ce1846012546123c8565b6123c8565b612035565b5f4790505f811115611d0157611d00476122a0565b5b60155f815480929190611d139061323c565b919050555043601681905550505b505b5f811115611e2257611d7b8160015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546123e090919063ffffffff16565b60015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e1991906126af565b60405180910390a35b611e728260015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461243d90919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550611f15611ec9828461243d90919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546123e090919063ffffffff16565b60015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611fb8848661243d90919063ffffffff16565b604051611fc591906126af565b60405180910390a350505050565b5f83831115829061201a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120119190612571565b60405180910390fd5b505f838561202891906132eb565b9050809150509392505050565b6001601460156101000a81548160ff0219169083151502179055505f600267ffffffffffffffff81111561206c5761206b612750565b5b60405190808252806020026020018201604052801561209a5781602001602082028036833780820191505090505b50905030815f815181106120b1576120b0612c39565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612155573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121799190612ce2565b8160018151811061218d5761218c612c39565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121f33060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611489565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b81526004016122559594939291906133d5565b5f604051808303815f87803b15801561226c575f80fd5b505af115801561227e573d5f803e3d5ffd5b50505050505f601460156101000a81548160ff02191690831515021790555050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015612304573d5f803e3d5ffd5b5050565b5f808303612318575f9050612379565b5f82846123259190612bf8565b9050828482612334919061345a565b14612374576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236b906134fa565b60405180910390fd5b809150505b92915050565b5f6123c083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612486565b905092915050565b5f8183116123d657826123d8565b815b905092915050565b5f8082846123ee91906131a1565b905083811015612433576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161242a90613562565b60405180910390fd5b8091505092915050565b5f61247e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611fd3565b905092915050565b5f80831182906124cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c39190612571565b60405180910390fd5b505f83856124da919061345a565b9050809150509392505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561251e578082015181840152602081019050612503565b5f8484015250505050565b5f601f19601f8301169050919050565b5f612543826124e7565b61254d81856124f1565b935061255d818560208601612501565b61256681612529565b840191505092915050565b5f6020820190508181035f8301526125898184612539565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6125cb826125a2565b9050919050565b6125db816125c1565b81146125e5575f80fd5b50565b5f813590506125f6816125d2565b92915050565b5f819050919050565b61260e816125fc565b8114612618575f80fd5b50565b5f8135905061262981612605565b92915050565b5f80604083850312156126455761264461259a565b5b5f612652858286016125e8565b92505060206126638582860161261b565b9150509250929050565b5f8115159050919050565b6126818161266d565b82525050565b5f60208201905061269a5f830184612678565b92915050565b6126a9816125fc565b82525050565b5f6020820190506126c25f8301846126a0565b92915050565b5f805f606084860312156126df576126de61259a565b5b5f6126ec868287016125e8565b93505060206126fd868287016125e8565b925050604061270e8682870161261b565b9150509250925092565b5f60ff82169050919050565b61272d81612718565b82525050565b5f6020820190506127465f830184612724565b92915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61278682612529565b810181811067ffffffffffffffff821117156127a5576127a4612750565b5b80604052505050565b5f6127b7612591565b90506127c3828261277d565b919050565b5f67ffffffffffffffff8211156127e2576127e1612750565b5b602082029050602081019050919050565b5f80fd5b5f612809612804846127c8565b6127ae565b9050808382526020820190506020840283018581111561282c5761282b6127f3565b5b835b81811015612855578061284188826125e8565b84526020840193505060208101905061282e565b5050509392505050565b5f82601f8301126128735761287261274c565b5b81356128838482602086016127f7565b91505092915050565b5f602082840312156128a1576128a061259a565b5b5f82013567ffffffffffffffff8111156128be576128bd61259e565b5b6128ca8482850161285f565b91505092915050565b5f602082840312156128e8576128e761259a565b5b5f6128f5848285016125e8565b91505092915050565b612907816125c1565b82525050565b5f6020820190506129205f8301846128fe565b92915050565b5f806040838503121561293c5761293b61259a565b5b5f612949858286016125e8565b925050602061295a858286016125e8565b9150509250929050565b5f602082840312156129795761297861259a565b5b5f6129868482850161261b565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f6129c36020836124f1565b91506129ce8261298f565b602082019050919050565b5f6020820190508181035f8301526129f0816129b7565b9050919050565b5f819050919050565b5f819050919050565b5f612a23612a1e612a19846129f7565b612a00565b6125fc565b9050919050565b612a3381612a09565b82525050565b5f602082019050612a4c5f830184612a2a565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115612ad457808604811115612ab057612aaf612a52565b5b6001851615612abf5780820291505b8081029050612acd85612a7f565b9450612a94565b94509492505050565b5f82612aec5760019050612ba7565b81612af9575f9050612ba7565b8160018114612b0f5760028114612b1957612b48565b6001915050612ba7565b60ff841115612b2b57612b2a612a52565b5b8360020a915084821115612b4257612b41612a52565b5b50612ba7565b5060208310610133831016604e8410600b8410161715612b7d5782820a905083811115612b7857612b77612a52565b5b612ba7565b612b8a8484846001612a8b565b92509050818404811115612ba157612ba0612a52565b5b81810290505b9392505050565b5f612bb8826125fc565b9150612bc383612718565b9250612bf07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612add565b905092915050565b5f612c02826125fc565b9150612c0d836125fc565b9250828202612c1b816125fc565b91508282048414831517612c3257612c31612a52565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f74726164696e6720697320616c7265616479206f70656e0000000000000000005f82015250565b5f612c9a6017836124f1565b9150612ca582612c66565b602082019050919050565b5f6020820190508181035f830152612cc781612c8e565b9050919050565b5f81519050612cdc816125d2565b92915050565b5f60208284031215612cf757612cf661259a565b5b5f612d0484828501612cce565b91505092915050565b5f604082019050612d205f8301856128fe565b612d2d60208301846128fe565b9392505050565b5f60c082019050612d475f8301896128fe565b612d5460208301886126a0565b612d616040830187612a2a565b612d6e6060830186612a2a565b612d7b60808301856128fe565b612d8860a08301846126a0565b979650505050505050565b5f81519050612da181612605565b92915050565b5f805f60608486031215612dbe57612dbd61259a565b5b5f612dcb86828701612d93565b9350506020612ddc86828701612d93565b9250506040612ded86828701612d93565b9150509250925092565b5f604082019050612e0a5f8301856128fe565b612e1760208301846126a0565b9392505050565b612e278161266d565b8114612e31575f80fd5b50565b5f81519050612e4281612e1e565b92915050565b5f60208284031215612e5d57612e5c61259a565b5b5f612e6a84828501612e34565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f612ecd6024836124f1565b9150612ed882612e73565b604082019050919050565b5f6020820190508181035f830152612efa81612ec1565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f612f5b6022836124f1565b9150612f6682612f01565b604082019050919050565b5f6020820190508181035f830152612f8881612f4f565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f612fe96025836124f1565b9150612ff482612f8f565b604082019050919050565b5f6020820190508181035f83015261301681612fdd565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6130776023836124f1565b91506130828261301d565b604082019050919050565b5f6020820190508181035f8301526130a48161306b565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f6131056029836124f1565b9150613110826130ab565b604082019050919050565b5f6020820190508181035f830152613132816130f9565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e000000000000005f82015250565b5f61316d6019836124f1565b915061317882613139565b602082019050919050565b5f6020820190508181035f83015261319a81613161565b9050919050565b5f6131ab826125fc565b91506131b6836125fc565b92508282019050808211156131ce576131cd612a52565b5b92915050565b7f4578636565647320746865206d617857616c6c657453697a652e0000000000005f82015250565b5f613208601a836124f1565b9150613213826131d4565b602082019050919050565b5f6020820190508181035f830152613235816131fc565b9050919050565b5f613246826125fc565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361327857613277612a52565b5b600182019050919050565b7f4f6e6c7920332073656c6c732070657220626c6f636b210000000000000000005f82015250565b5f6132b76017836124f1565b91506132c282613283565b602082019050919050565b5f6020820190508181035f8301526132e4816132ab565b9050919050565b5f6132f5826125fc565b9150613300836125fc565b925082820390508181111561331857613317612a52565b5b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b613350816125c1565b82525050565b5f6133618383613347565b60208301905092915050565b5f602082019050919050565b5f6133838261331e565b61338d8185613328565b935061339883613338565b805f5b838110156133c85781516133af8882613356565b97506133ba8361336d565b92505060018101905061339b565b5085935050505092915050565b5f60a0820190506133e85f8301886126a0565b6133f56020830187612a2a565b81810360408301526134078186613379565b905061341660608301856128fe565b61342360808301846126a0565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f613464826125fc565b915061346f836125fc565b92508261347f5761347e61342d565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f6134e46021836124f1565b91506134ef8261348a565b604082019050919050565b5f6020820190508181035f830152613511816134d8565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f61354c601b836124f1565b915061355782613518565b602082019050919050565b5f6020820190508181035f83015261357981613540565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e833156075dfc13e9ad418616b237fa4a1fac5de1adaf7c10d67b4e864d4749d64736f6c63430008170033
60806040526004361061014e575f3560e01c8063715018a6116100b5578063a9059cbb1161006e578063a9059cbb1461042f578063bf474bed1461046b578063c9567bf914610495578063d34628cc146104ab578063dd62ed3e146104d3578063ec1f3f631461050f57610155565b8063715018a61461035b578063751039fc146103715780637d1db4a5146103875780638da5cb5b146103b15780638f9a55c0146103db57806395d89b411461040557610155565b8063313ce56711610107578063313ce5671461026557806331c2d8471461028f5780633bbac579146102b757806351bc3c85146102f35780636fc3eaec1461030957806370a082311461031f57610155565b806306fdde0314610159578063095ea7b3146101835780630faee56f146101bf578063109daa99146101e957806318160ddd146101ff57806323b872dd1461022957610155565b3661015557005b5f80fd5b348015610164575f80fd5b5061016d610537565b60405161017a9190612571565b60405180910390f35b34801561018e575f80fd5b506101a960048036038101906101a4919061262f565b610574565b6040516101b69190612687565b60405180910390f35b3480156101ca575f80fd5b506101d3610591565b6040516101e091906126af565b60405180910390f35b3480156101f4575f80fd5b506101fd610597565b005b34801561020a575f80fd5b5061021361066b565b60405161022091906126af565b60405180910390f35b348015610234575f80fd5b5061024f600480360381019061024a91906126c8565b61068e565b60405161025c9190612687565b60405180910390f35b348015610270575f80fd5b50610279610762565b6040516102869190612733565b60405180910390f35b34801561029a575f80fd5b506102b560048036038101906102b0919061288c565b61076a565b005b3480156102c2575f80fd5b506102dd60048036038101906102d891906128d3565b610888565b6040516102ea9190612687565b60405180910390f35b3480156102fe575f80fd5b506103076108da565b005b348015610314575f80fd5b5061031d610971565b005b34801561032a575f80fd5b50610345600480360381019061034091906128d3565b6109e0565b60405161035291906126af565b60405180910390f35b348015610366575f80fd5b5061036f610a26565b005b34801561037c575f80fd5b50610385610b74565b005b348015610392575f80fd5b5061039b610ca3565b6040516103a891906126af565b60405180910390f35b3480156103bc575f80fd5b506103c5610ca9565b6040516103d2919061290d565b60405180910390f35b3480156103e6575f80fd5b506103ef610cd0565b6040516103fc91906126af565b60405180910390f35b348015610410575f80fd5b50610419610cd6565b6040516104269190612571565b60405180910390f35b34801561043a575f80fd5b506104556004803603810190610450919061262f565b610d13565b6040516104629190612687565b60405180910390f35b348015610476575f80fd5b5061047f610d30565b60405161048c91906126af565b60405180910390f35b3480156104a0575f80fd5b506104a9610d36565b005b3480156104b6575f80fd5b506104d160048036038101906104cc919061288c565b611255565b005b3480156104de575f80fd5b506104f960048036038101906104f49190612926565b611374565b60405161050691906126af565b60405180910390f35b34801561051a575f80fd5b5061053560048036038101906105309190612964565b6113f6565b005b60606040518060400160405280600681526020017f5765695765690000000000000000000000000000000000000000000000000000815250905090565b5f610587610580611482565b8484611489565b6001905092915050565b60125481565b61059f611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610622906129d9565b60405180910390fd5b5f600d819055507fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de35f6040516106619190612a39565b60405180910390a1565b5f6009600a61067a9190612bae565b6305f5e1006106899190612bf8565b905090565b5f61069a84848461164c565b610757846106a6611482565b610752856040518060600160405280602881526020016135816028913960025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f610709611482565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054611fd39092919063ffffffff16565b611489565b600190509392505050565b5f6009905090565b610772611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f5906129d9565b60405180910390fd5b5f5b8151811015610884575f60045f8484815181106108205761081f612c39565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610800565b5050565b5f60045f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff169050919050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661091a611482565b73ffffffffffffffffffffffffffffffffffffffff1614610939575f80fd5b5f610943306109e0565b90505f8111156109575761095681612035565b5b5f4790505f81111561096d5761096c816122a0565b5b5050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109b1611482565b73ffffffffffffffffffffffffffffffffffffffff16146109d0575f80fd5b5f4790506109dd816122a0565b50565b5f60015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610a2e611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab1906129d9565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b7c611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bff906129d9565b60405180910390fd5b6009600a610c169190612bae565b6305f5e100610c259190612bf8565b600f819055506009600a610c399190612bae565b6305f5e100610c489190612bf8565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6009600a610c7d9190612bae565b6305f5e100610c8c9190612bf8565b604051610c9991906126af565b60405180910390a1565b600f5481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60105481565b60606040518060400160405280600681526020017f5765695765690000000000000000000000000000000000000000000000000000815250905090565b5f610d26610d1f611482565b848461164c565b6001905092915050565b60115481565b610d3e611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc1906129d9565b60405180910390fd5b60148054906101000a900460ff1615610e18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0f90612cb0565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d60135f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610eb43060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166009600a610ea09190612bae565b6305f5e100610eaf9190612bf8565b611489565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f1e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f429190612ce2565b73ffffffffffffffffffffffffffffffffffffffff1663c9c653963060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fc8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fec9190612ce2565b6040518363ffffffff1660e01b8152600401611009929190612d0d565b6020604051808303815f875af1158015611025573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110499190612ce2565b60145f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110d0306109e0565b5f806110da610ca9565b426040518863ffffffff1660e01b81526004016110fc96959493929190612d34565b60606040518083038185885af1158015611118573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061113d9190612da7565b50505060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b360135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016111dd929190612df7565b6020604051808303815f875af11580156111f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061121d9190612e48565b506001601460166101000a81548160ff02191690831515021790555060016014806101000a81548160ff021916908315150217905550565b61125d611482565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e0906129d9565b60405180910390fd5b5f5b815181101561137057600160045f84848151811061130c5761130b612c39565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506112eb565b5050565b5f60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611436611482565b73ffffffffffffffffffffffffffffffffffffffff1614611455575f80fd5b600854811115801561146957506009548111155b611471575f80fd5b806008819055508060098190555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036114f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ee90612ee3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90612f71565b60405180910390fd5b8060025f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161163f91906126af565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036116ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b190612fff565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611728576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171f9061308d565b60405180910390fd5b5f811161176a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117619061311b565b60405180910390fd5b5f611773610ca9565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156117e157506117b1610ca9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611d235760045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611884575060045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b61188c575f80fd5b5f600e54036118d4576118d160646118c3600a54600e54116118b0576006546118b4565b6008545b8561230890919063ffffffff16565b61237f90919063ffffffff16565b90505b5f600e5411156119095761190660646118f8600d548561230890919063ffffffff16565b61237f90919063ffffffff16565b90505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156119b2575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a05575060035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611afd57600f54821115611a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4690613183565b60405180910390fd5b60105482611a5c856109e0565b611a6691906131a1565b1115611aa7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9e9061321e565b60405180910390fd5b611ae36064611ad5600a54600e5411611ac257600654611ac6565b6008545b8561230890919063ffffffff16565b61237f90919063ffffffff16565b9050600e5f815480929190611af79061323c565b91905055505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b8557503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611bc957611bc66064611bb8600b54600e5411611ba557600754611ba9565b6009545b8561230890919063ffffffff16565b61237f90919063ffffffff16565b90505b5f611bd3306109e0565b9050601460159054906101000a900460ff16158015611c3e575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015611c565750601460169054906101000a900460ff165b8015611c63575060115481115b8015611c725750600c54600e54115b15611d2157601654431115611c89575f6015819055505b600360155410611cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc5906132cd565b60405180910390fd5b611ceb611ce684611ce1846012546123c8565b6123c8565b612035565b5f4790505f811115611d0157611d00476122a0565b5b60155f815480929190611d139061323c565b919050555043601681905550505b505b5f811115611e2257611d7b8160015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546123e090919063ffffffff16565b60015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e1991906126af565b60405180910390a35b611e728260015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461243d90919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550611f15611ec9828461243d90919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546123e090919063ffffffff16565b60015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611fb8848661243d90919063ffffffff16565b604051611fc591906126af565b60405180910390a350505050565b5f83831115829061201a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120119190612571565b60405180910390fd5b505f838561202891906132eb565b9050809150509392505050565b6001601460156101000a81548160ff0219169083151502179055505f600267ffffffffffffffff81111561206c5761206b612750565b5b60405190808252806020026020018201604052801561209a5781602001602082028036833780820191505090505b50905030815f815181106120b1576120b0612c39565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612155573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121799190612ce2565b8160018151811061218d5761218c612c39565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121f33060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611489565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b81526004016122559594939291906133d5565b5f604051808303815f87803b15801561226c575f80fd5b505af115801561227e573d5f803e3d5ffd5b50505050505f601460156101000a81548160ff02191690831515021790555050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015612304573d5f803e3d5ffd5b5050565b5f808303612318575f9050612379565b5f82846123259190612bf8565b9050828482612334919061345a565b14612374576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236b906134fa565b60405180910390fd5b809150505b92915050565b5f6123c083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612486565b905092915050565b5f8183116123d657826123d8565b815b905092915050565b5f8082846123ee91906131a1565b905083811015612433576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161242a90613562565b60405180910390fd5b8091505092915050565b5f61247e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611fd3565b905092915050565b5f80831182906124cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c39190612571565b60405180910390fd5b505f83856124da919061345a565b9050809150509392505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561251e578082015181840152602081019050612503565b5f8484015250505050565b5f601f19601f8301169050919050565b5f612543826124e7565b61254d81856124f1565b935061255d818560208601612501565b61256681612529565b840191505092915050565b5f6020820190508181035f8301526125898184612539565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6125cb826125a2565b9050919050565b6125db816125c1565b81146125e5575f80fd5b50565b5f813590506125f6816125d2565b92915050565b5f819050919050565b61260e816125fc565b8114612618575f80fd5b50565b5f8135905061262981612605565b92915050565b5f80604083850312156126455761264461259a565b5b5f612652858286016125e8565b92505060206126638582860161261b565b9150509250929050565b5f8115159050919050565b6126818161266d565b82525050565b5f60208201905061269a5f830184612678565b92915050565b6126a9816125fc565b82525050565b5f6020820190506126c25f8301846126a0565b92915050565b5f805f606084860312156126df576126de61259a565b5b5f6126ec868287016125e8565b93505060206126fd868287016125e8565b925050604061270e8682870161261b565b9150509250925092565b5f60ff82169050919050565b61272d81612718565b82525050565b5f6020820190506127465f830184612724565b92915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61278682612529565b810181811067ffffffffffffffff821117156127a5576127a4612750565b5b80604052505050565b5f6127b7612591565b90506127c3828261277d565b919050565b5f67ffffffffffffffff8211156127e2576127e1612750565b5b602082029050602081019050919050565b5f80fd5b5f612809612804846127c8565b6127ae565b9050808382526020820190506020840283018581111561282c5761282b6127f3565b5b835b81811015612855578061284188826125e8565b84526020840193505060208101905061282e565b5050509392505050565b5f82601f8301126128735761287261274c565b5b81356128838482602086016127f7565b91505092915050565b5f602082840312156128a1576128a061259a565b5b5f82013567ffffffffffffffff8111156128be576128bd61259e565b5b6128ca8482850161285f565b91505092915050565b5f602082840312156128e8576128e761259a565b5b5f6128f5848285016125e8565b91505092915050565b612907816125c1565b82525050565b5f6020820190506129205f8301846128fe565b92915050565b5f806040838503121561293c5761293b61259a565b5b5f612949858286016125e8565b925050602061295a858286016125e8565b9150509250929050565b5f602082840312156129795761297861259a565b5b5f6129868482850161261b565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f6129c36020836124f1565b91506129ce8261298f565b602082019050919050565b5f6020820190508181035f8301526129f0816129b7565b9050919050565b5f819050919050565b5f819050919050565b5f612a23612a1e612a19846129f7565b612a00565b6125fc565b9050919050565b612a3381612a09565b82525050565b5f602082019050612a4c5f830184612a2a565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115612ad457808604811115612ab057612aaf612a52565b5b6001851615612abf5780820291505b8081029050612acd85612a7f565b9450612a94565b94509492505050565b5f82612aec5760019050612ba7565b81612af9575f9050612ba7565b8160018114612b0f5760028114612b1957612b48565b6001915050612ba7565b60ff841115612b2b57612b2a612a52565b5b8360020a915084821115612b4257612b41612a52565b5b50612ba7565b5060208310610133831016604e8410600b8410161715612b7d5782820a905083811115612b7857612b77612a52565b5b612ba7565b612b8a8484846001612a8b565b92509050818404811115612ba157612ba0612a52565b5b81810290505b9392505050565b5f612bb8826125fc565b9150612bc383612718565b9250612bf07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612add565b905092915050565b5f612c02826125fc565b9150612c0d836125fc565b9250828202612c1b816125fc565b91508282048414831517612c3257612c31612a52565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f74726164696e6720697320616c7265616479206f70656e0000000000000000005f82015250565b5f612c9a6017836124f1565b9150612ca582612c66565b602082019050919050565b5f6020820190508181035f830152612cc781612c8e565b9050919050565b5f81519050612cdc816125d2565b92915050565b5f60208284031215612cf757612cf661259a565b5b5f612d0484828501612cce565b91505092915050565b5f604082019050612d205f8301856128fe565b612d2d60208301846128fe565b9392505050565b5f60c082019050612d475f8301896128fe565b612d5460208301886126a0565b612d616040830187612a2a565b612d6e6060830186612a2a565b612d7b60808301856128fe565b612d8860a08301846126a0565b979650505050505050565b5f81519050612da181612605565b92915050565b5f805f60608486031215612dbe57612dbd61259a565b5b5f612dcb86828701612d93565b9350506020612ddc86828701612d93565b9250506040612ded86828701612d93565b9150509250925092565b5f604082019050612e0a5f8301856128fe565b612e1760208301846126a0565b9392505050565b612e278161266d565b8114612e31575f80fd5b50565b5f81519050612e4281612e1e565b92915050565b5f60208284031215612e5d57612e5c61259a565b5b5f612e6a84828501612e34565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f612ecd6024836124f1565b9150612ed882612e73565b604082019050919050565b5f6020820190508181035f830152612efa81612ec1565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f612f5b6022836124f1565b9150612f6682612f01565b604082019050919050565b5f6020820190508181035f830152612f8881612f4f565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f612fe96025836124f1565b9150612ff482612f8f565b604082019050919050565b5f6020820190508181035f83015261301681612fdd565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6130776023836124f1565b91506130828261301d565b604082019050919050565b5f6020820190508181035f8301526130a48161306b565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f6131056029836124f1565b9150613110826130ab565b604082019050919050565b5f6020820190508181035f830152613132816130f9565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e000000000000005f82015250565b5f61316d6019836124f1565b915061317882613139565b602082019050919050565b5f6020820190508181035f83015261319a81613161565b9050919050565b5f6131ab826125fc565b91506131b6836125fc565b92508282019050808211156131ce576131cd612a52565b5b92915050565b7f4578636565647320746865206d617857616c6c657453697a652e0000000000005f82015250565b5f613208601a836124f1565b9150613213826131d4565b602082019050919050565b5f6020820190508181035f830152613235816131fc565b9050919050565b5f613246826125fc565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361327857613277612a52565b5b600182019050919050565b7f4f6e6c7920332073656c6c732070657220626c6f636b210000000000000000005f82015250565b5f6132b76017836124f1565b91506132c282613283565b602082019050919050565b5f6020820190508181035f8301526132e4816132ab565b9050919050565b5f6132f5826125fc565b9150613300836125fc565b925082820390508181111561331857613317612a52565b5b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b613350816125c1565b82525050565b5f6133618383613347565b60208301905092915050565b5f602082019050919050565b5f6133838261331e565b61338d8185613328565b935061339883613338565b805f5b838110156133c85781516133af8882613356565b97506133ba8361336d565b92505060018101905061339b565b5085935050505092915050565b5f60a0820190506133e85f8301886126a0565b6133f56020830187612a2a565b81810360408301526134078186613379565b905061341660608301856128fe565b61342360808301846126a0565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f613464826125fc565b915061346f836125fc565b92508261347f5761347e61342d565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f6134e46021836124f1565b91506134ef8261348a565b604082019050919050565b5f6020820190508181035f830152613511816134d8565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f61354c601b836124f1565b915061355782613518565b602082019050919050565b5f6020820190508181035f83015261357981613540565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e833156075dfc13e9ad418616b237fa4a1fac5de1adaf7c10d67b4e864d4749d64736f6c63430008170033
// SPDX-License-Identifier: UNLICENSE /* https://t.me/WeiWeiErc https://x.com/WeiweiErc https://www.weiweitoken.com/ */ pragma solidity 0.8.23; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract Contract is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; address payable private _taxWallet; string private constant _name = unicode"WeiWei"; string private constant _symbol = unicode"WeiWei"; uint256 private _initialBuyTax=22; uint256 private _initialSellTax=22; uint256 private _finalBuyTax=0; uint256 private _finalSellTax=0; uint256 private _reduceBuyTaxAt=22; uint256 private _reduceSellTaxAt=22; uint256 private _preventSwapBefore=10; uint256 private _transferTax=70; uint256 private _buyCount=0; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 100000000 * 10**_decimals; uint256 public _maxTxAmount = 2000000 * 10**_decimals; uint256 public _maxWalletSize = 2000000 * 10**_decimals; uint256 public _taxSwapThreshold= 1000000 * 10**_decimals; uint256 public _maxTaxSwap= 1800000 * 10**_decimals; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; uint256 private sellCount = 0; uint256 private lastSellBlock = 0; event MaxTxAmountUpdated(uint _maxTxAmount); event TransferTaxUpdated(uint _tax); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _balances[_msgSender()] = _tTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); uint256 taxAmount=0; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if(_buyCount==0){ taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); } if(_buyCount>0){ taxAmount = amount.mul(_transferTax).div(100); } if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] ) { require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount."); require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize."); taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); _buyCount++; } if(to == uniswapV2Pair && from!= address(this) ){ taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) { if (block.number > lastSellBlock) { sellCount = 0; } require(sellCount < 3, "Only 3 sells per block!"); swapTokensForEth(min(amount, min(contractTokenBalance, _maxTaxSwap))); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } sellCount++; lastSellBlock = block.number; } } if(taxAmount>0){ _balances[address(this)]=_balances[address(this)].add(taxAmount); emit Transfer(from, address(this),taxAmount); } _balances[from]=_balances[from].sub(amount); _balances[to]=_balances[to].add(amount.sub(taxAmount)); emit Transfer(from, to, amount.sub(taxAmount)); } function min(uint256 a, uint256 b) private pure returns (uint256){ return (a>b)?b:a; } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function removeLimits() external onlyOwner{ _maxTxAmount = _tTotal; _maxWalletSize=_tTotal; emit MaxTxAmountUpdated(_tTotal); } function removeTransferTax() external onlyOwner{ _transferTax = 0; emit TransferTaxUpdated(0); } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function addBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBots(address[] memory notbot) public onlyOwner { for (uint i = 0; i < notbot.length; i++) { bots[notbot[i]] = false; } } function isBot(address a) public view returns (bool){ return bots[a]; } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); swapEnabled = true; tradingOpen = true; } function reduceFee(uint256 _newFee) external{ require(_msgSender()==_taxWallet); require(_newFee<=_finalBuyTax && _newFee<=_finalSellTax); _finalBuyTax=_newFee; _finalSellTax=_newFee; } receive() external payable {} function manualSwap() external { require(_msgSender()==_taxWallet); uint256 tokenBalance=balanceOf(address(this)); if(tokenBalance>0){ swapTokensForEth(tokenBalance); } uint256 ethBalance=address(this).balance; if(ethBalance>0){ sendETHToFee(ethBalance); } } function manualsend() external { require(_msgSender()==_taxWallet); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } }
1
20,290,304
66309f730fba02f8e471c31c697cf47327b49fa8b5c5b7f08d76ba630034f14b
eaa721f18fd08971eaace090dcbf41179cbfe425e4df34b92f574d63f174f6cc
b1d7319206f816b2c0025f2022a23c7a1db622fd
b1d7319206f816b2c0025f2022a23c7a1db622fd
fb54277de1c8538b4690cec5234d35671e64549e
608060405234801561000f575f80fd5b5060405161052d38038061052d833981810160405281019061003191906100d5565b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610100565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a48261007b565b9050919050565b6100b48161009a565b81146100be575f80fd5b50565b5f815190506100cf816100ab565b92915050565b5f602082840312156100ea576100e9610077565b5b5f6100f7848285016100c1565b91505092915050565b6104208061010d5f395ff3fe608060405260043610610028575f3560e01c8063019009371461002c5780638381f58a1461005c575b5f80fd5b61004660048036038101906100419190610221565b610086565b60405161005391906102b4565b60405180910390f35b348015610067575f80fd5b5061007061013b565b60405161007d91906102e5565b60405180910390f35b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010d90610358565b60405180910390fd5b5f80815480929190610127906103a3565b91905055505f545f1b905095945050505050565b5f5481565b5f80fd5b5f80fd5b5f819050919050565b61015a81610148565b8114610164575f80fd5b50565b5f8135905061017581610151565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b61019f8161017b565b81146101a9575f80fd5b50565b5f813590506101ba81610196565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126101e1576101e06101c0565b5b8235905067ffffffffffffffff8111156101fe576101fd6101c4565b5b60208301915083600182028301111561021a576102196101c8565b5b9250929050565b5f805f805f6080868803121561023a57610239610140565b5b5f61024788828901610167565b9550506020610258888289016101ac565b945050604061026988828901610167565b935050606086013567ffffffffffffffff81111561028a57610289610144565b5b610296888289016101cc565b92509250509295509295909350565b6102ae81610148565b82525050565b5f6020820190506102c75f8301846102a5565b92915050565b5f819050919050565b6102df816102cd565b82525050565b5f6020820190506102f85f8301846102d6565b92915050565b5f82825260208201905092915050565b7f756e617574686f72697a656400000000000000000000000000000000000000005f82015250565b5f610342600c836102fe565b915061034d8261030e565b602082019050919050565b5f6020820190508181035f83015261036f81610336565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6103ad826102cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103df576103de610376565b5b60018201905091905056fea2646970667358221220b95cccf60d5810b7cc788ba892ff4f587e098006baed2065c9ed4073a069f8f364736f6c634300081a0033000000000000000000000000000000007f56768de3133034fa730a909003a165
608060405260043610610028575f3560e01c8063019009371461002c5780638381f58a1461005c575b5f80fd5b61004660048036038101906100419190610221565b610086565b60405161005391906102b4565b60405180910390f35b348015610067575f80fd5b5061007061013b565b60405161007d91906102e5565b60405180910390f35b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010d90610358565b60405180910390fd5b5f80815480929190610127906103a3565b91905055505f545f1b905095945050505050565b5f5481565b5f80fd5b5f80fd5b5f819050919050565b61015a81610148565b8114610164575f80fd5b50565b5f8135905061017581610151565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b61019f8161017b565b81146101a9575f80fd5b50565b5f813590506101ba81610196565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126101e1576101e06101c0565b5b8235905067ffffffffffffffff8111156101fe576101fd6101c4565b5b60208301915083600182028301111561021a576102196101c8565b5b9250929050565b5f805f805f6080868803121561023a57610239610140565b5b5f61024788828901610167565b9550506020610258888289016101ac565b945050604061026988828901610167565b935050606086013567ffffffffffffffff81111561028a57610289610144565b5b610296888289016101cc565b92509250509295509295909350565b6102ae81610148565b82525050565b5f6020820190506102c75f8301846102a5565b92915050565b5f819050919050565b6102df816102cd565b82525050565b5f6020820190506102f85f8301846102d6565b92915050565b5f82825260208201905092915050565b7f756e617574686f72697a656400000000000000000000000000000000000000005f82015250565b5f610342600c836102fe565b915061034d8261030e565b602082019050919050565b5f6020820190508181035f83015261036f81610336565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6103ad826102cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103df576103de610376565b5b60018201905091905056fea2646970667358221220b95cccf60d5810b7cc788ba892ff4f587e098006baed2065c9ed4073a069f8f364736f6c634300081a0033
1
20,290,304
66309f730fba02f8e471c31c697cf47327b49fa8b5c5b7f08d76ba630034f14b
e0a9fbc31c81ca6e3bdebeaca14fbebc95491d3bcb881af72e3fc35a4679c521
dab98fead7b3029acfd54ef8caa491e25d041e7b
dab98fead7b3029acfd54ef8caa491e25d041e7b
28293c6c177727e59953c9b0dad20fe857fc32f8
608060405234801562000010575f80fd5b50620000216200002760201b60201c565b62000191565b5f620000386200012b60201b60201c565b9050805f0160089054906101000a900460ff161562000083576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff8016815f015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1614620001285767ffffffffffffffff815f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d267ffffffffffffffff6040516200011f919062000176565b60405180910390a15b50565b5f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b5f67ffffffffffffffff82169050919050565b620001708162000152565b82525050565b5f6020820190506200018b5f83018462000165565b92915050565b61331a806200019f5f395ff3fe608060405234801561000f575f80fd5b506004361061018c575f3560e01c8063715018a6116100dc57806395d89b4111610095578063d505accf1161006f578063d505accf14610464578063d9d98ce414610480578063dd62ed3e146104b0578063f2fde38b146104e05761018c565b806395d89b41146103fa578063a9059cbb14610418578063c4d66de8146104485761018c565b8063715018a61461035857806379cc6790146103625780637ecebe001461037e5780638456cb59146103ae57806384b0196e146103b85780638da5cb5b146103dc5761018c565b80633f4ba83a116101495780635c975abb116101235780635c975abb146102aa5780635cffe9de146102c8578063613255ab146102f857806370a08231146103285761018c565b80633f4ba83a1461026857806340c10f191461027257806342966c681461028e5761018c565b806306fdde0314610190578063095ea7b3146101ae57806318160ddd146101de57806323b872dd146101fc578063313ce5671461022c5780633644e5151461024a575b5f80fd5b6101986104fc565b6040516101a59190612432565b60405180910390f35b6101c860048036038101906101c391906124e7565b61059a565b6040516101d5919061253f565b60405180910390f35b6101e66105bc565b6040516101f39190612567565b60405180910390f35b61021660048036038101906102119190612580565b6105d3565b604051610223919061253f565b60405180910390f35b610234610601565b60405161024191906125eb565b60405180910390f35b610252610609565b60405161025f919061261c565b60405180910390f35b610270610617565b005b61028c600480360381019061028791906124e7565b610629565b005b6102a860048036038101906102a39190612635565b61063f565b005b6102b2610653565b6040516102bf919061253f565b60405180910390f35b6102e260048036038101906102dd91906126fc565b610675565b6040516102ef919061253f565b60405180910390f35b610312600480360381019061030d9190612780565b61086a565b60405161031f9190612567565b60405180910390f35b610342600480360381019061033d9190612780565b6108df565b60405161034f9190612567565b60405180910390f35b610360610932565b005b61037c600480360381019061037791906124e7565b610945565b005b61039860048036038101906103939190612780565b610965565b6040516103a59190612567565b60405180910390f35b6103b6610976565b005b6103c0610988565b6040516103d397969594939291906128ab565b60405180910390f35b6103e4610a91565b6040516103f1919061292d565b60405180910390f35b610402610ac6565b60405161040f9190612432565b60405180910390f35b610432600480360381019061042d91906124e7565b610b64565b60405161043f919061253f565b60405180910390f35b610462600480360381019061045d9190612780565b610b86565b005b61047e6004803603810190610479919061299a565b610dfe565b005b61049a600480360381019061049591906124e7565b610f43565b6040516104a79190612567565b60405180910390f35b6104ca60048036038101906104c59190612a37565b610fc6565b6040516104d79190612567565b60405180910390f35b6104fa60048036038101906104f59190612780565b611056565b005b60605f6105076110da565b905080600301805461051890612aa2565b80601f016020809104026020016040519081016040528092919081815260200182805461054490612aa2565b801561058f5780601f106105665761010080835404028352916020019161058f565b820191905f5260205f20905b81548152906001019060200180831161057257829003601f168201915b505050505091505090565b5f806105a4611101565b90506105b1818585611108565b600191505092915050565b5f806105c66110da565b9050806002015491505090565b5f806105dd611101565b90506105ea85828561111a565b6105f58585856111ac565b60019150509392505050565b5f6012905090565b5f61061261129c565b905090565b61061f6112aa565b610627611331565b565b6106316112aa565b61063b828261139f565b5050565b61065061064a611101565b8261141e565b50565b5f8061065d61149d565b9050805f015f9054906101000a900460ff1691505090565b5f806106808661086a565b9050808511156106c757806040517ffd9a76090000000000000000000000000000000000000000000000000000000081526004016106be9190612567565b60405180910390fd5b5f6106d28787610f43565b90506106de888761139f565b7f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98873ffffffffffffffffffffffffffffffffffffffff166323e30c8b610723611101565b8a8a868b8b6040518763ffffffff1660e01b815260040161074996959493929190612b1c565b6020604051808303815f875af1158015610765573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107899190612b8a565b146107cb57876040517f678c5b000000000000000000000000000000000000000000000000000000000081526004016107c2919061292d565b60405180910390fd5b5f6107d46114c4565b90506107ec8930848a6107e79190612be2565b61111a565b5f82148061082557505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156108445761083f89838961083a9190612be2565b61141e565b61085a565b61084e898861141e565b6108598982846111ac565b5b6001935050505095945050505050565b5f3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146108a4575f6108d8565b6108ac6105bc565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6108d79190612c15565b5b9050919050565b5f806108e96110da565b9050805f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054915050919050565b61093a6112aa565b6109435f6114c8565b565b61095782610951611101565b8361111a565b610961828261141e565b5050565b5f61096f82611599565b9050919050565b61097e6112aa565b6109866115ec565b565b5f6060805f805f60605f61099a61165b565b90505f801b815f01541480156109b557505f801b8160010154145b6109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109eb90612c92565b60405180910390fd5b6109fc611682565b610a04611720565b46305f801b5f67ffffffffffffffff811115610a2357610a22612cb0565b5b604051908082528060200260200182016040528015610a515781602001602082028036833780820191505090505b507f0f0000000000000000000000000000000000000000000000000000000000000095949392919097509750975097509750975097505090919293949596565b5f80610a9b6117be565b9050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691505090565b60605f610ad16110da565b9050806004018054610ae290612aa2565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0e90612aa2565b8015610b595780601f10610b3057610100808354040283529160200191610b59565b820191905f5260205f20905b815481529060010190602001808311610b3c57829003601f168201915b505050505091505090565b5f80610b6e611101565b9050610b7b8185856111ac565b600191505092915050565b5f610b8f6117e5565b90505f815f0160089054906101000a900460ff161590505f825f015f9054906101000a900467ffffffffffffffff1690505f808267ffffffffffffffff16148015610bd75750825b90505f60018367ffffffffffffffff16148015610c0a57505f3073ffffffffffffffffffffffffffffffffffffffff163b145b905081158015610c18575080155b15610c4f576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001855f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055508315610c9c576001855f0160086101000a81548160ff0219169083151502179055505b610d106040518060400160405280600681526020017f57495a41524400000000000000000000000000000000000000000000000000008152506040518060400160405280600481526020017f5a4152440000000000000000000000000000000000000000000000000000000081525061180c565b610d18611822565b610d2061182c565b610d298661183e565b610d676040518060400160405280600681526020017f57495a4152440000000000000000000000000000000000000000000000000000815250611852565b610d6f61189c565b610d9c33610d7b610601565b600a610d879190612e0c565b64174876e800610d979190612e56565b61139f565b8315610df6575f855f0160086101000a81548160ff0219169083151502179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d26001604051610ded9190612eec565b60405180910390a15b505050505050565b83421115610e4357836040517f62791302000000000000000000000000000000000000000000000000000000008152600401610e3a9190612567565b60405180910390fd5b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610e718c6118a6565b89604051602001610e8796959493929190612f05565b6040516020818303038152906040528051906020012090505f610ea982611906565b90505f610eb88287878761191f565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610f2c57808a6040517f4b800e46000000000000000000000000000000000000000000000000000000008152600401610f23929190612f64565b60405180910390fd5b610f378a8a8a611108565b50505050505050505050565b5f3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610fb457826040517fb5a7db92000000000000000000000000000000000000000000000000000000008152600401610fab919061292d565b60405180910390fd5b610fbe838361194d565b905092915050565b5f80610fd06110da565b9050806001015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205491505092915050565b61105e6112aa565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110ce575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016110c5919061292d565b60405180910390fd5b6110d7816114c8565b50565b5f7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00905090565b5f33905090565b6111158383836001611954565b505050565b5f6111258484610fc6565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146111a65781811015611197578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161118e93929190612f8b565b60405180910390fd5b6111a584848484035f611954565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361121c575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401611213919061292d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361128c575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401611283919061292d565b60405180910390fd5b611297838383611b31565b505050565b5f6112a5611b41565b905090565b6112b2611101565b73ffffffffffffffffffffffffffffffffffffffff166112d0610a91565b73ffffffffffffffffffffffffffffffffffffffff161461132f576112f3611101565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611326919061292d565b60405180910390fd5b565b611339611ba4565b5f61134261149d565b90505f815f015f6101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611387611101565b604051611394919061292d565b60405180910390a150565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361140f575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401611406919061292d565b60405180910390fd5b61141a5f8383611b31565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361148e575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401611485919061292d565b60405180910390fd5b611499825f83611b31565b5050565b5f7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300905090565b5f90565b5f6114d16117be565b90505f815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082825f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3505050565b5f806115a3611be4565b9050805f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054915050919050565b6115f4611c0b565b5f6115fd61149d565b90506001815f015f6101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611643611101565b604051611650919061292d565b60405180910390a150565b5f7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100905090565b60605f61168d61165b565b905080600201805461169e90612aa2565b80601f01602080910402602001604051908101604052809291908181526020018280546116ca90612aa2565b80156117155780601f106116ec57610100808354040283529160200191611715565b820191905f5260205f20905b8154815290600101906020018083116116f857829003601f168201915b505050505091505090565b60605f61172b61165b565b905080600301805461173c90612aa2565b80601f016020809104026020016040519081016040528092919081815260200182805461176890612aa2565b80156117b35780601f1061178a576101008083540402835291602001916117b3565b820191905f5260205f20905b81548152906001019060200180831161179657829003601f168201915b505050505091505090565b5f7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300905090565b5f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b611814611c4c565b61181e8282611c8c565b5050565b61182a611c4c565b565b611834611c4c565b61183c611cc8565b565b611846611c4c565b61184f81611cf8565b50565b61185a611c4c565b611899816040518060400160405280600181526020017f3100000000000000000000000000000000000000000000000000000000000000815250611d7c565b50565b6118a4611c4c565b565b5f806118b0611be4565b9050805f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f81548092919060010191905055915050919050565b5f61191861191261129c565b83611dcd565b9050919050565b5f805f8061192f88888888611e0d565b92509250925061193f8282611ef4565b829350505050949350505050565b5f92915050565b5f61195d6110da565b90505f73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036119cf575f6040517fe602df050000000000000000000000000000000000000000000000000000000081526004016119c6919061292d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611a3f575f6040517f94280d62000000000000000000000000000000000000000000000000000000008152600401611a36919061292d565b60405180910390fd5b82816001015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508115611b2a578373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051611b219190612567565b60405180910390a35b5050505050565b611b3c838383612056565b505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611b6b61206e565b611b736120e4565b4630604051602001611b89959493929190612fc0565b60405160208183030381529060405280519060200120905090565b611bac610653565b611be2576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b5f7f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb00905090565b611c13610653565b15611c4a576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611c5461215b565b611c8a576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611c94611c4c565b5f611c9d6110da565b905082816003019081611cb091906131a5565b5081816004019081611cc291906131a5565b50505050565b611cd0611c4c565b5f611cd961149d565b90505f815f015f6101000a81548160ff02191690831515021790555050565b611d00611c4c565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611d70575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401611d67919061292d565b60405180910390fd5b611d79816114c8565b50565b611d84611c4c565b5f611d8d61165b565b905082816002019081611da091906131a5565b5081816003019081611db291906131a5565b505f801b815f01819055505f801b8160010181905550505050565b5f6040517f190100000000000000000000000000000000000000000000000000000000000081528360028201528260228201526042812091505092915050565b5f805f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c1115611e49575f600385925092509250611eea565b5f6001888888886040515f8152602001604052604051611e6c9493929190613274565b6020604051602081039080840390855afa158015611e8c573d5f803e3d5ffd5b5050506020604051035190505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611edd575f60015f801b93509350935050611eea565b805f805f1b935093509350505b9450945094915050565b5f6003811115611f0757611f066132b7565b5b826003811115611f1a57611f196132b7565b5b03156120525760016003811115611f3457611f336132b7565b5b826003811115611f4757611f466132b7565b5b03611f7e576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026003811115611f9257611f916132b7565b5b826003811115611fa557611fa46132b7565b5b03611fe957805f1c6040517ffce698f7000000000000000000000000000000000000000000000000000000008152600401611fe09190612567565b60405180910390fd5b600380811115611ffc57611ffb6132b7565b5b82600381111561200f5761200e6132b7565b5b0361205157806040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600401612048919061261c565b60405180910390fd5b5b5050565b61205e611c0b565b612069838383612179565b505050565b5f8061207861165b565b90505f612083611682565b90505f8151111561209f578080519060200120925050506120e1565b5f825f015490505f801b81146120ba578093505050506120e1565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47093505050505b90565b5f806120ee61165b565b90505f6120f9611720565b90505f8151111561211557808051906020012092505050612158565b5f826001015490505f801b811461213157809350505050612158565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47093505050505b90565b5f6121646117e5565b5f0160089054906101000a900460ff16905090565b5f6121826110da565b90505f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036121d65781816002015f8282546121ca9190612be2565b925050819055506122a8565b5f815f015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905082811015612261578481846040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161225893929190612f8b565b60405180910390fd5b828103825f015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036122f15781816002015f828254039250508190555061233d565b81815f015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161239a9190612567565b60405180910390a350505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156123df5780820151818401526020810190506123c4565b5f8484015250505050565b5f601f19601f8301169050919050565b5f612404826123a8565b61240e81856123b2565b935061241e8185602086016123c2565b612427816123ea565b840191505092915050565b5f6020820190508181035f83015261244a81846123fa565b905092915050565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6124838261245a565b9050919050565b61249381612479565b811461249d575f80fd5b50565b5f813590506124ae8161248a565b92915050565b5f819050919050565b6124c6816124b4565b81146124d0575f80fd5b50565b5f813590506124e1816124bd565b92915050565b5f80604083850312156124fd576124fc612452565b5b5f61250a858286016124a0565b925050602061251b858286016124d3565b9150509250929050565b5f8115159050919050565b61253981612525565b82525050565b5f6020820190506125525f830184612530565b92915050565b612561816124b4565b82525050565b5f60208201905061257a5f830184612558565b92915050565b5f805f6060848603121561259757612596612452565b5b5f6125a4868287016124a0565b93505060206125b5868287016124a0565b92505060406125c6868287016124d3565b9150509250925092565b5f60ff82169050919050565b6125e5816125d0565b82525050565b5f6020820190506125fe5f8301846125dc565b92915050565b5f819050919050565b61261681612604565b82525050565b5f60208201905061262f5f83018461260d565b92915050565b5f6020828403121561264a57612649612452565b5b5f612657848285016124d3565b91505092915050565b5f61266a82612479565b9050919050565b61267a81612660565b8114612684575f80fd5b50565b5f8135905061269581612671565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126126bc576126bb61269b565b5b8235905067ffffffffffffffff8111156126d9576126d861269f565b5b6020830191508360018202830111156126f5576126f46126a3565b5b9250929050565b5f805f805f6080868803121561271557612714612452565b5b5f61272288828901612687565b9550506020612733888289016124a0565b9450506040612744888289016124d3565b935050606086013567ffffffffffffffff81111561276557612764612456565b5b612771888289016126a7565b92509250509295509295909350565b5f6020828403121561279557612794612452565b5b5f6127a2848285016124a0565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6127df816127ab565b82525050565b6127ee81612479565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b612826816124b4565b82525050565b5f612837838361281d565b60208301905092915050565b5f602082019050919050565b5f612859826127f4565b61286381856127fe565b935061286e8361280e565b805f5b8381101561289e578151612885888261282c565b975061289083612843565b925050600181019050612871565b5085935050505092915050565b5f60e0820190506128be5f83018a6127d6565b81810360208301526128d081896123fa565b905081810360408301526128e481886123fa565b90506128f36060830187612558565b61290060808301866127e5565b61290d60a083018561260d565b81810360c083015261291f818461284f565b905098975050505050505050565b5f6020820190506129405f8301846127e5565b92915050565b61294f816125d0565b8114612959575f80fd5b50565b5f8135905061296a81612946565b92915050565b61297981612604565b8114612983575f80fd5b50565b5f8135905061299481612970565b92915050565b5f805f805f805f60e0888a0312156129b5576129b4612452565b5b5f6129c28a828b016124a0565b97505060206129d38a828b016124a0565b96505060406129e48a828b016124d3565b95505060606129f58a828b016124d3565b9450506080612a068a828b0161295c565b93505060a0612a178a828b01612986565b92505060c0612a288a828b01612986565b91505092959891949750929550565b5f8060408385031215612a4d57612a4c612452565b5b5f612a5a858286016124a0565b9250506020612a6b858286016124a0565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680612ab957607f821691505b602082108103612acc57612acb612a75565b5b50919050565b5f82825260208201905092915050565b828183375f83830152505050565b5f612afb8385612ad2565b9350612b08838584612ae2565b612b11836123ea565b840190509392505050565b5f60a082019050612b2f5f8301896127e5565b612b3c60208301886127e5565b612b496040830187612558565b612b566060830186612558565b8181036080830152612b69818486612af0565b9050979650505050505050565b5f81519050612b8481612970565b92915050565b5f60208284031215612b9f57612b9e612452565b5b5f612bac84828501612b76565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f612bec826124b4565b9150612bf7836124b4565b9250828201905080821115612c0f57612c0e612bb5565b5b92915050565b5f612c1f826124b4565b9150612c2a836124b4565b9250828203905081811115612c4257612c41612bb5565b5b92915050565b7f4549503731323a20556e696e697469616c697a656400000000000000000000005f82015250565b5f612c7c6015836123b2565b9150612c8782612c48565b602082019050919050565b5f6020820190508181035f830152612ca981612c70565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115612d3257808604811115612d0e57612d0d612bb5565b5b6001851615612d1d5780820291505b8081029050612d2b85612cdd565b9450612cf2565b94509492505050565b5f82612d4a5760019050612e05565b81612d57575f9050612e05565b8160018114612d6d5760028114612d7757612da6565b6001915050612e05565b60ff841115612d8957612d88612bb5565b5b8360020a915084821115612da057612d9f612bb5565b5b50612e05565b5060208310610133831016604e8410600b8410161715612ddb5782820a905083811115612dd657612dd5612bb5565b5b612e05565b612de88484846001612ce9565b92509050818404811115612dff57612dfe612bb5565b5b81810290505b9392505050565b5f612e16826124b4565b9150612e21836125d0565b9250612e4e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612d3b565b905092915050565b5f612e60826124b4565b9150612e6b836124b4565b9250828202612e79816124b4565b91508282048414831517612e9057612e8f612bb5565b5b5092915050565b5f819050919050565b5f67ffffffffffffffff82169050919050565b5f819050919050565b5f612ed6612ed1612ecc84612e97565b612eb3565b612ea0565b9050919050565b612ee681612ebc565b82525050565b5f602082019050612eff5f830184612edd565b92915050565b5f60c082019050612f185f83018961260d565b612f2560208301886127e5565b612f3260408301876127e5565b612f3f6060830186612558565b612f4c6080830185612558565b612f5960a0830184612558565b979650505050505050565b5f604082019050612f775f8301856127e5565b612f8460208301846127e5565b9392505050565b5f606082019050612f9e5f8301866127e5565b612fab6020830185612558565b612fb86040830184612558565b949350505050565b5f60a082019050612fd35f83018861260d565b612fe0602083018761260d565b612fed604083018661260d565b612ffa6060830185612558565b61300760808301846127e5565b9695505050505050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261306d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613032565b6130778683613032565b95508019841693508086168417925050509392505050565b5f6130a96130a461309f846124b4565b612eb3565b6124b4565b9050919050565b5f819050919050565b6130c28361308f565b6130d66130ce826130b0565b84845461303e565b825550505050565b5f90565b6130ea6130de565b6130f58184846130b9565b505050565b5b818110156131185761310d5f826130e2565b6001810190506130fb565b5050565b601f82111561315d5761312e81613011565b61313784613023565b81016020851015613146578190505b61315a61315285613023565b8301826130fa565b50505b505050565b5f82821c905092915050565b5f61317d5f1984600802613162565b1980831691505092915050565b5f613195838361316e565b9150826002028217905092915050565b6131ae826123a8565b67ffffffffffffffff8111156131c7576131c6612cb0565b5b6131d18254612aa2565b6131dc82828561311c565b5f60209050601f83116001811461320d575f84156131fb578287015190505b613205858261318a565b86555061326c565b601f19841661321b86613011565b5f5b828110156132425784890151825560018201915060208501945060208101905061321d565b8683101561325f578489015161325b601f89168261316e565b8355505b6001600288020188555050505b505050505050565b5f6080820190506132875f83018761260d565b61329460208301866125dc565b6132a1604083018561260d565b6132ae606083018461260d565b95945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffdfea2646970667358221220bbaa4c35f21ebb410fbfc049a4f64f8cca741aaf05906caf61eb870755a24be764736f6c63430008140033
608060405234801561000f575f80fd5b506004361061018c575f3560e01c8063715018a6116100dc57806395d89b4111610095578063d505accf1161006f578063d505accf14610464578063d9d98ce414610480578063dd62ed3e146104b0578063f2fde38b146104e05761018c565b806395d89b41146103fa578063a9059cbb14610418578063c4d66de8146104485761018c565b8063715018a61461035857806379cc6790146103625780637ecebe001461037e5780638456cb59146103ae57806384b0196e146103b85780638da5cb5b146103dc5761018c565b80633f4ba83a116101495780635c975abb116101235780635c975abb146102aa5780635cffe9de146102c8578063613255ab146102f857806370a08231146103285761018c565b80633f4ba83a1461026857806340c10f191461027257806342966c681461028e5761018c565b806306fdde0314610190578063095ea7b3146101ae57806318160ddd146101de57806323b872dd146101fc578063313ce5671461022c5780633644e5151461024a575b5f80fd5b6101986104fc565b6040516101a59190612432565b60405180910390f35b6101c860048036038101906101c391906124e7565b61059a565b6040516101d5919061253f565b60405180910390f35b6101e66105bc565b6040516101f39190612567565b60405180910390f35b61021660048036038101906102119190612580565b6105d3565b604051610223919061253f565b60405180910390f35b610234610601565b60405161024191906125eb565b60405180910390f35b610252610609565b60405161025f919061261c565b60405180910390f35b610270610617565b005b61028c600480360381019061028791906124e7565b610629565b005b6102a860048036038101906102a39190612635565b61063f565b005b6102b2610653565b6040516102bf919061253f565b60405180910390f35b6102e260048036038101906102dd91906126fc565b610675565b6040516102ef919061253f565b60405180910390f35b610312600480360381019061030d9190612780565b61086a565b60405161031f9190612567565b60405180910390f35b610342600480360381019061033d9190612780565b6108df565b60405161034f9190612567565b60405180910390f35b610360610932565b005b61037c600480360381019061037791906124e7565b610945565b005b61039860048036038101906103939190612780565b610965565b6040516103a59190612567565b60405180910390f35b6103b6610976565b005b6103c0610988565b6040516103d397969594939291906128ab565b60405180910390f35b6103e4610a91565b6040516103f1919061292d565b60405180910390f35b610402610ac6565b60405161040f9190612432565b60405180910390f35b610432600480360381019061042d91906124e7565b610b64565b60405161043f919061253f565b60405180910390f35b610462600480360381019061045d9190612780565b610b86565b005b61047e6004803603810190610479919061299a565b610dfe565b005b61049a600480360381019061049591906124e7565b610f43565b6040516104a79190612567565b60405180910390f35b6104ca60048036038101906104c59190612a37565b610fc6565b6040516104d79190612567565b60405180910390f35b6104fa60048036038101906104f59190612780565b611056565b005b60605f6105076110da565b905080600301805461051890612aa2565b80601f016020809104026020016040519081016040528092919081815260200182805461054490612aa2565b801561058f5780601f106105665761010080835404028352916020019161058f565b820191905f5260205f20905b81548152906001019060200180831161057257829003601f168201915b505050505091505090565b5f806105a4611101565b90506105b1818585611108565b600191505092915050565b5f806105c66110da565b9050806002015491505090565b5f806105dd611101565b90506105ea85828561111a565b6105f58585856111ac565b60019150509392505050565b5f6012905090565b5f61061261129c565b905090565b61061f6112aa565b610627611331565b565b6106316112aa565b61063b828261139f565b5050565b61065061064a611101565b8261141e565b50565b5f8061065d61149d565b9050805f015f9054906101000a900460ff1691505090565b5f806106808661086a565b9050808511156106c757806040517ffd9a76090000000000000000000000000000000000000000000000000000000081526004016106be9190612567565b60405180910390fd5b5f6106d28787610f43565b90506106de888761139f565b7f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98873ffffffffffffffffffffffffffffffffffffffff166323e30c8b610723611101565b8a8a868b8b6040518763ffffffff1660e01b815260040161074996959493929190612b1c565b6020604051808303815f875af1158015610765573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107899190612b8a565b146107cb57876040517f678c5b000000000000000000000000000000000000000000000000000000000081526004016107c2919061292d565b60405180910390fd5b5f6107d46114c4565b90506107ec8930848a6107e79190612be2565b61111a565b5f82148061082557505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156108445761083f89838961083a9190612be2565b61141e565b61085a565b61084e898861141e565b6108598982846111ac565b5b6001935050505095945050505050565b5f3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146108a4575f6108d8565b6108ac6105bc565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6108d79190612c15565b5b9050919050565b5f806108e96110da565b9050805f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054915050919050565b61093a6112aa565b6109435f6114c8565b565b61095782610951611101565b8361111a565b610961828261141e565b5050565b5f61096f82611599565b9050919050565b61097e6112aa565b6109866115ec565b565b5f6060805f805f60605f61099a61165b565b90505f801b815f01541480156109b557505f801b8160010154145b6109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109eb90612c92565b60405180910390fd5b6109fc611682565b610a04611720565b46305f801b5f67ffffffffffffffff811115610a2357610a22612cb0565b5b604051908082528060200260200182016040528015610a515781602001602082028036833780820191505090505b507f0f0000000000000000000000000000000000000000000000000000000000000095949392919097509750975097509750975097505090919293949596565b5f80610a9b6117be565b9050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691505090565b60605f610ad16110da565b9050806004018054610ae290612aa2565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0e90612aa2565b8015610b595780601f10610b3057610100808354040283529160200191610b59565b820191905f5260205f20905b815481529060010190602001808311610b3c57829003601f168201915b505050505091505090565b5f80610b6e611101565b9050610b7b8185856111ac565b600191505092915050565b5f610b8f6117e5565b90505f815f0160089054906101000a900460ff161590505f825f015f9054906101000a900467ffffffffffffffff1690505f808267ffffffffffffffff16148015610bd75750825b90505f60018367ffffffffffffffff16148015610c0a57505f3073ffffffffffffffffffffffffffffffffffffffff163b145b905081158015610c18575080155b15610c4f576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001855f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055508315610c9c576001855f0160086101000a81548160ff0219169083151502179055505b610d106040518060400160405280600681526020017f57495a41524400000000000000000000000000000000000000000000000000008152506040518060400160405280600481526020017f5a4152440000000000000000000000000000000000000000000000000000000081525061180c565b610d18611822565b610d2061182c565b610d298661183e565b610d676040518060400160405280600681526020017f57495a4152440000000000000000000000000000000000000000000000000000815250611852565b610d6f61189c565b610d9c33610d7b610601565b600a610d879190612e0c565b64174876e800610d979190612e56565b61139f565b8315610df6575f855f0160086101000a81548160ff0219169083151502179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d26001604051610ded9190612eec565b60405180910390a15b505050505050565b83421115610e4357836040517f62791302000000000000000000000000000000000000000000000000000000008152600401610e3a9190612567565b60405180910390fd5b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610e718c6118a6565b89604051602001610e8796959493929190612f05565b6040516020818303038152906040528051906020012090505f610ea982611906565b90505f610eb88287878761191f565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610f2c57808a6040517f4b800e46000000000000000000000000000000000000000000000000000000008152600401610f23929190612f64565b60405180910390fd5b610f378a8a8a611108565b50505050505050505050565b5f3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610fb457826040517fb5a7db92000000000000000000000000000000000000000000000000000000008152600401610fab919061292d565b60405180910390fd5b610fbe838361194d565b905092915050565b5f80610fd06110da565b9050806001015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205491505092915050565b61105e6112aa565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110ce575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016110c5919061292d565b60405180910390fd5b6110d7816114c8565b50565b5f7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00905090565b5f33905090565b6111158383836001611954565b505050565b5f6111258484610fc6565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146111a65781811015611197578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161118e93929190612f8b565b60405180910390fd5b6111a584848484035f611954565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361121c575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401611213919061292d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361128c575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401611283919061292d565b60405180910390fd5b611297838383611b31565b505050565b5f6112a5611b41565b905090565b6112b2611101565b73ffffffffffffffffffffffffffffffffffffffff166112d0610a91565b73ffffffffffffffffffffffffffffffffffffffff161461132f576112f3611101565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611326919061292d565b60405180910390fd5b565b611339611ba4565b5f61134261149d565b90505f815f015f6101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611387611101565b604051611394919061292d565b60405180910390a150565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361140f575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401611406919061292d565b60405180910390fd5b61141a5f8383611b31565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361148e575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401611485919061292d565b60405180910390fd5b611499825f83611b31565b5050565b5f7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300905090565b5f90565b5f6114d16117be565b90505f815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082825f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3505050565b5f806115a3611be4565b9050805f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054915050919050565b6115f4611c0b565b5f6115fd61149d565b90506001815f015f6101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611643611101565b604051611650919061292d565b60405180910390a150565b5f7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100905090565b60605f61168d61165b565b905080600201805461169e90612aa2565b80601f01602080910402602001604051908101604052809291908181526020018280546116ca90612aa2565b80156117155780601f106116ec57610100808354040283529160200191611715565b820191905f5260205f20905b8154815290600101906020018083116116f857829003601f168201915b505050505091505090565b60605f61172b61165b565b905080600301805461173c90612aa2565b80601f016020809104026020016040519081016040528092919081815260200182805461176890612aa2565b80156117b35780601f1061178a576101008083540402835291602001916117b3565b820191905f5260205f20905b81548152906001019060200180831161179657829003601f168201915b505050505091505090565b5f7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300905090565b5f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b611814611c4c565b61181e8282611c8c565b5050565b61182a611c4c565b565b611834611c4c565b61183c611cc8565b565b611846611c4c565b61184f81611cf8565b50565b61185a611c4c565b611899816040518060400160405280600181526020017f3100000000000000000000000000000000000000000000000000000000000000815250611d7c565b50565b6118a4611c4c565b565b5f806118b0611be4565b9050805f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f81548092919060010191905055915050919050565b5f61191861191261129c565b83611dcd565b9050919050565b5f805f8061192f88888888611e0d565b92509250925061193f8282611ef4565b829350505050949350505050565b5f92915050565b5f61195d6110da565b90505f73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036119cf575f6040517fe602df050000000000000000000000000000000000000000000000000000000081526004016119c6919061292d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611a3f575f6040517f94280d62000000000000000000000000000000000000000000000000000000008152600401611a36919061292d565b60405180910390fd5b82816001015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508115611b2a578373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051611b219190612567565b60405180910390a35b5050505050565b611b3c838383612056565b505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611b6b61206e565b611b736120e4565b4630604051602001611b89959493929190612fc0565b60405160208183030381529060405280519060200120905090565b611bac610653565b611be2576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b5f7f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb00905090565b611c13610653565b15611c4a576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611c5461215b565b611c8a576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611c94611c4c565b5f611c9d6110da565b905082816003019081611cb091906131a5565b5081816004019081611cc291906131a5565b50505050565b611cd0611c4c565b5f611cd961149d565b90505f815f015f6101000a81548160ff02191690831515021790555050565b611d00611c4c565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611d70575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401611d67919061292d565b60405180910390fd5b611d79816114c8565b50565b611d84611c4c565b5f611d8d61165b565b905082816002019081611da091906131a5565b5081816003019081611db291906131a5565b505f801b815f01819055505f801b8160010181905550505050565b5f6040517f190100000000000000000000000000000000000000000000000000000000000081528360028201528260228201526042812091505092915050565b5f805f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c1115611e49575f600385925092509250611eea565b5f6001888888886040515f8152602001604052604051611e6c9493929190613274565b6020604051602081039080840390855afa158015611e8c573d5f803e3d5ffd5b5050506020604051035190505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611edd575f60015f801b93509350935050611eea565b805f805f1b935093509350505b9450945094915050565b5f6003811115611f0757611f066132b7565b5b826003811115611f1a57611f196132b7565b5b03156120525760016003811115611f3457611f336132b7565b5b826003811115611f4757611f466132b7565b5b03611f7e576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60026003811115611f9257611f916132b7565b5b826003811115611fa557611fa46132b7565b5b03611fe957805f1c6040517ffce698f7000000000000000000000000000000000000000000000000000000008152600401611fe09190612567565b60405180910390fd5b600380811115611ffc57611ffb6132b7565b5b82600381111561200f5761200e6132b7565b5b0361205157806040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600401612048919061261c565b60405180910390fd5b5b5050565b61205e611c0b565b612069838383612179565b505050565b5f8061207861165b565b90505f612083611682565b90505f8151111561209f578080519060200120925050506120e1565b5f825f015490505f801b81146120ba578093505050506120e1565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47093505050505b90565b5f806120ee61165b565b90505f6120f9611720565b90505f8151111561211557808051906020012092505050612158565b5f826001015490505f801b811461213157809350505050612158565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47093505050505b90565b5f6121646117e5565b5f0160089054906101000a900460ff16905090565b5f6121826110da565b90505f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036121d65781816002015f8282546121ca9190612be2565b925050819055506122a8565b5f815f015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905082811015612261578481846040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161225893929190612f8b565b60405180910390fd5b828103825f015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036122f15781816002015f828254039250508190555061233d565b81815f015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161239a9190612567565b60405180910390a350505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156123df5780820151818401526020810190506123c4565b5f8484015250505050565b5f601f19601f8301169050919050565b5f612404826123a8565b61240e81856123b2565b935061241e8185602086016123c2565b612427816123ea565b840191505092915050565b5f6020820190508181035f83015261244a81846123fa565b905092915050565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6124838261245a565b9050919050565b61249381612479565b811461249d575f80fd5b50565b5f813590506124ae8161248a565b92915050565b5f819050919050565b6124c6816124b4565b81146124d0575f80fd5b50565b5f813590506124e1816124bd565b92915050565b5f80604083850312156124fd576124fc612452565b5b5f61250a858286016124a0565b925050602061251b858286016124d3565b9150509250929050565b5f8115159050919050565b61253981612525565b82525050565b5f6020820190506125525f830184612530565b92915050565b612561816124b4565b82525050565b5f60208201905061257a5f830184612558565b92915050565b5f805f6060848603121561259757612596612452565b5b5f6125a4868287016124a0565b93505060206125b5868287016124a0565b92505060406125c6868287016124d3565b9150509250925092565b5f60ff82169050919050565b6125e5816125d0565b82525050565b5f6020820190506125fe5f8301846125dc565b92915050565b5f819050919050565b61261681612604565b82525050565b5f60208201905061262f5f83018461260d565b92915050565b5f6020828403121561264a57612649612452565b5b5f612657848285016124d3565b91505092915050565b5f61266a82612479565b9050919050565b61267a81612660565b8114612684575f80fd5b50565b5f8135905061269581612671565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126126bc576126bb61269b565b5b8235905067ffffffffffffffff8111156126d9576126d861269f565b5b6020830191508360018202830111156126f5576126f46126a3565b5b9250929050565b5f805f805f6080868803121561271557612714612452565b5b5f61272288828901612687565b9550506020612733888289016124a0565b9450506040612744888289016124d3565b935050606086013567ffffffffffffffff81111561276557612764612456565b5b612771888289016126a7565b92509250509295509295909350565b5f6020828403121561279557612794612452565b5b5f6127a2848285016124a0565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6127df816127ab565b82525050565b6127ee81612479565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b612826816124b4565b82525050565b5f612837838361281d565b60208301905092915050565b5f602082019050919050565b5f612859826127f4565b61286381856127fe565b935061286e8361280e565b805f5b8381101561289e578151612885888261282c565b975061289083612843565b925050600181019050612871565b5085935050505092915050565b5f60e0820190506128be5f83018a6127d6565b81810360208301526128d081896123fa565b905081810360408301526128e481886123fa565b90506128f36060830187612558565b61290060808301866127e5565b61290d60a083018561260d565b81810360c083015261291f818461284f565b905098975050505050505050565b5f6020820190506129405f8301846127e5565b92915050565b61294f816125d0565b8114612959575f80fd5b50565b5f8135905061296a81612946565b92915050565b61297981612604565b8114612983575f80fd5b50565b5f8135905061299481612970565b92915050565b5f805f805f805f60e0888a0312156129b5576129b4612452565b5b5f6129c28a828b016124a0565b97505060206129d38a828b016124a0565b96505060406129e48a828b016124d3565b95505060606129f58a828b016124d3565b9450506080612a068a828b0161295c565b93505060a0612a178a828b01612986565b92505060c0612a288a828b01612986565b91505092959891949750929550565b5f8060408385031215612a4d57612a4c612452565b5b5f612a5a858286016124a0565b9250506020612a6b858286016124a0565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680612ab957607f821691505b602082108103612acc57612acb612a75565b5b50919050565b5f82825260208201905092915050565b828183375f83830152505050565b5f612afb8385612ad2565b9350612b08838584612ae2565b612b11836123ea565b840190509392505050565b5f60a082019050612b2f5f8301896127e5565b612b3c60208301886127e5565b612b496040830187612558565b612b566060830186612558565b8181036080830152612b69818486612af0565b9050979650505050505050565b5f81519050612b8481612970565b92915050565b5f60208284031215612b9f57612b9e612452565b5b5f612bac84828501612b76565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f612bec826124b4565b9150612bf7836124b4565b9250828201905080821115612c0f57612c0e612bb5565b5b92915050565b5f612c1f826124b4565b9150612c2a836124b4565b9250828203905081811115612c4257612c41612bb5565b5b92915050565b7f4549503731323a20556e696e697469616c697a656400000000000000000000005f82015250565b5f612c7c6015836123b2565b9150612c8782612c48565b602082019050919050565b5f6020820190508181035f830152612ca981612c70565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115612d3257808604811115612d0e57612d0d612bb5565b5b6001851615612d1d5780820291505b8081029050612d2b85612cdd565b9450612cf2565b94509492505050565b5f82612d4a5760019050612e05565b81612d57575f9050612e05565b8160018114612d6d5760028114612d7757612da6565b6001915050612e05565b60ff841115612d8957612d88612bb5565b5b8360020a915084821115612da057612d9f612bb5565b5b50612e05565b5060208310610133831016604e8410600b8410161715612ddb5782820a905083811115612dd657612dd5612bb5565b5b612e05565b612de88484846001612ce9565b92509050818404811115612dff57612dfe612bb5565b5b81810290505b9392505050565b5f612e16826124b4565b9150612e21836125d0565b9250612e4e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612d3b565b905092915050565b5f612e60826124b4565b9150612e6b836124b4565b9250828202612e79816124b4565b91508282048414831517612e9057612e8f612bb5565b5b5092915050565b5f819050919050565b5f67ffffffffffffffff82169050919050565b5f819050919050565b5f612ed6612ed1612ecc84612e97565b612eb3565b612ea0565b9050919050565b612ee681612ebc565b82525050565b5f602082019050612eff5f830184612edd565b92915050565b5f60c082019050612f185f83018961260d565b612f2560208301886127e5565b612f3260408301876127e5565b612f3f6060830186612558565b612f4c6080830185612558565b612f5960a0830184612558565b979650505050505050565b5f604082019050612f775f8301856127e5565b612f8460208301846127e5565b9392505050565b5f606082019050612f9e5f8301866127e5565b612fab6020830185612558565b612fb86040830184612558565b949350505050565b5f60a082019050612fd35f83018861260d565b612fe0602083018761260d565b612fed604083018661260d565b612ffa6060830185612558565b61300760808301846127e5565b9695505050505050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261306d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613032565b6130778683613032565b95508019841693508086168417925050509392505050565b5f6130a96130a461309f846124b4565b612eb3565b6124b4565b9050919050565b5f819050919050565b6130c28361308f565b6130d66130ce826130b0565b84845461303e565b825550505050565b5f90565b6130ea6130de565b6130f58184846130b9565b505050565b5b818110156131185761310d5f826130e2565b6001810190506130fb565b5050565b601f82111561315d5761312e81613011565b61313784613023565b81016020851015613146578190505b61315a61315285613023565b8301826130fa565b50505b505050565b5f82821c905092915050565b5f61317d5f1984600802613162565b1980831691505092915050565b5f613195838361316e565b9150826002028217905092915050565b6131ae826123a8565b67ffffffffffffffff8111156131c7576131c6612cb0565b5b6131d18254612aa2565b6131dc82828561311c565b5f60209050601f83116001811461320d575f84156131fb578287015190505b613205858261318a565b86555061326c565b601f19841661321b86613011565b5f5b828110156132425784890151825560018201915060208501945060208101905061321d565b8683101561325f578489015161325b601f89168261316e565b8355505b6001600288020188555050505b505050505050565b5f6080820190506132875f83018761260d565b61329460208301866125dc565b6132a1604083018561260d565b6132ae606083018461260d565b95945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffdfea2646970667358221220bbaa4c35f21ebb410fbfc049a4f64f8cca741aaf05906caf61eb870755a24be764736f6c63430008140033
1
20,290,304
66309f730fba02f8e471c31c697cf47327b49fa8b5c5b7f08d76ba630034f14b
66fb3140f24ce84261beab918d522ca81a3d295fc12b7d43204c72edc2aa6dba
ea4fad0ddf28ed27a38daefd4823a95065b280bf
ea4fad0ddf28ed27a38daefd4823a95065b280bf
73d92dcbef5afed03db337cd271bbe4f613b9833
6080604052662386f26fc100006002556040518060400160405280601781526020017f33386461456664343832334139353036356232383062660000000000000000008152506006908162000055919062000598565b506040518060400160405280601381526020017f3078656134666164304464463238456432374100000000000000000000000000815250600790816200009c919062000598565b50348015620000a9575f80fd5b5060405162002299380380620022998339818101604052810190620000cf9190620006e1565b6200010560076006604051602001620000ea929190620007e6565b604051602081830303815290604052620002ae60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156200014357506301359a3243105b156200016457600160035f6101000a81548160ff0219169083151502179055505b835f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600360016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060045f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503360055f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505062000938565b5f808290505f805f5b60148160ff161015620003285761010083620002d491906200083a565b9250838160ff1681518110620002ef57620002ee62000884565b5b602001015160f81c60f81b60f81c60ff1691508183620003109190620008b1565b925080806200031f906200090b565b915050620002b7565b50819350505050919050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620003b057607f821691505b602082108103620003c657620003c56200036b565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026200042a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620003ed565b620004368683620003ed565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620004806200047a62000474846200044e565b62000457565b6200044e565b9050919050565b5f819050919050565b6200049b8362000460565b620004b3620004aa8262000487565b848454620003f9565b825550505050565b5f90565b620004c9620004bb565b620004d681848462000490565b505050565b5b81811015620004fd57620004f15f82620004bf565b600181019050620004dc565b5050565b601f8211156200054c576200051681620003cc565b6200052184620003de565b8101602085101562000531578190505b620005496200054085620003de565b830182620004db565b50505b505050565b5f82821c905092915050565b5f6200056e5f198460080262000551565b1980831691505092915050565b5f6200058883836200055d565b9150826002028217905092915050565b620005a38262000334565b67ffffffffffffffff811115620005bf57620005be6200033e565b5b620005cb825462000398565b620005d882828562000501565b5f60209050601f8311600181146200060e575f8415620005f9578287015190505b6200060585826200057b565b86555062000674565b601f1984166200061e86620003cc565b5f5b82811015620006475784890151825560018201915060208501945060208101905062000620565b8683101562000667578489015162000663601f8916826200055d565b8355505b6001600288020188555050505b505050505050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f620006ab8262000680565b9050919050565b620006bd816200069f565b8114620006c8575f80fd5b50565b5f81519050620006db81620006b2565b92915050565b5f805f8060808587031215620006fc57620006fb6200067c565b5b5f6200070b87828801620006cb565b94505060206200071e87828801620006cb565b93505060406200073187828801620006cb565b92505060606200074487828801620006cb565b91505092959194509250565b5f81905092915050565b5f8154620007688162000398565b62000774818662000750565b9450600182165f8114620007915760018114620007a757620007dd565b60ff1983168652811515820286019350620007dd565b620007b285620003cc565b5f5b83811015620007d557815481890152600182019150602081019050620007b4565b838801955050505b50505092915050565b5f620007f382856200075a565b91506200080182846200075a565b91508190509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f620008468262000680565b9150620008538362000680565b9250828202620008638162000680565b915082820484148315176200087d576200087c6200080d565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f620008bd8262000680565b9150620008ca8362000680565b9250828201905073ffffffffffffffffffffffffffffffffffffffff811115620008f957620008f86200080d565b5b92915050565b5f60ff82169050919050565b5f6200091782620008ff565b915060ff82036200092d576200092c6200080d565b5b600182019050919050565b61195380620009465f395ff3fe60806040526004361061007e575f3560e01c8063e23b119b1161004d578063e23b119b1461012b578063e581186e14610147578063eafb1b1614610183578063fb3bdb41146101bf57610085565b8063888245ee14610089578063a6823189146100b1578063d579d4ed146100ed578063e0603e6a1461010357610085565b3661008557005b5f80fd5b348015610094575f80fd5b506100af60048036038101906100aa9190610eff565b6101db565b005b3480156100bc575f80fd5b506100d760048036038101906100d29190611066565b610276565b6040516100e491906110bc565b60405180910390f35b3480156100f8575f80fd5b506101016102f1565b005b34801561010e575f80fd5b5061012960048036038101906101249190611108565b6103b0565b005b61014560048036038101906101409190611190565b610412565b005b348015610152575f80fd5b5061016d6004803603810190610168919061126e565b610834565b60405161017a9190611382565b60405180910390f35b34801561018e575f80fd5b506101a960048036038101906101a491906113a2565b61096a565b6040516101b69190611382565b60405180910390f35b6101d960048036038101906101d49190611442565b610a3f565b005b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610233575f80fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f808290505f805f5b60148160ff1610156102e557610100836102999190611533565b9250838160ff16815181106102b1576102b0611574565b5b602001015160f81c60f81b60f81c60ff16915081836102d091906115a1565b925080806102dd906115f4565b91505061027f565b50819350505050919050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610349575f80fd5b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc4790811502906040515f60405180830381858888f193505050501580156103ad573d5f803e3d5ffd5b50565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610408575f80fd5b8060028190555050565b5f8060025490505f5b858590508110156107335760045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d07f2189895f81811061047657610475611574565b5b905060200201602081019061048b9190610eff565b8a8a600181811061049f5761049e611574565b5b90506020020160208101906104b49190610eff565b6127108d5f6040518663ffffffff1660e01b81526004016104d99594939291906116b4565b6020604051808303815f875af11580156104f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105199190611719565b9250478285856105299190611744565b6105339190611744565b1115610574576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056b906117d1565b60405180910390fd5b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663db3e2198846040518061010001604052808c8c5f8181106105d2576105d1611574565b5b90506020020160208101906105e79190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020018c8c600181811061061657610615611574565b5b905060200201602081019061062b9190610eff565b73ffffffffffffffffffffffffffffffffffffffff16815260200161271062ffffff1681526020018a8a8781811061066657610665611574565b5b905060200201602081019061067b9190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020014281526020018d81526020018781526020015f73ffffffffffffffffffffffffffffffffffffffff168152506040518363ffffffff1660e01b81526004016106de91906118bc565b60206040518083038185885af11580156106fa573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061071f9190611719565b50808061072b906118d6565b91505061041b565b505f8311156107a25760015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8490811502906040515f60405180830381858888f193505050501580156107a0573d5f803e3d5ffd5b505b4173ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f193505050501580156107e5573d5f803e3d5ffd5b503373ffffffffffffffffffffffffffffffffffffffff166108fc4790811502906040515f60405180830381858888f19350505050158015610829573d5f803e3d5ffd5b505050505050505050565b60608383905067ffffffffffffffff81111561085357610852610f42565b5b6040519080825280602002602001820160405280156108815781602001602082028036833780820191505090505b5090505f5b84849050811015610962578273ffffffffffffffffffffffffffffffffffffffff166370a082318686848181106108c0576108bf611574565b5b90506020020160208101906108d59190610eff565b6040518263ffffffff1660e01b81526004016108f191906110bc565b602060405180830381865afa15801561090c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109309190611719565b82828151811061094357610942611574565b5b602002602001018181525050808061095a906118d6565b915050610886565b509392505050565b60608282905067ffffffffffffffff81111561098957610988610f42565b5b6040519080825280602002602001820160405280156109b75781602001602082028036833780820191505090505b5090505f5b83839050811015610a38578383828181106109da576109d9611574565b5b90506020020160208101906109ef9190610eff565b73ffffffffffffffffffffffffffffffffffffffff1631828281518110610a1957610a18611574565b5b6020026020010181815250508080610a30906118d6565b9150506109bc565b5092915050565b5f8060025490505f5b85859050811015610d925760045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d07f2189895f818110610aa357610aa2611574565b5b9050602002016020810190610ab89190610eff565b8a8a6001818110610acc57610acb611574565b5b9050602002016020810190610ae19190610eff565b6127108e8e87818110610af757610af6611574565b5b905060200201355f6040518663ffffffff1660e01b8152600401610b1f9594939291906116b4565b6020604051808303815f875af1158015610b3b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b5f9190611719565b925047828585610b6f9190611744565b610b799190611744565b1115610bba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb1906117d1565b60405180910390fd5b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663db3e2198846040518061010001604052808c8c5f818110610c1857610c17611574565b5b9050602002016020810190610c2d9190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020018c8c6001818110610c5c57610c5b611574565b5b9050602002016020810190610c719190610eff565b73ffffffffffffffffffffffffffffffffffffffff16815260200161271062ffffff1681526020018a8a87818110610cac57610cab611574565b5b9050602002016020810190610cc19190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020014281526020018e8e87818110610cf557610cf4611574565b5b9050602002013581526020018781526020015f73ffffffffffffffffffffffffffffffffffffffff168152506040518363ffffffff1660e01b8152600401610d3d91906118bc565b60206040518083038185885af1158015610d59573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610d7e9190611719565b508080610d8a906118d6565b915050610a48565b505f831115610e015760015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8490811502906040515f60405180830381858888f19350505050158015610dff573d5f803e3d5ffd5b505b4173ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015610e44573d5f803e3d5ffd5b503373ffffffffffffffffffffffffffffffffffffffff166108fc4790811502906040515f60405180830381858888f19350505050158015610e88573d5f803e3d5ffd5b50505050505050505050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610ece82610ea5565b9050919050565b610ede81610ec4565b8114610ee8575f80fd5b50565b5f81359050610ef981610ed5565b92915050565b5f60208284031215610f1457610f13610e9d565b5b5f610f2184828501610eeb565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610f7882610f32565b810181811067ffffffffffffffff82111715610f9757610f96610f42565b5b80604052505050565b5f610fa9610e94565b9050610fb58282610f6f565b919050565b5f67ffffffffffffffff821115610fd457610fd3610f42565b5b610fdd82610f32565b9050602081019050919050565b828183375f83830152505050565b5f61100a61100584610fba565b610fa0565b90508281526020810184848401111561102657611025610f2e565b5b611031848285610fea565b509392505050565b5f82601f83011261104d5761104c610f2a565b5b813561105d848260208601610ff8565b91505092915050565b5f6020828403121561107b5761107a610e9d565b5b5f82013567ffffffffffffffff81111561109857611097610ea1565b5b6110a484828501611039565b91505092915050565b6110b681610ec4565b82525050565b5f6020820190506110cf5f8301846110ad565b92915050565b5f819050919050565b6110e7816110d5565b81146110f1575f80fd5b50565b5f81359050611102816110de565b92915050565b5f6020828403121561111d5761111c610e9d565b5b5f61112a848285016110f4565b91505092915050565b5f80fd5b5f80fd5b5f8083601f8401126111505761114f610f2a565b5b8235905067ffffffffffffffff81111561116d5761116c611133565b5b60208301915083602082028301111561118957611188611137565b5b9250929050565b5f805f805f80608087890312156111aa576111a9610e9d565b5b5f6111b789828a016110f4565b965050602087013567ffffffffffffffff8111156111d8576111d7610ea1565b5b6111e489828a0161113b565b9550955050604087013567ffffffffffffffff81111561120757611206610ea1565b5b61121389828a0161113b565b9350935050606061122689828a016110f4565b9150509295509295509295565b5f61123d82610ec4565b9050919050565b61124d81611233565b8114611257575f80fd5b50565b5f8135905061126881611244565b92915050565b5f805f6040848603121561128557611284610e9d565b5b5f84013567ffffffffffffffff8111156112a2576112a1610ea1565b5b6112ae8682870161113b565b935093505060206112c18682870161125a565b9150509250925092565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6112fd816110d5565b82525050565b5f61130e83836112f4565b60208301905092915050565b5f602082019050919050565b5f611330826112cb565b61133a81856112d5565b9350611345836112e5565b805f5b8381101561137557815161135c8882611303565b97506113678361131a565b925050600181019050611348565b5085935050505092915050565b5f6020820190508181035f83015261139a8184611326565b905092915050565b5f80602083850312156113b8576113b7610e9d565b5b5f83013567ffffffffffffffff8111156113d5576113d4610ea1565b5b6113e18582860161113b565b92509250509250929050565b5f8083601f84011261140257611401610f2a565b5b8235905067ffffffffffffffff81111561141f5761141e611133565b5b60208301915083602082028301111561143b5761143a611137565b5b9250929050565b5f805f805f805f6080888a03121561145d5761145c610e9d565b5b5f88013567ffffffffffffffff81111561147a57611479610ea1565b5b6114868a828b016113ed565b9750975050602088013567ffffffffffffffff8111156114a9576114a8610ea1565b5b6114b58a828b0161113b565b9550955050604088013567ffffffffffffffff8111156114d8576114d7610ea1565b5b6114e48a828b0161113b565b935093505060606114f78a828b016110f4565b91505092959891949750929550565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61153d82610ea5565b915061154883610ea5565b925082820261155681610ea5565b9150828204841483151761156d5761156c611506565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f6115ab82610ea5565b91506115b683610ea5565b9250828201905073ffffffffffffffffffffffffffffffffffffffff8111156115e2576115e1611506565b5b92915050565b5f60ff82169050919050565b5f6115fe826115e8565b915060ff820361161157611610611506565b5b600182019050919050565b5f819050919050565b5f62ffffff82169050919050565b5f819050919050565b5f61165661165161164c8461161c565b611633565b611625565b9050919050565b6116668161163c565b82525050565b611675816110d5565b82525050565b5f819050919050565b5f61169e6116996116948461167b565b611633565b610ea5565b9050919050565b6116ae81611684565b82525050565b5f60a0820190506116c75f8301886110ad565b6116d460208301876110ad565b6116e1604083018661165d565b6116ee606083018561166c565b6116fb60808301846116a5565b9695505050505050565b5f81519050611713816110de565b92915050565b5f6020828403121561172e5761172d610e9d565b5b5f61173b84828501611705565b91505092915050565b5f61174e826110d5565b9150611759836110d5565b925082820190508082111561177157611770611506565b5b92915050565b5f82825260208201905092915050565b7f62616c616e6365000000000000000000000000000000000000000000000000005f82015250565b5f6117bb600783611777565b91506117c682611787565b602082019050919050565b5f6020820190508181035f8301526117e8816117af565b9050919050565b6117f881610ec4565b82525050565b61180781611625565b82525050565b61181681610ea5565b82525050565b61010082015f8201516118315f8501826117ef565b50602082015161184460208501826117ef565b50604082015161185760408501826117fe565b50606082015161186a60608501826117ef565b50608082015161187d60808501826112f4565b5060a082015161189060a08501826112f4565b5060c08201516118a360c08501826112f4565b5060e08201516118b660e085018261180d565b50505050565b5f610100820190506118d05f83018461181c565b92915050565b5f6118e0826110d5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361191257611911611506565b5b60018201905091905056fea26469706673582212206dfab0e0444a5432fea63d4ce60256d2b3cf00c688220e941e2cd0af57f732bd64736f6c634300081400330000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000ea4fad0ddf28ed27a38daefd4823a95065b280bf000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000b27308f9f90d607463bb33ea1bebb41c27ce5ab6
60806040526004361061007e575f3560e01c8063e23b119b1161004d578063e23b119b1461012b578063e581186e14610147578063eafb1b1614610183578063fb3bdb41146101bf57610085565b8063888245ee14610089578063a6823189146100b1578063d579d4ed146100ed578063e0603e6a1461010357610085565b3661008557005b5f80fd5b348015610094575f80fd5b506100af60048036038101906100aa9190610eff565b6101db565b005b3480156100bc575f80fd5b506100d760048036038101906100d29190611066565b610276565b6040516100e491906110bc565b60405180910390f35b3480156100f8575f80fd5b506101016102f1565b005b34801561010e575f80fd5b5061012960048036038101906101249190611108565b6103b0565b005b61014560048036038101906101409190611190565b610412565b005b348015610152575f80fd5b5061016d6004803603810190610168919061126e565b610834565b60405161017a9190611382565b60405180910390f35b34801561018e575f80fd5b506101a960048036038101906101a491906113a2565b61096a565b6040516101b69190611382565b60405180910390f35b6101d960048036038101906101d49190611442565b610a3f565b005b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610233575f80fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f808290505f805f5b60148160ff1610156102e557610100836102999190611533565b9250838160ff16815181106102b1576102b0611574565b5b602001015160f81c60f81b60f81c60ff16915081836102d091906115a1565b925080806102dd906115f4565b91505061027f565b50819350505050919050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610349575f80fd5b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc4790811502906040515f60405180830381858888f193505050501580156103ad573d5f803e3d5ffd5b50565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610408575f80fd5b8060028190555050565b5f8060025490505f5b858590508110156107335760045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d07f2189895f81811061047657610475611574565b5b905060200201602081019061048b9190610eff565b8a8a600181811061049f5761049e611574565b5b90506020020160208101906104b49190610eff565b6127108d5f6040518663ffffffff1660e01b81526004016104d99594939291906116b4565b6020604051808303815f875af11580156104f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105199190611719565b9250478285856105299190611744565b6105339190611744565b1115610574576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056b906117d1565b60405180910390fd5b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663db3e2198846040518061010001604052808c8c5f8181106105d2576105d1611574565b5b90506020020160208101906105e79190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020018c8c600181811061061657610615611574565b5b905060200201602081019061062b9190610eff565b73ffffffffffffffffffffffffffffffffffffffff16815260200161271062ffffff1681526020018a8a8781811061066657610665611574565b5b905060200201602081019061067b9190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020014281526020018d81526020018781526020015f73ffffffffffffffffffffffffffffffffffffffff168152506040518363ffffffff1660e01b81526004016106de91906118bc565b60206040518083038185885af11580156106fa573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061071f9190611719565b50808061072b906118d6565b91505061041b565b505f8311156107a25760015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8490811502906040515f60405180830381858888f193505050501580156107a0573d5f803e3d5ffd5b505b4173ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f193505050501580156107e5573d5f803e3d5ffd5b503373ffffffffffffffffffffffffffffffffffffffff166108fc4790811502906040515f60405180830381858888f19350505050158015610829573d5f803e3d5ffd5b505050505050505050565b60608383905067ffffffffffffffff81111561085357610852610f42565b5b6040519080825280602002602001820160405280156108815781602001602082028036833780820191505090505b5090505f5b84849050811015610962578273ffffffffffffffffffffffffffffffffffffffff166370a082318686848181106108c0576108bf611574565b5b90506020020160208101906108d59190610eff565b6040518263ffffffff1660e01b81526004016108f191906110bc565b602060405180830381865afa15801561090c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109309190611719565b82828151811061094357610942611574565b5b602002602001018181525050808061095a906118d6565b915050610886565b509392505050565b60608282905067ffffffffffffffff81111561098957610988610f42565b5b6040519080825280602002602001820160405280156109b75781602001602082028036833780820191505090505b5090505f5b83839050811015610a38578383828181106109da576109d9611574565b5b90506020020160208101906109ef9190610eff565b73ffffffffffffffffffffffffffffffffffffffff1631828281518110610a1957610a18611574565b5b6020026020010181815250508080610a30906118d6565b9150506109bc565b5092915050565b5f8060025490505f5b85859050811015610d925760045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d07f2189895f818110610aa357610aa2611574565b5b9050602002016020810190610ab89190610eff565b8a8a6001818110610acc57610acb611574565b5b9050602002016020810190610ae19190610eff565b6127108e8e87818110610af757610af6611574565b5b905060200201355f6040518663ffffffff1660e01b8152600401610b1f9594939291906116b4565b6020604051808303815f875af1158015610b3b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b5f9190611719565b925047828585610b6f9190611744565b610b799190611744565b1115610bba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb1906117d1565b60405180910390fd5b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663db3e2198846040518061010001604052808c8c5f818110610c1857610c17611574565b5b9050602002016020810190610c2d9190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020018c8c6001818110610c5c57610c5b611574565b5b9050602002016020810190610c719190610eff565b73ffffffffffffffffffffffffffffffffffffffff16815260200161271062ffffff1681526020018a8a87818110610cac57610cab611574565b5b9050602002016020810190610cc19190610eff565b73ffffffffffffffffffffffffffffffffffffffff1681526020014281526020018e8e87818110610cf557610cf4611574565b5b9050602002013581526020018781526020015f73ffffffffffffffffffffffffffffffffffffffff168152506040518363ffffffff1660e01b8152600401610d3d91906118bc565b60206040518083038185885af1158015610d59573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610d7e9190611719565b508080610d8a906118d6565b915050610a48565b505f831115610e015760015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8490811502906040515f60405180830381858888f19350505050158015610dff573d5f803e3d5ffd5b505b4173ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015610e44573d5f803e3d5ffd5b503373ffffffffffffffffffffffffffffffffffffffff166108fc4790811502906040515f60405180830381858888f19350505050158015610e88573d5f803e3d5ffd5b50505050505050505050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610ece82610ea5565b9050919050565b610ede81610ec4565b8114610ee8575f80fd5b50565b5f81359050610ef981610ed5565b92915050565b5f60208284031215610f1457610f13610e9d565b5b5f610f2184828501610eeb565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610f7882610f32565b810181811067ffffffffffffffff82111715610f9757610f96610f42565b5b80604052505050565b5f610fa9610e94565b9050610fb58282610f6f565b919050565b5f67ffffffffffffffff821115610fd457610fd3610f42565b5b610fdd82610f32565b9050602081019050919050565b828183375f83830152505050565b5f61100a61100584610fba565b610fa0565b90508281526020810184848401111561102657611025610f2e565b5b611031848285610fea565b509392505050565b5f82601f83011261104d5761104c610f2a565b5b813561105d848260208601610ff8565b91505092915050565b5f6020828403121561107b5761107a610e9d565b5b5f82013567ffffffffffffffff81111561109857611097610ea1565b5b6110a484828501611039565b91505092915050565b6110b681610ec4565b82525050565b5f6020820190506110cf5f8301846110ad565b92915050565b5f819050919050565b6110e7816110d5565b81146110f1575f80fd5b50565b5f81359050611102816110de565b92915050565b5f6020828403121561111d5761111c610e9d565b5b5f61112a848285016110f4565b91505092915050565b5f80fd5b5f80fd5b5f8083601f8401126111505761114f610f2a565b5b8235905067ffffffffffffffff81111561116d5761116c611133565b5b60208301915083602082028301111561118957611188611137565b5b9250929050565b5f805f805f80608087890312156111aa576111a9610e9d565b5b5f6111b789828a016110f4565b965050602087013567ffffffffffffffff8111156111d8576111d7610ea1565b5b6111e489828a0161113b565b9550955050604087013567ffffffffffffffff81111561120757611206610ea1565b5b61121389828a0161113b565b9350935050606061122689828a016110f4565b9150509295509295509295565b5f61123d82610ec4565b9050919050565b61124d81611233565b8114611257575f80fd5b50565b5f8135905061126881611244565b92915050565b5f805f6040848603121561128557611284610e9d565b5b5f84013567ffffffffffffffff8111156112a2576112a1610ea1565b5b6112ae8682870161113b565b935093505060206112c18682870161125a565b9150509250925092565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6112fd816110d5565b82525050565b5f61130e83836112f4565b60208301905092915050565b5f602082019050919050565b5f611330826112cb565b61133a81856112d5565b9350611345836112e5565b805f5b8381101561137557815161135c8882611303565b97506113678361131a565b925050600181019050611348565b5085935050505092915050565b5f6020820190508181035f83015261139a8184611326565b905092915050565b5f80602083850312156113b8576113b7610e9d565b5b5f83013567ffffffffffffffff8111156113d5576113d4610ea1565b5b6113e18582860161113b565b92509250509250929050565b5f8083601f84011261140257611401610f2a565b5b8235905067ffffffffffffffff81111561141f5761141e611133565b5b60208301915083602082028301111561143b5761143a611137565b5b9250929050565b5f805f805f805f6080888a03121561145d5761145c610e9d565b5b5f88013567ffffffffffffffff81111561147a57611479610ea1565b5b6114868a828b016113ed565b9750975050602088013567ffffffffffffffff8111156114a9576114a8610ea1565b5b6114b58a828b0161113b565b9550955050604088013567ffffffffffffffff8111156114d8576114d7610ea1565b5b6114e48a828b0161113b565b935093505060606114f78a828b016110f4565b91505092959891949750929550565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61153d82610ea5565b915061154883610ea5565b925082820261155681610ea5565b9150828204841483151761156d5761156c611506565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f6115ab82610ea5565b91506115b683610ea5565b9250828201905073ffffffffffffffffffffffffffffffffffffffff8111156115e2576115e1611506565b5b92915050565b5f60ff82169050919050565b5f6115fe826115e8565b915060ff820361161157611610611506565b5b600182019050919050565b5f819050919050565b5f62ffffff82169050919050565b5f819050919050565b5f61165661165161164c8461161c565b611633565b611625565b9050919050565b6116668161163c565b82525050565b611675816110d5565b82525050565b5f819050919050565b5f61169e6116996116948461167b565b611633565b610ea5565b9050919050565b6116ae81611684565b82525050565b5f60a0820190506116c75f8301886110ad565b6116d460208301876110ad565b6116e1604083018661165d565b6116ee606083018561166c565b6116fb60808301846116a5565b9695505050505050565b5f81519050611713816110de565b92915050565b5f6020828403121561172e5761172d610e9d565b5b5f61173b84828501611705565b91505092915050565b5f61174e826110d5565b9150611759836110d5565b925082820190508082111561177157611770611506565b5b92915050565b5f82825260208201905092915050565b7f62616c616e6365000000000000000000000000000000000000000000000000005f82015250565b5f6117bb600783611777565b91506117c682611787565b602082019050919050565b5f6020820190508181035f8301526117e8816117af565b9050919050565b6117f881610ec4565b82525050565b61180781611625565b82525050565b61181681610ea5565b82525050565b61010082015f8201516118315f8501826117ef565b50602082015161184460208501826117ef565b50604082015161185760408501826117fe565b50606082015161186a60608501826117ef565b50608082015161187d60808501826112f4565b5060a082015161189060a08501826112f4565b5060c08201516118a360c08501826112f4565b5060e08201516118b660e085018261180d565b50505050565b5f610100820190506118d05f83018461181c565b92915050565b5f6118e0826110d5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361191257611911611506565b5b60018201905091905056fea26469706673582212206dfab0e0444a5432fea63d4ce60256d2b3cf00c688220e941e2cd0af57f732bd64736f6c63430008140033
1
20,290,306
eaa5daba18adbd0ecfa680342d6590f154b1fe09d36eb4049dcadc0cb060ba65
a47e9c1c7175b86762e08094e5d3877108f1bf3b600df077c40dbc1f9a8904cc
4e565f63257d90f988e5ec9d065bab00f94d2dfd
9fa5c5733b53814692de4fb31fd592070de5f5f0
ce92762648d933bc5e5961f8640b6080487b6e83
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,306
eaa5daba18adbd0ecfa680342d6590f154b1fe09d36eb4049dcadc0cb060ba65
b9446638981f2fc075b295f1e3e3c93ff7834b3211bbc9b424ddc9673bdf145d
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
dbc73e2f96edfffaa95d9d9efd26783121861548
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,307
764023fae3f555cba5fadce6fcb2afe48b8a2615321f68b9434b7a9a27d5221e
fb2877bb8f6ca062ea1d20207b0af64bb0c6dd7948d2f154df7eb213a079a470
58890a9cb27586e83cb51d2d26bbe18a1a647245
58890a9cb27586e83cb51d2d26bbe18a1a647245
fee31c09fa5e9cdbc1f80c90b42b58640be91ddf
608060405234801561001057600080fd5b50610027336000805160206109df83398151915255565b6000805160206109df833981519152546040516001600160a01b03909116906000907fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a908290a36109628061007d6000396000f3fe6080604052600436106100865760003560e01c80635d36b190116100595780635d36b1901461010a578063c7af33521461011f578063cf7a1d7714610144578063d38bfff414610157578063f851a4401461009057610086565b80630c340a24146100905780633659cfe6146100c25780634f1ef286146100e25780635c60da1b146100f5575b61008e610177565b005b34801561009c57600080fd5b506100a5610197565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100ce57600080fd5b5061008e6100dd366004610794565b6101b4565b61008e6100f0366004610817565b6101ed565b34801561010157600080fd5b506100a561028a565b34801561011657600080fd5b5061008e6102a2565b34801561012b57600080fd5b50610134610346565b60405190151581526020016100b9565b61008e6101523660046107b6565b610377565b34801561016357600080fd5b5061008e610172366004610794565b6104e0565b6101956101906000805160206108ed8339815191525490565b610584565b565b60006101af60008051602061090d8339815191525490565b905090565b6101bc610346565b6101e15760405162461bcd60e51b81526004016101d89061087a565b60405180910390fd5b6101ea816105a8565b50565b6101f5610346565b6102115760405162461bcd60e51b81526004016101d89061087a565b61021a836105a8565b6000836001600160a01b0316838360405161023692919061086a565b600060405180830381855af49150503d8060008114610271576040519150601f19603f3d011682016040523d82523d6000602084013e610276565b606091505b505090508061028457600080fd5b50505050565b60006101af6000805160206108ed8339815191525490565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b03161461033d5760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b60648201526084016101d8565b610195336105e8565b600061035e60008051602061090d8339815191525490565b6001600160a01b0316336001600160a01b031614905090565b61037f610346565b61039b5760405162461bcd60e51b81526004016101d89061087a565b60006103b36000805160206108ed8339815191525490565b6001600160a01b0316146103c657600080fd5b6001600160a01b0384166104155760405162461bcd60e51b8152602060048201526016602482015275125b5c1b195b595b9d185d1a5bdb881b9bdd081cd95d60521b60448201526064016101d8565b61044060017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd6108b1565b6000805160206108ed8339815191521461045c5761045c6108d6565b610465846106a9565b80156104d7576000846001600160a01b0316838360405161048792919061086a565b600060405180830381855af49150503d80600081146104c2576040519150601f19603f3d011682016040523d82523d6000602084013e6104c7565b606091505b50509050806104d557600080fd5b505b610284836105e8565b6104e8610346565b6105045760405162461bcd60e51b81526004016101d89061087a565b61052c817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b031661054c60008051602061090d8339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b3660008037600080366000845af43d6000803e8080156105a3573d6000f35b3d6000fd5b6105b1816106a9565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b03811661063e5760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f72206973206164647265737328302900000000000060448201526064016101d8565b806001600160a01b031661065e60008051602061090d8339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a36101ea8160008051602061090d83398151915255565b803b61071d5760405162461bcd60e51b815260206004820152603b60248201527f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f60448201527f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000060648201526084016101d8565b6000805160206108ed83398151915255565b80356001600160a01b038116811461074657600080fd5b919050565b60008083601f84011261075d57600080fd5b50813567ffffffffffffffff81111561077557600080fd5b60208301915083602082850101111561078d57600080fd5b9250929050565b6000602082840312156107a657600080fd5b6107af8261072f565b9392505050565b600080600080606085870312156107cc57600080fd5b6107d58561072f565b93506107e36020860161072f565b9250604085013567ffffffffffffffff8111156107ff57600080fd5b61080b8782880161074b565b95989497509550505050565b60008060006040848603121561082c57600080fd5b6108358461072f565b9250602084013567ffffffffffffffff81111561085157600080fd5b61085d8682870161074b565b9497909650939450505050565b8183823760009101908152919050565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b6000828210156108d157634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa2646970667358221220640772569fcd8ef3d53e9255696bfeed0763f49c69c65ccd40242a7a013b070564736f6c634300080700337bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a
6080604052600436106100865760003560e01c80635d36b190116100595780635d36b1901461010a578063c7af33521461011f578063cf7a1d7714610144578063d38bfff414610157578063f851a4401461009057610086565b80630c340a24146100905780633659cfe6146100c25780634f1ef286146100e25780635c60da1b146100f5575b61008e610177565b005b34801561009c57600080fd5b506100a5610197565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100ce57600080fd5b5061008e6100dd366004610794565b6101b4565b61008e6100f0366004610817565b6101ed565b34801561010157600080fd5b506100a561028a565b34801561011657600080fd5b5061008e6102a2565b34801561012b57600080fd5b50610134610346565b60405190151581526020016100b9565b61008e6101523660046107b6565b610377565b34801561016357600080fd5b5061008e610172366004610794565b6104e0565b6101956101906000805160206108ed8339815191525490565b610584565b565b60006101af60008051602061090d8339815191525490565b905090565b6101bc610346565b6101e15760405162461bcd60e51b81526004016101d89061087a565b60405180910390fd5b6101ea816105a8565b50565b6101f5610346565b6102115760405162461bcd60e51b81526004016101d89061087a565b61021a836105a8565b6000836001600160a01b0316838360405161023692919061086a565b600060405180830381855af49150503d8060008114610271576040519150601f19603f3d011682016040523d82523d6000602084013e610276565b606091505b505090508061028457600080fd5b50505050565b60006101af6000805160206108ed8339815191525490565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b03161461033d5760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b60648201526084016101d8565b610195336105e8565b600061035e60008051602061090d8339815191525490565b6001600160a01b0316336001600160a01b031614905090565b61037f610346565b61039b5760405162461bcd60e51b81526004016101d89061087a565b60006103b36000805160206108ed8339815191525490565b6001600160a01b0316146103c657600080fd5b6001600160a01b0384166104155760405162461bcd60e51b8152602060048201526016602482015275125b5c1b195b595b9d185d1a5bdb881b9bdd081cd95d60521b60448201526064016101d8565b61044060017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd6108b1565b6000805160206108ed8339815191521461045c5761045c6108d6565b610465846106a9565b80156104d7576000846001600160a01b0316838360405161048792919061086a565b600060405180830381855af49150503d80600081146104c2576040519150601f19603f3d011682016040523d82523d6000602084013e6104c7565b606091505b50509050806104d557600080fd5b505b610284836105e8565b6104e8610346565b6105045760405162461bcd60e51b81526004016101d89061087a565b61052c817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b031661054c60008051602061090d8339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b3660008037600080366000845af43d6000803e8080156105a3573d6000f35b3d6000fd5b6105b1816106a9565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b03811661063e5760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f72206973206164647265737328302900000000000060448201526064016101d8565b806001600160a01b031661065e60008051602061090d8339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a36101ea8160008051602061090d83398151915255565b803b61071d5760405162461bcd60e51b815260206004820152603b60248201527f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f60448201527f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000060648201526084016101d8565b6000805160206108ed83398151915255565b80356001600160a01b038116811461074657600080fd5b919050565b60008083601f84011261075d57600080fd5b50813567ffffffffffffffff81111561077557600080fd5b60208301915083602082850101111561078d57600080fd5b9250929050565b6000602082840312156107a657600080fd5b6107af8261072f565b9392505050565b600080600080606085870312156107cc57600080fd5b6107d58561072f565b93506107e36020860161072f565b9250604085013567ffffffffffffffff8111156107ff57600080fd5b61080b8782880161074b565b95989497509550505050565b60008060006040848603121561082c57600080fd5b6108358461072f565b9250602084013567ffffffffffffffff81111561085157600080fd5b61085d8682870161074b565b9497909650939450505050565b8183823760009101908152919050565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b6000828210156108d157634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa2646970667358221220640772569fcd8ef3d53e9255696bfeed0763f49c69c65ccd40242a7a013b070564736f6c63430008070033
{{ "language": "Solidity", "settings": { "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }, "sources": { "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" }, "contracts/governance/Governable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Base for contracts that are managed by the Origin Protocol's Governor.\n * @dev Copy of the openzeppelin Ownable.sol contract with nomenclature change\n * from owner to governor and renounce methods removed. Does not use\n * Context.sol like Ownable.sol does for simplification.\n * @author Origin Protocol Inc\n */\ncontract Governable {\n // Storage position of the owner and pendingOwner of the contract\n // keccak256(\"OUSD.governor\");\n bytes32 private constant governorPosition =\n 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;\n\n // keccak256(\"OUSD.pending.governor\");\n bytes32 private constant pendingGovernorPosition =\n 0x44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db;\n\n // keccak256(\"OUSD.reentry.status\");\n bytes32 private constant reentryStatusPosition =\n 0x53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac4535;\n\n // See OpenZeppelin ReentrancyGuard implementation\n uint256 constant _NOT_ENTERED = 1;\n uint256 constant _ENTERED = 2;\n\n event PendingGovernorshipTransfer(\n address indexed previousGovernor,\n address indexed newGovernor\n );\n\n event GovernorshipTransferred(\n address indexed previousGovernor,\n address indexed newGovernor\n );\n\n /**\n * @dev Initializes the contract setting the deployer as the initial Governor.\n */\n constructor() {\n _setGovernor(msg.sender);\n emit GovernorshipTransferred(address(0), _governor());\n }\n\n /**\n * @notice Returns the address of the current Governor.\n */\n function governor() public view returns (address) {\n return _governor();\n }\n\n /**\n * @dev Returns the address of the current Governor.\n */\n function _governor() internal view returns (address governorOut) {\n bytes32 position = governorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n governorOut := sload(position)\n }\n }\n\n /**\n * @dev Returns the address of the pending Governor.\n */\n function _pendingGovernor()\n internal\n view\n returns (address pendingGovernor)\n {\n bytes32 position = pendingGovernorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n pendingGovernor := sload(position)\n }\n }\n\n /**\n * @dev Throws if called by any account other than the Governor.\n */\n modifier onlyGovernor() {\n require(isGovernor(), \"Caller is not the Governor\");\n _;\n }\n\n /**\n * @notice Returns true if the caller is the current Governor.\n */\n function isGovernor() public view returns (bool) {\n return msg.sender == _governor();\n }\n\n function _setGovernor(address newGovernor) internal {\n bytes32 position = governorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newGovernor)\n }\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n bytes32 position = reentryStatusPosition;\n uint256 _reentry_status;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n _reentry_status := sload(position)\n }\n\n // On the first call to nonReentrant, _notEntered will be true\n require(_reentry_status != _ENTERED, \"Reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, _ENTERED)\n }\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, _NOT_ENTERED)\n }\n }\n\n function _setPendingGovernor(address newGovernor) internal {\n bytes32 position = pendingGovernorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newGovernor)\n }\n }\n\n /**\n * @notice Transfers Governance of the contract to a new account (`newGovernor`).\n * Can only be called by the current Governor. Must be claimed for this to complete\n * @param _newGovernor Address of the new Governor\n */\n function transferGovernance(address _newGovernor) external onlyGovernor {\n _setPendingGovernor(_newGovernor);\n emit PendingGovernorshipTransfer(_governor(), _newGovernor);\n }\n\n /**\n * @notice Claim Governance of the contract to a new account (`newGovernor`).\n * Can only be called by the new Governor.\n */\n function claimGovernance() external {\n require(\n msg.sender == _pendingGovernor(),\n \"Only the pending Governor can complete the claim\"\n );\n _changeGovernor(msg.sender);\n }\n\n /**\n * @dev Change Governance of the contract to a new account (`newGovernor`).\n * @param _newGovernor Address of the new Governor\n */\n function _changeGovernor(address _newGovernor) internal {\n require(_newGovernor != address(0), \"New Governor is address(0)\");\n emit GovernorshipTransferred(_governor(), _newGovernor);\n _setGovernor(_newGovernor);\n }\n}\n" }, "contracts/proxies/InitializeGovernedUpgradeabilityProxy.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport { Governable } from \"../governance/Governable.sol\";\n\n/**\n * @title BaseGovernedUpgradeabilityProxy\n * @dev This contract combines an upgradeability proxy with our governor system.\n * It is based on an older version of OpenZeppelins BaseUpgradeabilityProxy\n * with Solidity ^0.8.0.\n * @author Origin Protocol Inc\n */\ncontract InitializeGovernedUpgradeabilityProxy is Governable {\n /**\n * @dev Emitted when the implementation is upgraded.\n * @param implementation Address of the new implementation.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Contract initializer with Governor enforcement\n * @param _logic Address of the initial implementation.\n * @param _initGovernor Address of the initial Governor.\n * @param _data Data to send as msg.data to the implementation to initialize\n * the proxied contract.\n * It should include the signature and the parameters of the function to be\n * called, as described in\n * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.\n * This parameter is optional, if no data is given the initialization call\n * to proxied contract will be skipped.\n */\n function initialize(\n address _logic,\n address _initGovernor,\n bytes calldata _data\n ) public payable onlyGovernor {\n require(_implementation() == address(0));\n require(_logic != address(0), \"Implementation not set\");\n assert(\n IMPLEMENTATION_SLOT ==\n bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1)\n );\n _setImplementation(_logic);\n if (_data.length > 0) {\n (bool success, ) = _logic.delegatecall(_data);\n require(success);\n }\n _changeGovernor(_initGovernor);\n }\n\n /**\n * @return The address of the proxy admin/it's also the governor.\n */\n function admin() external view returns (address) {\n return _governor();\n }\n\n /**\n * @return The address of the implementation.\n */\n function implementation() external view returns (address) {\n return _implementation();\n }\n\n /**\n * @dev Upgrade the backing implementation of the proxy.\n * Only the admin can call this function.\n * @param _newImplementation Address of the new implementation.\n */\n function upgradeTo(address _newImplementation) external onlyGovernor {\n _upgradeTo(_newImplementation);\n }\n\n /**\n * @dev Upgrade the backing implementation of the proxy and call a function\n * on the new implementation.\n * This is useful to initialize the proxied contract.\n * @param newImplementation Address of the new implementation.\n * @param data Data to send as msg.data in the low level call.\n * It should include the signature and the parameters of the function to be called, as described in\n * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data)\n external\n payable\n onlyGovernor\n {\n _upgradeTo(newImplementation);\n (bool success, ) = newImplementation.delegatecall(data);\n require(success);\n }\n\n /**\n * @dev Fallback function.\n * Implemented entirely in `_fallback`.\n */\n fallback() external payable {\n _fallback();\n }\n\n /**\n * @dev Delegates execution to an implementation contract.\n * This is a low level function that doesn't return to its internal call site.\n * It will return to the external caller whatever the implementation returns.\n * @param _impl Address to delegate.\n */\n function _delegate(address _impl) internal {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), _impl, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev Function that is run as the first thing in the fallback function.\n * Can be redefined in derived contracts to add functionality.\n * Redefinitions must call super._willFallback().\n */\n function _willFallback() internal {}\n\n /**\n * @dev fallback implementation.\n * Extracted to enable manual triggering.\n */\n function _fallback() internal {\n _willFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant IMPLEMENTATION_SLOT =\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation.\n * @return impl Address of the current implementation\n */\n function _implementation() internal view returns (address impl) {\n bytes32 slot = IMPLEMENTATION_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n impl := sload(slot)\n }\n }\n\n /**\n * @dev Upgrades the proxy to a new implementation.\n * @param newImplementation Address of the new implementation.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation address of the proxy.\n * @param newImplementation Address of the new implementation.\n */\n function _setImplementation(address newImplementation) internal {\n require(\n Address.isContract(newImplementation),\n \"Cannot set a proxy implementation to a non-contract address\"\n );\n\n bytes32 slot = IMPLEMENTATION_SLOT;\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, newImplementation)\n }\n }\n}\n" }, "contracts/proxies/Proxies.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { InitializeGovernedUpgradeabilityProxy } from \"./InitializeGovernedUpgradeabilityProxy.sol\";\n\n/**\n * @notice OUSDProxy delegates calls to an OUSD implementation\n */\ncontract OUSDProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice WrappedOUSDProxy delegates calls to a WrappedOUSD implementation\n */\ncontract WrappedOUSDProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice VaultProxy delegates calls to a Vault implementation\n */\ncontract VaultProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice CompoundStrategyProxy delegates calls to a CompoundStrategy implementation\n */\ncontract CompoundStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice AaveStrategyProxy delegates calls to a AaveStrategy implementation\n */\ncontract AaveStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice ThreePoolStrategyProxy delegates calls to a ThreePoolStrategy implementation\n */\ncontract ThreePoolStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice ConvexStrategyProxy delegates calls to a ConvexStrategy implementation\n */\ncontract ConvexStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice HarvesterProxy delegates calls to a Harvester implementation\n */\ncontract HarvesterProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice DripperProxy delegates calls to a Dripper implementation\n */\ncontract DripperProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice MorphoCompoundStrategyProxy delegates calls to a MorphoCompoundStrategy implementation\n */\ncontract MorphoCompoundStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice ConvexOUSDMetaStrategyProxy delegates calls to a ConvexOUSDMetaStrategy implementation\n */\ncontract ConvexOUSDMetaStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice ConvexLUSDMetaStrategyProxy delegates calls to a ConvexalGeneralizedMetaStrategy implementation\n */\ncontract ConvexLUSDMetaStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice MorphoAaveStrategyProxy delegates calls to a MorphoCompoundStrategy implementation\n */\ncontract MorphoAaveStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice OETHProxy delegates calls to nowhere for now\n */\ncontract OETHProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice WOETHProxy delegates calls to nowhere for now\n */\ncontract WOETHProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice OETHVaultProxy delegates calls to a Vault implementation\n */\ncontract OETHVaultProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice OETHDripperProxy delegates calls to a OETHDripper implementation\n */\ncontract OETHDripperProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice OETHHarvesterProxy delegates calls to a Harvester implementation\n */\ncontract OETHHarvesterProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice FraxETHStrategyProxy delegates calls to a FraxETHStrategy implementation\n */\ncontract FraxETHStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice CurveEthStrategyProxy delegates calls to a CurveEthStrategy implementation\n */\ncontract ConvexEthMetaStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice BuybackProxy delegates calls to Buyback implementation\n */\ncontract BuybackProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice OETHMorphoAaveStrategyProxy delegates calls to a MorphoAaveStrategy implementation\n */\ncontract OETHMorphoAaveStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice OETHBalancerMetaPoolrEthStrategyProxy delegates calls to a BalancerMetaPoolStrategy implementation\n */\ncontract OETHBalancerMetaPoolrEthStrategyProxy is\n InitializeGovernedUpgradeabilityProxy\n{\n\n}\n\n/**\n * @notice OETHBalancerMetaPoolwstEthStrategyProxy delegates calls to a BalancerMetaPoolStrategy implementation\n */\ncontract OETHBalancerMetaPoolwstEthStrategyProxy is\n InitializeGovernedUpgradeabilityProxy\n{\n\n}\n\n/**\n * @notice FluxStrategyProxy delegates calls to a CompoundStrategy implementation\n */\ncontract FluxStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice MakerDsrStrategyProxy delegates calls to a Generalized4626Strategy implementation\n */\ncontract MakerDsrStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice FrxEthRedeemStrategyProxy delegates calls to a FrxEthRedeemStrategy implementation\n */\ncontract FrxEthRedeemStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice OETHBuybackProxy delegates calls to Buyback implementation\n */\ncontract OETHBuybackProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice BridgedWOETHProxy delegates calls to BridgedWOETH implementation\n */\ncontract BridgedWOETHProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n\n/**\n * @notice NativeStakingSSVStrategyProxy delegates calls to NativeStakingSSVStrategy implementation\n */\ncontract NativeStakingSSVStrategyProxy is\n InitializeGovernedUpgradeabilityProxy\n{\n\n}\n\n/**\n * @notice NativeStakingFeeAccumulatorProxy delegates calls to FeeAccumulator implementation\n */\ncontract NativeStakingFeeAccumulatorProxy is\n InitializeGovernedUpgradeabilityProxy\n{\n\n}\n\n/**\n * @notice NativeStakingSSVStrategy2Proxy delegates calls to NativeStakingSSVStrategy implementation\n */\ncontract NativeStakingSSVStrategy2Proxy is\n InitializeGovernedUpgradeabilityProxy\n{\n\n}\n\n/**\n * @notice NativeStakingFeeAccumulator2Proxy delegates calls to FeeAccumulator implementation\n */\ncontract NativeStakingFeeAccumulator2Proxy is\n InitializeGovernedUpgradeabilityProxy\n{\n\n}\n\n/**\n * @notice LidoWithdrawalStrategyProxy delegates calls to a LidoWithdrawalStrategy implementation\n */\ncontract LidoWithdrawalStrategyProxy is InitializeGovernedUpgradeabilityProxy {\n\n}\n" } } }}
1
20,290,310
853d6ae682e2cbc967a02499a69343d50f78cb03e528cb409102e37d48a53c89
85e7ebdfa6ff387bccc375bd76b8d6a3eeb0b10cd1a8b07c0e19525a05f22548
a3187302d6c188942fcad82262bdb639c05d8564
a3187302d6c188942fcad82262bdb639c05d8564
cd234e6b60ab42a5bdb03876f1d870c49ba773ad
608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061071d806100616000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806341976e091461005157806376e11286146100815780638da5cb5b1461009d5780639dcb511a146100bb575b600080fd5b61006b600480360381019061006691906103e0565b6100eb565b60405161007891906105df565b60405180910390f35b61009b60048036038101906100969190610409565b610222565b005b6100a5610333565b6040516100b29190610569565b60405180910390f35b6100d560048036038101906100d091906103e0565b610359565b6040516100e29190610584565b60405180910390f35b6000806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561019757600080fd5b505afa1580156101ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cf9190610445565b50505091505060008113610218576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f906105bf565b60405180910390fd5b8092505050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102a99061059f565b60405180910390fd5b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008135905061039b8161068b565b92915050565b6000815190506103b0816106a2565b92915050565b6000815190506103c5816106b9565b92915050565b6000815190506103da816106d0565b92915050565b6000602082840312156103f257600080fd5b60006104008482850161038c565b91505092915050565b6000806040838503121561041c57600080fd5b600061042a8582860161038c565b925050602061043b8582860161038c565b9150509250929050565b600080600080600060a0868803121561045d57600080fd5b600061046b888289016103cb565b955050602061047c888289016103a1565b945050604061048d888289016103b6565b935050606061049e888289016103b6565b92505060806104af888289016103cb565b9150509295509295909350565b6104c58161060b565b82525050565b6104d481610667565b82525050565b60006104e7600d836105fa565b91507f4e6f7420746865206f776e6572000000000000000000000000000000000000006000830152602082019050919050565b6000610527600d836105fa565b91507f496e76616c6964207072696365000000000000000000000000000000000000006000830152602082019050919050565b61056381610647565b82525050565b600060208201905061057e60008301846104bc565b92915050565b600060208201905061059960008301846104cb565b92915050565b600060208201905081810360008301526105b8816104da565b9050919050565b600060208201905081810360008301526105d88161051a565b9050919050565b60006020820190506105f4600083018461055a565b92915050565b600082825260208201905092915050565b600061061682610627565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600069ffffffffffffffffffff82169050919050565b600061067282610679565b9050919050565b600061068482610627565b9050919050565b6106948161060b565b811461069f57600080fd5b50565b6106ab8161061d565b81146106b657600080fd5b50565b6106c281610647565b81146106cd57600080fd5b50565b6106d981610651565b81146106e457600080fd5b5056fea2646970667358221220c7419f071a76f57d500df55ba071d40500999fd51c12e121509bfa3f5492072064736f6c63430008000033
608060405234801561001057600080fd5b506004361061004c5760003560e01c806341976e091461005157806376e11286146100815780638da5cb5b1461009d5780639dcb511a146100bb575b600080fd5b61006b600480360381019061006691906103e0565b6100eb565b60405161007891906105df565b60405180910390f35b61009b60048036038101906100969190610409565b610222565b005b6100a5610333565b6040516100b29190610569565b60405180910390f35b6100d560048036038101906100d091906103e0565b610359565b6040516100e29190610584565b60405180910390f35b6000806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561019757600080fd5b505afa1580156101ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cf9190610445565b50505091505060008113610218576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020f906105bf565b60405180910390fd5b8092505050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102a99061059f565b60405180910390fd5b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008135905061039b8161068b565b92915050565b6000815190506103b0816106a2565b92915050565b6000815190506103c5816106b9565b92915050565b6000815190506103da816106d0565b92915050565b6000602082840312156103f257600080fd5b60006104008482850161038c565b91505092915050565b6000806040838503121561041c57600080fd5b600061042a8582860161038c565b925050602061043b8582860161038c565b9150509250929050565b600080600080600060a0868803121561045d57600080fd5b600061046b888289016103cb565b955050602061047c888289016103a1565b945050604061048d888289016103b6565b935050606061049e888289016103b6565b92505060806104af888289016103cb565b9150509295509295909350565b6104c58161060b565b82525050565b6104d481610667565b82525050565b60006104e7600d836105fa565b91507f4e6f7420746865206f776e6572000000000000000000000000000000000000006000830152602082019050919050565b6000610527600d836105fa565b91507f496e76616c6964207072696365000000000000000000000000000000000000006000830152602082019050919050565b61056381610647565b82525050565b600060208201905061057e60008301846104bc565b92915050565b600060208201905061059960008301846104cb565b92915050565b600060208201905081810360008301526105b8816104da565b9050919050565b600060208201905081810360008301526105d88161051a565b9050919050565b60006020820190506105f4600083018461055a565b92915050565b600082825260208201905092915050565b600061061682610627565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600069ffffffffffffffffffff82169050919050565b600061067282610679565b9050919050565b600061068482610627565b9050919050565b6106948161060b565b811461069f57600080fd5b50565b6106ab8161061d565b81146106b657600080fd5b50565b6106c281610647565b81146106cd57600080fd5b50565b6106d981610651565b81146106e457600080fd5b5056fea2646970667358221220c7419f071a76f57d500df55ba071d40500999fd51c12e121509bfa3f5492072064736f6c63430008000033
1
20,290,310
853d6ae682e2cbc967a02499a69343d50f78cb03e528cb409102e37d48a53c89
55d38698b4f3daee4aa4bb781bd76b79749e5e7700fa6d1e67ac491e1ea04352
58890a9cb27586e83cb51d2d26bbe18a1a647245
58890a9cb27586e83cb51d2d26bbe18a1a647245
2698e01ea6a39f3a59e7cf93260608043bfe0a46
60a060405234801561001057600080fd5b506040516103be3803806103be83398101604081905261002f91610044565b60601b6001600160601b031916608052610074565b60006020828403121561005657600080fd5b81516001600160a01b038116811461006d57600080fd5b9392505050565b60805160601c6103196100a560003960008181604b0152818160ba01528181610139015261016001526103196000f3fe60806040526004361061002d5760003560e01c8063185025ef14610039578063e52253811461008a57600080fd5b3661003457005b600080fd5b34801561004557600080fd5b5061006d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561009657600080fd5b5061009f6100ad565b604051908152602001610081565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461012c5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c6572206973206e6f742074686520537472617465677900000000000060448201526064015b60405180910390fd5b504780156101c25761015e7f0000000000000000000000000000000000000000000000000000000000000000826101c5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167fc2acb502a0dc166a61cd83b914b480d76050e91a6797d7a833be84c4eace1dfe826040516101b991815260200190565b60405180910390a25b90565b804710156102155760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610123565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610262576040519150601f19603f3d011682016040523d82523d6000602084013e610267565b606091505b50509050806102de5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610123565b50505056fea2646970667358221220820ecc375f00208f6789d08bcdc870d64534e6b8f2b067fce4d4d92181f857e264736f6c634300080700330000000000000000000000004685db8bf2df743c861d71e6cfb5347222992076
60806040526004361061002d5760003560e01c8063185025ef14610039578063e52253811461008a57600080fd5b3661003457005b600080fd5b34801561004557600080fd5b5061006d7f0000000000000000000000004685db8bf2df743c861d71e6cfb534722299207681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561009657600080fd5b5061009f6100ad565b604051908152602001610081565b6000336001600160a01b037f0000000000000000000000004685db8bf2df743c861d71e6cfb5347222992076161461012c5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c6572206973206e6f742074686520537472617465677900000000000060448201526064015b60405180910390fd5b504780156101c25761015e7f0000000000000000000000004685db8bf2df743c861d71e6cfb5347222992076826101c5565b7f0000000000000000000000004685db8bf2df743c861d71e6cfb53472229920766001600160a01b03167fc2acb502a0dc166a61cd83b914b480d76050e91a6797d7a833be84c4eace1dfe826040516101b991815260200190565b60405180910390a25b90565b804710156102155760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610123565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610262576040519150601f19603f3d011682016040523d82523d6000602084013e610267565b606091505b50509050806102de5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610123565b50505056fea2646970667358221220820ecc375f00208f6789d08bcdc870d64534e6b8f2b067fce4d4d92181f857e264736f6c63430008070033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" }, "contracts/strategies/NativeStaking/FeeAccumulator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @title Fee Accumulator for Native Staking SSV Strategy\n * @notice Receives execution rewards which includes tx fees and\n * MEV rewards like tx priority and tx ordering.\n * It does NOT include swept ETH from beacon chain consensus rewards or full validator withdrawals.\n * @author Origin Protocol Inc\n */\ncontract FeeAccumulator {\n /// @notice The address of the Native Staking Strategy\n address public immutable STRATEGY;\n\n event ExecutionRewardsCollected(address indexed strategy, uint256 amount);\n\n /**\n * @param _strategy Address of the Native Staking Strategy\n */\n constructor(address _strategy) {\n STRATEGY = _strategy;\n }\n\n /**\n * @notice sends all ETH in this FeeAccumulator contract to the Native Staking Strategy.\n * @return eth The amount of execution rewards that were sent to the Native Staking Strategy\n */\n function collect() external returns (uint256 eth) {\n require(msg.sender == STRATEGY, \"Caller is not the Strategy\");\n\n eth = address(this).balance;\n if (eth > 0) {\n // Send the ETH to the Native Staking Strategy\n Address.sendValue(payable(STRATEGY), eth);\n\n emit ExecutionRewardsCollected(STRATEGY, eth);\n }\n }\n\n /**\n * @dev Accept ETH\n */\n receive() external payable {}\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
20,290,315
fbd68ffc92509ad367f9b5ba37f1e9475f94fa24a6e63db8de4f6a0e17cfffb2
e3bbbfd275939b4acb87dc62059932019e6ad80f6312f4d3db8df630b9a18227
6fc20eb96fa56e1a15ce2652cb14c473be8f563a
6fc20eb96fa56e1a15ce2652cb14c473be8f563a
1e83b77a1d515d13065a509afc82d71d433045e3
60806040526040518060400160405280600581526020017f5349474d410000000000000000000000000000000000000000000000000000008152505f90816100479190610387565b506040518060400160405280600581526020017f5349474d410000000000000000000000000000000000000000000000000000008152506001908161008c9190610387565b506b033b2e3c9fd0803cac653600600255601260035f6101000a81548160ff021916908360ff1602179055503480156100c3575f80fd5b503360065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060025460045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550610456565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806101c857607f821691505b6020821081036101db576101da610184565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261023d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610202565b6102478683610202565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61028b6102866102818461025f565b610268565b61025f565b9050919050565b5f819050919050565b6102a483610271565b6102b86102b082610292565b84845461020e565b825550505050565b5f90565b6102cc6102c0565b6102d781848461029b565b505050565b5b818110156102fa576102ef5f826102c4565b6001810190506102dd565b5050565b601f82111561033f57610310816101e1565b610319846101f3565b81016020851015610328578190505b61033c610334856101f3565b8301826102dc565b50505b505050565b5f82821c905092915050565b5f61035f5f1984600802610344565b1980831691505092915050565b5f6103778383610350565b9150826002028217905092915050565b6103908261014d565b67ffffffffffffffff8111156103a9576103a8610157565b5b6103b382546101b1565b6103be8282856102fe565b5f60209050601f8311600181146103ef575f84156103dd578287015190505b6103e7858261036c565b86555061044e565b601f1984166103fd866101e1565b5f5b82811015610424578489015182556001820191506020850194506020810190506103ff565b86831015610441578489015161043d601f891682610350565b8355505b6001600288020188555050505b505050505050565b61135f806104635f395ff3fe608060405234801561000f575f80fd5b50600436106100b2575f3560e01c8063715018a61161006f578063715018a6146101a05780638da5cb5b146101aa57806395d89b41146101c8578063a9059cbb146101e6578063dd62ed3e14610216578063f2fde38b14610246576100b2565b806306fdde03146100b6578063095ea7b3146100d457806318160ddd1461010457806323b872dd14610122578063313ce5671461015257806370a0823114610170575b5f80fd5b6100be610262565b6040516100cb9190610d6a565b60405180910390f35b6100ee60048036038101906100e99190610e1b565b6102ed565b6040516100fb9190610e73565b60405180910390f35b61010c6103da565b6040516101199190610e9b565b60405180910390f35b61013c60048036038101906101379190610eb4565b6103e0565b6040516101499190610e73565b60405180910390f35b61015a6106f7565b6040516101679190610f1f565b60405180910390f35b61018a60048036038101906101859190610f38565b610709565b6040516101979190610e9b565b60405180910390f35b6101a861071e565b005b6101b261086a565b6040516101bf9190610f72565b60405180910390f35b6101d061088f565b6040516101dd9190610d6a565b60405180910390f35b61020060048036038101906101fb9190610e1b565b61091b565b60405161020d9190610e73565b60405180910390f35b610230600480360381019061022b9190610f8b565b610b1f565b60405161023d9190610e9b565b60405180910390f35b610260600480360381019061025b9190610f38565b610b3f565b005b5f805461026e90610ff6565b80601f016020809104026020016040519081016040528092919081815260200182805461029a90610ff6565b80156102e55780601f106102bc576101008083540402835291602001916102e5565b820191905f5260205f20905b8154815290600101906020018083116102c857829003601f168201915b505050505081565b5f8160055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516103c89190610e9b565b60405180910390a36001905092915050565b60025481565b5f8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20541015610461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045890611070565b60405180910390fd5b8160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561051c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610513906110d8565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610553575f80fd5b8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461059f9190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546105f29190611156565b925050819055508160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106809190611123565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106e49190610e9b565b60405180910390a3600190509392505050565b60035f9054906101000a900460ff1681565b6004602052805f5260405f205f915090505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a4906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f60065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001805461089c90610ff6565b80601f01602080910402602001604051908101604052809291908181526020018280546108c890610ff6565b80156109135780601f106108ea57610100808354040283529160200191610913565b820191905f5260205f20905b8154815290600101906020018083116108f657829003601f168201915b505050505081565b5f8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561099c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109939061123b565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a01906112a3565b60405180910390fd5b8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610a569190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610aa99190611156565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b0d9190610e9b565b60405180910390a36001905092915050565b6005602052815f5260405f20602052805f5260405f205f91509150505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc5906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c339061130b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610d3c82610cfa565b610d468185610d04565b9350610d56818560208601610d14565b610d5f81610d22565b840191505092915050565b5f6020820190508181035f830152610d828184610d32565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610db782610d8e565b9050919050565b610dc781610dad565b8114610dd1575f80fd5b50565b5f81359050610de281610dbe565b92915050565b5f819050919050565b610dfa81610de8565b8114610e04575f80fd5b50565b5f81359050610e1581610df1565b92915050565b5f8060408385031215610e3157610e30610d8a565b5b5f610e3e85828601610dd4565b9250506020610e4f85828601610e07565b9150509250929050565b5f8115159050919050565b610e6d81610e59565b82525050565b5f602082019050610e865f830184610e64565b92915050565b610e9581610de8565b82525050565b5f602082019050610eae5f830184610e8c565b92915050565b5f805f60608486031215610ecb57610eca610d8a565b5b5f610ed886828701610dd4565b9350506020610ee986828701610dd4565b9250506040610efa86828701610e07565b9150509250925092565b5f60ff82169050919050565b610f1981610f04565b82525050565b5f602082019050610f325f830184610f10565b92915050565b5f60208284031215610f4d57610f4c610d8a565b5b5f610f5a84828501610dd4565b91505092915050565b610f6c81610dad565b82525050565b5f602082019050610f855f830184610f63565b92915050565b5f8060408385031215610fa157610fa0610d8a565b5b5f610fae85828601610dd4565b9250506020610fbf85828601610dd4565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061100d57607f821691505b6020821081036110205761101f610fc9565b5b50919050565b7f335349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f61105a600683610d04565b915061106582611026565b602082019050919050565b5f6020820190508181035f8301526110878161104e565b9050919050565b7f345349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f6110c2600683610d04565b91506110cd8261108e565b602082019050919050565b5f6020820190508181035f8301526110ef816110b6565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61112d82610de8565b915061113883610de8565b92508282039050818111156111505761114f6110f6565b5b92915050565b5f61116082610de8565b915061116b83610de8565b9250828201905080821115611183576111826110f6565b5b92915050565b7f365349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f6111bd600683610d04565b91506111c882611189565b602082019050919050565b5f6020820190508181035f8301526111ea816111b1565b9050919050565b7f315349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f611225600683610d04565b9150611230826111f1565b602082019050919050565b5f6020820190508181035f83015261125281611219565b9050919050565b7f325349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f61128d600683610d04565b915061129882611259565b602082019050919050565b5f6020820190508181035f8301526112ba81611281565b9050919050565b7f355349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f6112f5600683610d04565b9150611300826112c1565b602082019050919050565b5f6020820190508181035f830152611322816112e9565b905091905056fea264697066735822122020d01c43c83569c9b43d6394543bfd4790eb2619d5164fa15795f4a758955c3b64736f6c634300081a0033
608060405234801561000f575f80fd5b50600436106100b2575f3560e01c8063715018a61161006f578063715018a6146101a05780638da5cb5b146101aa57806395d89b41146101c8578063a9059cbb146101e6578063dd62ed3e14610216578063f2fde38b14610246576100b2565b806306fdde03146100b6578063095ea7b3146100d457806318160ddd1461010457806323b872dd14610122578063313ce5671461015257806370a0823114610170575b5f80fd5b6100be610262565b6040516100cb9190610d6a565b60405180910390f35b6100ee60048036038101906100e99190610e1b565b6102ed565b6040516100fb9190610e73565b60405180910390f35b61010c6103da565b6040516101199190610e9b565b60405180910390f35b61013c60048036038101906101379190610eb4565b6103e0565b6040516101499190610e73565b60405180910390f35b61015a6106f7565b6040516101679190610f1f565b60405180910390f35b61018a60048036038101906101859190610f38565b610709565b6040516101979190610e9b565b60405180910390f35b6101a861071e565b005b6101b261086a565b6040516101bf9190610f72565b60405180910390f35b6101d061088f565b6040516101dd9190610d6a565b60405180910390f35b61020060048036038101906101fb9190610e1b565b61091b565b60405161020d9190610e73565b60405180910390f35b610230600480360381019061022b9190610f8b565b610b1f565b60405161023d9190610e9b565b60405180910390f35b610260600480360381019061025b9190610f38565b610b3f565b005b5f805461026e90610ff6565b80601f016020809104026020016040519081016040528092919081815260200182805461029a90610ff6565b80156102e55780601f106102bc576101008083540402835291602001916102e5565b820191905f5260205f20905b8154815290600101906020018083116102c857829003601f168201915b505050505081565b5f8160055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516103c89190610e9b565b60405180910390a36001905092915050565b60025481565b5f8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20541015610461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045890611070565b60405180910390fd5b8160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561051c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610513906110d8565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610553575f80fd5b8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461059f9190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546105f29190611156565b925050819055508160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106809190611123565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106e49190610e9b565b60405180910390a3600190509392505050565b60035f9054906101000a900460ff1681565b6004602052805f5260405f205f915090505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a4906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f60065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001805461089c90610ff6565b80601f01602080910402602001604051908101604052809291908181526020018280546108c890610ff6565b80156109135780601f106108ea57610100808354040283529160200191610913565b820191905f5260205f20905b8154815290600101906020018083116108f657829003601f168201915b505050505081565b5f8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561099c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109939061123b565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a01906112a3565b60405180910390fd5b8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610a569190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610aa99190611156565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b0d9190610e9b565b60405180910390a36001905092915050565b6005602052815f5260405f20602052805f5260405f205f91509150505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc5906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c339061130b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610d3c82610cfa565b610d468185610d04565b9350610d56818560208601610d14565b610d5f81610d22565b840191505092915050565b5f6020820190508181035f830152610d828184610d32565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610db782610d8e565b9050919050565b610dc781610dad565b8114610dd1575f80fd5b50565b5f81359050610de281610dbe565b92915050565b5f819050919050565b610dfa81610de8565b8114610e04575f80fd5b50565b5f81359050610e1581610df1565b92915050565b5f8060408385031215610e3157610e30610d8a565b5b5f610e3e85828601610dd4565b9250506020610e4f85828601610e07565b9150509250929050565b5f8115159050919050565b610e6d81610e59565b82525050565b5f602082019050610e865f830184610e64565b92915050565b610e9581610de8565b82525050565b5f602082019050610eae5f830184610e8c565b92915050565b5f805f60608486031215610ecb57610eca610d8a565b5b5f610ed886828701610dd4565b9350506020610ee986828701610dd4565b9250506040610efa86828701610e07565b9150509250925092565b5f60ff82169050919050565b610f1981610f04565b82525050565b5f602082019050610f325f830184610f10565b92915050565b5f60208284031215610f4d57610f4c610d8a565b5b5f610f5a84828501610dd4565b91505092915050565b610f6c81610dad565b82525050565b5f602082019050610f855f830184610f63565b92915050565b5f8060408385031215610fa157610fa0610d8a565b5b5f610fae85828601610dd4565b9250506020610fbf85828601610dd4565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061100d57607f821691505b6020821081036110205761101f610fc9565b5b50919050565b7f335349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f61105a600683610d04565b915061106582611026565b602082019050919050565b5f6020820190508181035f8301526110878161104e565b9050919050565b7f345349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f6110c2600683610d04565b91506110cd8261108e565b602082019050919050565b5f6020820190508181035f8301526110ef816110b6565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61112d82610de8565b915061113883610de8565b92508282039050818111156111505761114f6110f6565b5b92915050565b5f61116082610de8565b915061116b83610de8565b9250828201905080821115611183576111826110f6565b5b92915050565b7f365349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f6111bd600683610d04565b91506111c882611189565b602082019050919050565b5f6020820190508181035f8301526111ea816111b1565b9050919050565b7f315349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f611225600683610d04565b9150611230826111f1565b602082019050919050565b5f6020820190508181035f83015261125281611219565b9050919050565b7f325349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f61128d600683610d04565b915061129882611259565b602082019050919050565b5f6020820190508181035f8301526112ba81611281565b9050919050565b7f355349474d4100000000000000000000000000000000000000000000000000005f82015250565b5f6112f5600683610d04565b9150611300826112c1565b602082019050919050565b5f6020820190508181035f830152611322816112e9565b905091905056fea264697066735822122020d01c43c83569c9b43d6394543bfd4790eb2619d5164fa15795f4a758955c3b64736f6c634300081a0033
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** Website : https://x.com/sigmaonsol69/ Twitter : https://x.com/sigmaonsol69/ Telegram : https://t.me/SIGMAonsolportal */ contract SIGMA { string public name = "SIGMA"; string public symbol = "SIGMA"; uint256 public totalSupply = 999999999999999999000000000; uint8 public decimals = 18; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; address public owner; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() { owner = msg.sender; balanceOf[msg.sender] = totalSupply; } function transfer(address _to, uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value, "1SIGMA"); require(_to != address(0), "2SIGMA"); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value, "3SIGMA"); require(allowance[_from][msg.sender] >= _value, "4SIGMA"); require(_to != address(0)); balanceOf[_from] -= _value; balanceOf[_to] += _value; allowance[_from][msg.sender] -= _value; emit Transfer(_from, _to, _value); return true; } function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "5SIGMA"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } function renounceOwnership() public onlyOwner { emit OwnershipTransferred(owner, address(0)); owner = address(0); } modifier onlyOwner() { require(msg.sender == owner, "6SIGMA"); _; } }
1
20,290,315
fbd68ffc92509ad367f9b5ba37f1e9475f94fa24a6e63db8de4f6a0e17cfffb2
ee6e5ba877af4e752e7b7e44ac9e351e0dd2cd9d4d630af38d5d8cd5d639180c
4f82e73edb06d29ff62c91ec8f5ff06571bdeb29
1f98431c8ad98523631ae4a59f267346ea31f984
317389d938a230c89feb3f72e57e1f5f48171ac2
6101606040523480156200001257600080fd5b503060601b60805260408051630890357360e41b81529051600091339163890357309160048082019260a092909190829003018186803b1580156200005657600080fd5b505afa1580156200006b573d6000803e3d6000fd5b505050506040513d60a08110156200008257600080fd5b508051602080830151604084015160608086015160809096015160e896871b6001600160e81b0319166101005291811b6001600160601b031990811660e05292811b831660c0529390931b1660a052600282810b900b90921b610120529150620000f79082906200010f811b62002b8417901c565b60801b6001600160801b03191661014052506200017d565b60008082600281900b620d89e719816200012557fe5b05029050600083600281900b620d89e8816200013d57fe5b0502905060008460020b83830360020b816200015557fe5b0560010190508062ffffff166001600160801b038016816200017357fe5b0495945050505050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160e81c6101405160801c61567e6200024a60003980611fee5280614b5f5280614b96525080610c0052806128fd5280614bca5280614bfc525080610cef52806119cb5280611a0252806129455250806111c75280611a855280611ef4528061244452806129215280613e6b5250806108d252806112f55280611a545280611e8e52806123be5280613d2252508061207b528061227d52806128d9525080612bfb525061567e6000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000008f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000000061309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f00000000000000000000000000000000000000000000000000000000000000008d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f00000000000000000000000000000000000000000000000000000000000000008d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f00000000000000000000000000000000000000000000000000000000000000008b8b613b86565b8715611aab57611aab7f00000000000000000000000000000000000000000000000000000000000000008b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f0000000000000000000000000000000000000000000000000000000000000000908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f0000000000000000000000000000000000000000000000000000000000000000908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f00000000000000000000000000000000000000000000000000000000000000009087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f00000000000000000000000000000000000000000000000000000000000000009087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f000000000000000000000000000000000000000000000000000000000000000061513b565b9450614bba60058c8b8d8b8b87898b60017f000000000000000000000000000000000000000000000000000000000000000061513b565b93508415614bee57614bee60068d7f0000000000000000000000000000000000000000000000000000000000000000615325565b8315614c2057614c2060068c7f0000000000000000000000000000000000000000000000000000000000000000615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f00000000000000000000000091792f96d2ef065486e31a3ab06726ab03f8194f81565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000c88f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000271061309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f00000000000000000000000091792f96d2ef065486e31a3ab06726ab03f8194f8d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000271062ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000271062ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f00000000000000000000000091792f96d2ef065486e31a3ab06726ab03f8194f8b8b613b86565b8715611aab57611aab7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f00000000000000000000000091792f96d2ef065486e31a3ab06726ab03f8194f908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f00000000000000000000000000000000000762d10ef955d55b7d038c7a7231cc81565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f00000000000000000000000091792f96d2ef065486e31a3ab06726ab03f8194f9087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b7f00000000000000000000000000000000000000000000000000000000000000c881565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b7f000000000000000000000000000000000000000000000000000000000000271081565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f000000000000000000000000317389d938a230c89feb3f72e57e1f5f48171ac21614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f00000000000000000000000091792f96d2ef065486e31a3ab06726ab03f8194f1693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f00000000000000000000000000000000000762d10ef955d55b7d038c7a7231cc61513b565b9450614bba60058c8b8d8b8b87898b60017f00000000000000000000000000000000000762d10ef955d55b7d038c7a7231cc61513b565b93508415614bee57614bee60068d7f00000000000000000000000000000000000000000000000000000000000000c8615325565b8315614c2057614c2060068c7f00000000000000000000000000000000000000000000000000000000000000c8615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
{{ "language": "Solidity", "sources": { "contracts/UniswapV3Pool.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.7.6;\n\nimport './interfaces/IUniswapV3Pool.sol';\n\nimport './NoDelegateCall.sol';\n\nimport './libraries/LowGasSafeMath.sol';\nimport './libraries/SafeCast.sol';\nimport './libraries/Tick.sol';\nimport './libraries/TickBitmap.sol';\nimport './libraries/Position.sol';\nimport './libraries/Oracle.sol';\n\nimport './libraries/FullMath.sol';\nimport './libraries/FixedPoint128.sol';\nimport './libraries/TransferHelper.sol';\nimport './libraries/TickMath.sol';\nimport './libraries/LiquidityMath.sol';\nimport './libraries/SqrtPriceMath.sol';\nimport './libraries/SwapMath.sol';\n\nimport './interfaces/IUniswapV3PoolDeployer.sol';\nimport './interfaces/IUniswapV3Factory.sol';\nimport './interfaces/IERC20Minimal.sol';\nimport './interfaces/callback/IUniswapV3MintCallback.sol';\nimport './interfaces/callback/IUniswapV3SwapCallback.sol';\nimport './interfaces/callback/IUniswapV3FlashCallback.sol';\n\ncontract UniswapV3Pool is IUniswapV3Pool, NoDelegateCall {\n using LowGasSafeMath for uint256;\n using LowGasSafeMath for int256;\n using SafeCast for uint256;\n using SafeCast for int256;\n using Tick for mapping(int24 => Tick.Info);\n using TickBitmap for mapping(int16 => uint256);\n using Position for mapping(bytes32 => Position.Info);\n using Position for Position.Info;\n using Oracle for Oracle.Observation[65535];\n\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override factory;\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override token0;\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override token1;\n /// @inheritdoc IUniswapV3PoolImmutables\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniswapV3PoolImmutables\n int24 public immutable override tickSpacing;\n\n /// @inheritdoc IUniswapV3PoolImmutables\n uint128 public immutable override maxLiquidityPerTick;\n\n struct Slot0 {\n // the current price\n uint160 sqrtPriceX96;\n // the current tick\n int24 tick;\n // the most-recently updated index of the observations array\n uint16 observationIndex;\n // the current maximum number of observations that are being stored\n uint16 observationCardinality;\n // the next maximum number of observations to store, triggered in observations.write\n uint16 observationCardinalityNext;\n // the current protocol fee as a percentage of the swap fee taken on withdrawal\n // represented as an integer denominator (1/x)%\n uint8 feeProtocol;\n // whether the pool is locked\n bool unlocked;\n }\n /// @inheritdoc IUniswapV3PoolState\n Slot0 public override slot0;\n\n /// @inheritdoc IUniswapV3PoolState\n uint256 public override feeGrowthGlobal0X128;\n /// @inheritdoc IUniswapV3PoolState\n uint256 public override feeGrowthGlobal1X128;\n\n // accumulated protocol fees in token0/token1 units\n struct ProtocolFees {\n uint128 token0;\n uint128 token1;\n }\n /// @inheritdoc IUniswapV3PoolState\n ProtocolFees public override protocolFees;\n\n /// @inheritdoc IUniswapV3PoolState\n uint128 public override liquidity;\n\n /// @inheritdoc IUniswapV3PoolState\n mapping(int24 => Tick.Info) public override ticks;\n /// @inheritdoc IUniswapV3PoolState\n mapping(int16 => uint256) public override tickBitmap;\n /// @inheritdoc IUniswapV3PoolState\n mapping(bytes32 => Position.Info) public override positions;\n /// @inheritdoc IUniswapV3PoolState\n Oracle.Observation[65535] public override observations;\n\n /// @dev Mutually exclusive reentrancy protection into the pool to/from a method. This method also prevents entrance\n /// to a function before the pool is initialized. The reentrancy guard is required throughout the contract because\n /// we use balance checks to determine the payment status of interactions such as mint, swap and flash.\n modifier lock() {\n require(slot0.unlocked, 'LOK');\n slot0.unlocked = false;\n _;\n slot0.unlocked = true;\n }\n\n /// @dev Prevents calling a function from anyone except the address returned by IUniswapV3Factory#owner()\n modifier onlyFactoryOwner() {\n require(msg.sender == IUniswapV3Factory(factory).owner());\n _;\n }\n\n constructor() {\n int24 _tickSpacing;\n (factory, token0, token1, fee, _tickSpacing) = IUniswapV3PoolDeployer(msg.sender).parameters();\n tickSpacing = _tickSpacing;\n\n maxLiquidityPerTick = Tick.tickSpacingToMaxLiquidityPerTick(_tickSpacing);\n }\n\n /// @dev Common checks for valid tick inputs.\n function checkTicks(int24 tickLower, int24 tickUpper) private pure {\n require(tickLower < tickUpper, 'TLU');\n require(tickLower >= TickMath.MIN_TICK, 'TLM');\n require(tickUpper <= TickMath.MAX_TICK, 'TUM');\n }\n\n /// @dev Returns the block timestamp truncated to 32 bits, i.e. mod 2**32. This method is overridden in tests.\n function _blockTimestamp() internal view virtual returns (uint32) {\n return uint32(block.timestamp); // truncation is desired\n }\n\n /// @dev Get the pool's balance of token0\n /// @dev This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize\n /// check\n function balance0() private view returns (uint256) {\n (bool success, bytes memory data) =\n token0.staticcall(abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, address(this)));\n require(success && data.length >= 32);\n return abi.decode(data, (uint256));\n }\n\n /// @dev Get the pool's balance of token1\n /// @dev This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize\n /// check\n function balance1() private view returns (uint256) {\n (bool success, bytes memory data) =\n token1.staticcall(abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, address(this)));\n require(success && data.length >= 32);\n return abi.decode(data, (uint256));\n }\n\n /// @inheritdoc IUniswapV3PoolDerivedState\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n override\n noDelegateCall\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n )\n {\n checkTicks(tickLower, tickUpper);\n\n int56 tickCumulativeLower;\n int56 tickCumulativeUpper;\n uint160 secondsPerLiquidityOutsideLowerX128;\n uint160 secondsPerLiquidityOutsideUpperX128;\n uint32 secondsOutsideLower;\n uint32 secondsOutsideUpper;\n\n {\n Tick.Info storage lower = ticks[tickLower];\n Tick.Info storage upper = ticks[tickUpper];\n bool initializedLower;\n (tickCumulativeLower, secondsPerLiquidityOutsideLowerX128, secondsOutsideLower, initializedLower) = (\n lower.tickCumulativeOutside,\n lower.secondsPerLiquidityOutsideX128,\n lower.secondsOutside,\n lower.initialized\n );\n require(initializedLower);\n\n bool initializedUpper;\n (tickCumulativeUpper, secondsPerLiquidityOutsideUpperX128, secondsOutsideUpper, initializedUpper) = (\n upper.tickCumulativeOutside,\n upper.secondsPerLiquidityOutsideX128,\n upper.secondsOutside,\n upper.initialized\n );\n require(initializedUpper);\n }\n\n Slot0 memory _slot0 = slot0;\n\n if (_slot0.tick < tickLower) {\n return (\n tickCumulativeLower - tickCumulativeUpper,\n secondsPerLiquidityOutsideLowerX128 - secondsPerLiquidityOutsideUpperX128,\n secondsOutsideLower - secondsOutsideUpper\n );\n } else if (_slot0.tick < tickUpper) {\n uint32 time = _blockTimestamp();\n (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) =\n observations.observeSingle(\n time,\n 0,\n _slot0.tick,\n _slot0.observationIndex,\n liquidity,\n _slot0.observationCardinality\n );\n return (\n tickCumulative - tickCumulativeLower - tickCumulativeUpper,\n secondsPerLiquidityCumulativeX128 -\n secondsPerLiquidityOutsideLowerX128 -\n secondsPerLiquidityOutsideUpperX128,\n time - secondsOutsideLower - secondsOutsideUpper\n );\n } else {\n return (\n tickCumulativeUpper - tickCumulativeLower,\n secondsPerLiquidityOutsideUpperX128 - secondsPerLiquidityOutsideLowerX128,\n secondsOutsideUpper - secondsOutsideLower\n );\n }\n }\n\n /// @inheritdoc IUniswapV3PoolDerivedState\n function observe(uint32[] calldata secondsAgos)\n external\n view\n override\n noDelegateCall\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s)\n {\n return\n observations.observe(\n _blockTimestamp(),\n secondsAgos,\n slot0.tick,\n slot0.observationIndex,\n liquidity,\n slot0.observationCardinality\n );\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext)\n external\n override\n lock\n noDelegateCall\n {\n uint16 observationCardinalityNextOld = slot0.observationCardinalityNext; // for the event\n uint16 observationCardinalityNextNew =\n observations.grow(observationCardinalityNextOld, observationCardinalityNext);\n slot0.observationCardinalityNext = observationCardinalityNextNew;\n if (observationCardinalityNextOld != observationCardinalityNextNew)\n emit IncreaseObservationCardinalityNext(observationCardinalityNextOld, observationCardinalityNextNew);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev not locked because it initializes unlocked\n function initialize(uint160 sqrtPriceX96) external override {\n require(slot0.sqrtPriceX96 == 0, 'AI');\n\n int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96);\n\n (uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp());\n\n slot0 = Slot0({\n sqrtPriceX96: sqrtPriceX96,\n tick: tick,\n observationIndex: 0,\n observationCardinality: cardinality,\n observationCardinalityNext: cardinalityNext,\n feeProtocol: 0,\n unlocked: true\n });\n\n emit Initialize(sqrtPriceX96, tick);\n }\n\n struct ModifyPositionParams {\n // the address that owns the position\n address owner;\n // the lower and upper tick of the position\n int24 tickLower;\n int24 tickUpper;\n // any change in liquidity\n int128 liquidityDelta;\n }\n\n /// @dev Effect some changes to a position\n /// @param params the position details and the change to the position's liquidity to effect\n /// @return position a storage pointer referencing the position with the given owner and tick range\n /// @return amount0 the amount of token0 owed to the pool, negative if the pool should pay the recipient\n /// @return amount1 the amount of token1 owed to the pool, negative if the pool should pay the recipient\n function _modifyPosition(ModifyPositionParams memory params)\n private\n noDelegateCall\n returns (\n Position.Info storage position,\n int256 amount0,\n int256 amount1\n )\n {\n checkTicks(params.tickLower, params.tickUpper);\n\n Slot0 memory _slot0 = slot0; // SLOAD for gas optimization\n\n position = _updatePosition(\n params.owner,\n params.tickLower,\n params.tickUpper,\n params.liquidityDelta,\n _slot0.tick\n );\n\n if (params.liquidityDelta != 0) {\n if (_slot0.tick < params.tickLower) {\n // current tick is below the passed range; liquidity can only become in range by crossing from left to\n // right, when we'll need _more_ token0 (it's becoming more valuable) so user must provide it\n amount0 = SqrtPriceMath.getAmount0Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n } else if (_slot0.tick < params.tickUpper) {\n // current tick is inside the passed range\n uint128 liquidityBefore = liquidity; // SLOAD for gas optimization\n\n // write an oracle entry\n (slot0.observationIndex, slot0.observationCardinality) = observations.write(\n _slot0.observationIndex,\n _blockTimestamp(),\n _slot0.tick,\n liquidityBefore,\n _slot0.observationCardinality,\n _slot0.observationCardinalityNext\n );\n\n amount0 = SqrtPriceMath.getAmount0Delta(\n _slot0.sqrtPriceX96,\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n amount1 = SqrtPriceMath.getAmount1Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n _slot0.sqrtPriceX96,\n params.liquidityDelta\n );\n\n liquidity = LiquidityMath.addDelta(liquidityBefore, params.liquidityDelta);\n } else {\n // current tick is above the passed range; liquidity can only become in range by crossing from right to\n // left, when we'll need _more_ token1 (it's becoming more valuable) so user must provide it\n amount1 = SqrtPriceMath.getAmount1Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n }\n }\n }\n\n /// @dev Gets and updates a position with the given liquidity delta\n /// @param owner the owner of the position\n /// @param tickLower the lower tick of the position's tick range\n /// @param tickUpper the upper tick of the position's tick range\n /// @param tick the current tick, passed to avoid sloads\n function _updatePosition(\n address owner,\n int24 tickLower,\n int24 tickUpper,\n int128 liquidityDelta,\n int24 tick\n ) private returns (Position.Info storage position) {\n position = positions.get(owner, tickLower, tickUpper);\n\n uint256 _feeGrowthGlobal0X128 = feeGrowthGlobal0X128; // SLOAD for gas optimization\n uint256 _feeGrowthGlobal1X128 = feeGrowthGlobal1X128; // SLOAD for gas optimization\n\n // if we need to update the ticks, do it\n bool flippedLower;\n bool flippedUpper;\n if (liquidityDelta != 0) {\n uint32 time = _blockTimestamp();\n (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) =\n observations.observeSingle(\n time,\n 0,\n slot0.tick,\n slot0.observationIndex,\n liquidity,\n slot0.observationCardinality\n );\n\n flippedLower = ticks.update(\n tickLower,\n tick,\n liquidityDelta,\n _feeGrowthGlobal0X128,\n _feeGrowthGlobal1X128,\n secondsPerLiquidityCumulativeX128,\n tickCumulative,\n time,\n false,\n maxLiquidityPerTick\n );\n flippedUpper = ticks.update(\n tickUpper,\n tick,\n liquidityDelta,\n _feeGrowthGlobal0X128,\n _feeGrowthGlobal1X128,\n secondsPerLiquidityCumulativeX128,\n tickCumulative,\n time,\n true,\n maxLiquidityPerTick\n );\n\n if (flippedLower) {\n tickBitmap.flipTick(tickLower, tickSpacing);\n }\n if (flippedUpper) {\n tickBitmap.flipTick(tickUpper, tickSpacing);\n }\n }\n\n (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) =\n ticks.getFeeGrowthInside(tickLower, tickUpper, tick, _feeGrowthGlobal0X128, _feeGrowthGlobal1X128);\n\n position.update(liquidityDelta, feeGrowthInside0X128, feeGrowthInside1X128);\n\n // clear any tick data that is no longer needed\n if (liquidityDelta < 0) {\n if (flippedLower) {\n ticks.clear(tickLower);\n }\n if (flippedUpper) {\n ticks.clear(tickUpper);\n }\n }\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev noDelegateCall is applied indirectly via _modifyPosition\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external override lock returns (uint256 amount0, uint256 amount1) {\n require(amount > 0);\n (, int256 amount0Int, int256 amount1Int) =\n _modifyPosition(\n ModifyPositionParams({\n owner: recipient,\n tickLower: tickLower,\n tickUpper: tickUpper,\n liquidityDelta: int256(amount).toInt128()\n })\n );\n\n amount0 = uint256(amount0Int);\n amount1 = uint256(amount1Int);\n\n uint256 balance0Before;\n uint256 balance1Before;\n if (amount0 > 0) balance0Before = balance0();\n if (amount1 > 0) balance1Before = balance1();\n IUniswapV3MintCallback(msg.sender).uniswapV3MintCallback(amount0, amount1, data);\n if (amount0 > 0) require(balance0Before.add(amount0) <= balance0(), 'M0');\n if (amount1 > 0) require(balance1Before.add(amount1) <= balance1(), 'M1');\n\n emit Mint(msg.sender, recipient, tickLower, tickUpper, amount, amount0, amount1);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external override lock returns (uint128 amount0, uint128 amount1) {\n // we don't need to checkTicks here, because invalid positions will never have non-zero tokensOwed{0,1}\n Position.Info storage position = positions.get(msg.sender, tickLower, tickUpper);\n\n amount0 = amount0Requested > position.tokensOwed0 ? position.tokensOwed0 : amount0Requested;\n amount1 = amount1Requested > position.tokensOwed1 ? position.tokensOwed1 : amount1Requested;\n\n if (amount0 > 0) {\n position.tokensOwed0 -= amount0;\n TransferHelper.safeTransfer(token0, recipient, amount0);\n }\n if (amount1 > 0) {\n position.tokensOwed1 -= amount1;\n TransferHelper.safeTransfer(token1, recipient, amount1);\n }\n\n emit Collect(msg.sender, recipient, tickLower, tickUpper, amount0, amount1);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev noDelegateCall is applied indirectly via _modifyPosition\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external override lock returns (uint256 amount0, uint256 amount1) {\n (Position.Info storage position, int256 amount0Int, int256 amount1Int) =\n _modifyPosition(\n ModifyPositionParams({\n owner: msg.sender,\n tickLower: tickLower,\n tickUpper: tickUpper,\n liquidityDelta: -int256(amount).toInt128()\n })\n );\n\n amount0 = uint256(-amount0Int);\n amount1 = uint256(-amount1Int);\n\n if (amount0 > 0 || amount1 > 0) {\n (position.tokensOwed0, position.tokensOwed1) = (\n position.tokensOwed0 + uint128(amount0),\n position.tokensOwed1 + uint128(amount1)\n );\n }\n\n emit Burn(msg.sender, tickLower, tickUpper, amount, amount0, amount1);\n }\n\n struct SwapCache {\n // the protocol fee for the input token\n uint8 feeProtocol;\n // liquidity at the beginning of the swap\n uint128 liquidityStart;\n // the timestamp of the current block\n uint32 blockTimestamp;\n // the current value of the tick accumulator, computed only if we cross an initialized tick\n int56 tickCumulative;\n // the current value of seconds per liquidity accumulator, computed only if we cross an initialized tick\n uint160 secondsPerLiquidityCumulativeX128;\n // whether we've computed and cached the above two accumulators\n bool computedLatestObservation;\n }\n\n // the top level state of the swap, the results of which are recorded in storage at the end\n struct SwapState {\n // the amount remaining to be swapped in/out of the input/output asset\n int256 amountSpecifiedRemaining;\n // the amount already swapped out/in of the output/input asset\n int256 amountCalculated;\n // current sqrt(price)\n uint160 sqrtPriceX96;\n // the tick associated with the current price\n int24 tick;\n // the global fee growth of the input token\n uint256 feeGrowthGlobalX128;\n // amount of input token paid as protocol fee\n uint128 protocolFee;\n // the current liquidity in range\n uint128 liquidity;\n }\n\n struct StepComputations {\n // the price at the beginning of the step\n uint160 sqrtPriceStartX96;\n // the next tick to swap to from the current tick in the swap direction\n int24 tickNext;\n // whether tickNext is initialized or not\n bool initialized;\n // sqrt(price) for the next tick (1/0)\n uint160 sqrtPriceNextX96;\n // how much is being swapped in in this step\n uint256 amountIn;\n // how much is being swapped out\n uint256 amountOut;\n // how much fee is being paid in\n uint256 feeAmount;\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external override noDelegateCall returns (int256 amount0, int256 amount1) {\n require(amountSpecified != 0, 'AS');\n\n Slot0 memory slot0Start = slot0;\n\n require(slot0Start.unlocked, 'LOK');\n require(\n zeroForOne\n ? sqrtPriceLimitX96 < slot0Start.sqrtPriceX96 && sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO\n : sqrtPriceLimitX96 > slot0Start.sqrtPriceX96 && sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO,\n 'SPL'\n );\n\n slot0.unlocked = false;\n\n SwapCache memory cache =\n SwapCache({\n liquidityStart: liquidity,\n blockTimestamp: _blockTimestamp(),\n feeProtocol: zeroForOne ? (slot0Start.feeProtocol % 16) : (slot0Start.feeProtocol >> 4),\n secondsPerLiquidityCumulativeX128: 0,\n tickCumulative: 0,\n computedLatestObservation: false\n });\n\n bool exactInput = amountSpecified > 0;\n\n SwapState memory state =\n SwapState({\n amountSpecifiedRemaining: amountSpecified,\n amountCalculated: 0,\n sqrtPriceX96: slot0Start.sqrtPriceX96,\n tick: slot0Start.tick,\n feeGrowthGlobalX128: zeroForOne ? feeGrowthGlobal0X128 : feeGrowthGlobal1X128,\n protocolFee: 0,\n liquidity: cache.liquidityStart\n });\n\n // continue swapping as long as we haven't used the entire input/output and haven't reached the price limit\n while (state.amountSpecifiedRemaining != 0 && state.sqrtPriceX96 != sqrtPriceLimitX96) {\n StepComputations memory step;\n\n step.sqrtPriceStartX96 = state.sqrtPriceX96;\n\n (step.tickNext, step.initialized) = tickBitmap.nextInitializedTickWithinOneWord(\n state.tick,\n tickSpacing,\n zeroForOne\n );\n\n // ensure that we do not overshoot the min/max tick, as the tick bitmap is not aware of these bounds\n if (step.tickNext < TickMath.MIN_TICK) {\n step.tickNext = TickMath.MIN_TICK;\n } else if (step.tickNext > TickMath.MAX_TICK) {\n step.tickNext = TickMath.MAX_TICK;\n }\n\n // get the price for the next tick\n step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext);\n\n // compute values to swap to the target tick, price limit, or point where input/output amount is exhausted\n (state.sqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath.computeSwapStep(\n state.sqrtPriceX96,\n (zeroForOne ? step.sqrtPriceNextX96 < sqrtPriceLimitX96 : step.sqrtPriceNextX96 > sqrtPriceLimitX96)\n ? sqrtPriceLimitX96\n : step.sqrtPriceNextX96,\n state.liquidity,\n state.amountSpecifiedRemaining,\n fee\n );\n\n if (exactInput) {\n state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256();\n state.amountCalculated = state.amountCalculated.sub(step.amountOut.toInt256());\n } else {\n state.amountSpecifiedRemaining += step.amountOut.toInt256();\n state.amountCalculated = state.amountCalculated.add((step.amountIn + step.feeAmount).toInt256());\n }\n\n // if the protocol fee is on, calculate how much is owed, decrement feeAmount, and increment protocolFee\n if (cache.feeProtocol > 0) {\n uint256 delta = step.feeAmount / cache.feeProtocol;\n step.feeAmount -= delta;\n state.protocolFee += uint128(delta);\n }\n\n // update global fee tracker\n if (state.liquidity > 0)\n state.feeGrowthGlobalX128 += FullMath.mulDiv(step.feeAmount, FixedPoint128.Q128, state.liquidity);\n\n // shift tick if we reached the next price\n if (state.sqrtPriceX96 == step.sqrtPriceNextX96) {\n // if the tick is initialized, run the tick transition\n if (step.initialized) {\n // check for the placeholder value, which we replace with the actual value the first time the swap\n // crosses an initialized tick\n if (!cache.computedLatestObservation) {\n (cache.tickCumulative, cache.secondsPerLiquidityCumulativeX128) = observations.observeSingle(\n cache.blockTimestamp,\n 0,\n slot0Start.tick,\n slot0Start.observationIndex,\n cache.liquidityStart,\n slot0Start.observationCardinality\n );\n cache.computedLatestObservation = true;\n }\n int128 liquidityNet =\n ticks.cross(\n step.tickNext,\n (zeroForOne ? state.feeGrowthGlobalX128 : feeGrowthGlobal0X128),\n (zeroForOne ? feeGrowthGlobal1X128 : state.feeGrowthGlobalX128),\n cache.secondsPerLiquidityCumulativeX128,\n cache.tickCumulative,\n cache.blockTimestamp\n );\n // if we're moving leftward, we interpret liquidityNet as the opposite sign\n // safe because liquidityNet cannot be type(int128).min\n if (zeroForOne) liquidityNet = -liquidityNet;\n\n state.liquidity = LiquidityMath.addDelta(state.liquidity, liquidityNet);\n }\n\n state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;\n } else if (state.sqrtPriceX96 != step.sqrtPriceStartX96) {\n // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved\n state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96);\n }\n }\n\n // update tick and write an oracle entry if the tick change\n if (state.tick != slot0Start.tick) {\n (uint16 observationIndex, uint16 observationCardinality) =\n observations.write(\n slot0Start.observationIndex,\n cache.blockTimestamp,\n slot0Start.tick,\n cache.liquidityStart,\n slot0Start.observationCardinality,\n slot0Start.observationCardinalityNext\n );\n (slot0.sqrtPriceX96, slot0.tick, slot0.observationIndex, slot0.observationCardinality) = (\n state.sqrtPriceX96,\n state.tick,\n observationIndex,\n observationCardinality\n );\n } else {\n // otherwise just update the price\n slot0.sqrtPriceX96 = state.sqrtPriceX96;\n }\n\n // update liquidity if it changed\n if (cache.liquidityStart != state.liquidity) liquidity = state.liquidity;\n\n // update fee growth global and, if necessary, protocol fees\n // overflow is acceptable, protocol has to withdraw before it hits type(uint128).max fees\n if (zeroForOne) {\n feeGrowthGlobal0X128 = state.feeGrowthGlobalX128;\n if (state.protocolFee > 0) protocolFees.token0 += state.protocolFee;\n } else {\n feeGrowthGlobal1X128 = state.feeGrowthGlobalX128;\n if (state.protocolFee > 0) protocolFees.token1 += state.protocolFee;\n }\n\n (amount0, amount1) = zeroForOne == exactInput\n ? (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated)\n : (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining);\n\n // do the transfers and collect payment\n if (zeroForOne) {\n if (amount1 < 0) TransferHelper.safeTransfer(token1, recipient, uint256(-amount1));\n\n uint256 balance0Before = balance0();\n IUniswapV3SwapCallback(msg.sender).uniswapV3SwapCallback(amount0, amount1, data);\n require(balance0Before.add(uint256(amount0)) <= balance0(), 'IIA');\n } else {\n if (amount0 < 0) TransferHelper.safeTransfer(token0, recipient, uint256(-amount0));\n\n uint256 balance1Before = balance1();\n IUniswapV3SwapCallback(msg.sender).uniswapV3SwapCallback(amount0, amount1, data);\n require(balance1Before.add(uint256(amount1)) <= balance1(), 'IIA');\n }\n\n emit Swap(msg.sender, recipient, amount0, amount1, state.sqrtPriceX96, state.liquidity, state.tick);\n slot0.unlocked = true;\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external override lock noDelegateCall {\n uint128 _liquidity = liquidity;\n require(_liquidity > 0, 'L');\n\n uint256 fee0 = FullMath.mulDivRoundingUp(amount0, fee, 1e6);\n uint256 fee1 = FullMath.mulDivRoundingUp(amount1, fee, 1e6);\n uint256 balance0Before = balance0();\n uint256 balance1Before = balance1();\n\n if (amount0 > 0) TransferHelper.safeTransfer(token0, recipient, amount0);\n if (amount1 > 0) TransferHelper.safeTransfer(token1, recipient, amount1);\n\n IUniswapV3FlashCallback(msg.sender).uniswapV3FlashCallback(fee0, fee1, data);\n\n uint256 balance0After = balance0();\n uint256 balance1After = balance1();\n\n require(balance0Before.add(fee0) <= balance0After, 'F0');\n require(balance1Before.add(fee1) <= balance1After, 'F1');\n\n // sub is safe because we know balanceAfter is gt balanceBefore by at least fee\n uint256 paid0 = balance0After - balance0Before;\n uint256 paid1 = balance1After - balance1Before;\n\n if (paid0 > 0) {\n uint8 feeProtocol0 = slot0.feeProtocol % 16;\n uint256 fees0 = feeProtocol0 == 0 ? 0 : paid0 / feeProtocol0;\n if (uint128(fees0) > 0) protocolFees.token0 += uint128(fees0);\n feeGrowthGlobal0X128 += FullMath.mulDiv(paid0 - fees0, FixedPoint128.Q128, _liquidity);\n }\n if (paid1 > 0) {\n uint8 feeProtocol1 = slot0.feeProtocol >> 4;\n uint256 fees1 = feeProtocol1 == 0 ? 0 : paid1 / feeProtocol1;\n if (uint128(fees1) > 0) protocolFees.token1 += uint128(fees1);\n feeGrowthGlobal1X128 += FullMath.mulDiv(paid1 - fees1, FixedPoint128.Q128, _liquidity);\n }\n\n emit Flash(msg.sender, recipient, amount0, amount1, paid0, paid1);\n }\n\n /// @inheritdoc IUniswapV3PoolOwnerActions\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock onlyFactoryOwner {\n require(\n (feeProtocol0 == 0 || (feeProtocol0 >= 4 && feeProtocol0 <= 10)) &&\n (feeProtocol1 == 0 || (feeProtocol1 >= 4 && feeProtocol1 <= 10))\n );\n uint8 feeProtocolOld = slot0.feeProtocol;\n slot0.feeProtocol = feeProtocol0 + (feeProtocol1 << 4);\n emit SetFeeProtocol(feeProtocolOld % 16, feeProtocolOld >> 4, feeProtocol0, feeProtocol1);\n }\n\n /// @inheritdoc IUniswapV3PoolOwnerActions\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external override lock onlyFactoryOwner returns (uint128 amount0, uint128 amount1) {\n amount0 = amount0Requested > protocolFees.token0 ? protocolFees.token0 : amount0Requested;\n amount1 = amount1Requested > protocolFees.token1 ? protocolFees.token1 : amount1Requested;\n\n if (amount0 > 0) {\n if (amount0 == protocolFees.token0) amount0--; // ensure that the slot is not cleared, for gas savings\n protocolFees.token0 -= amount0;\n TransferHelper.safeTransfer(token0, recipient, amount0);\n }\n if (amount1 > 0) {\n if (amount1 == protocolFees.token1) amount1--; // ensure that the slot is not cleared, for gas savings\n protocolFees.token1 -= amount1;\n TransferHelper.safeTransfer(token1, recipient, amount1);\n }\n\n emit CollectProtocol(msg.sender, recipient, amount0, amount1);\n }\n}\n" }, "contracts/interfaces/IUniswapV3Pool.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" }, "contracts/NoDelegateCall.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.7.6;\n\n/// @title Prevents delegatecall to a contract\n/// @notice Base contract that provides a modifier for preventing delegatecall to methods in a child contract\nabstract contract NoDelegateCall {\n /// @dev The original address of this contract\n address private immutable original;\n\n constructor() {\n // Immutables are computed in the init code of the contract, and then inlined into the deployed bytecode.\n // In other words, this variable won't change when it's checked at runtime.\n original = address(this);\n }\n\n /// @dev Private method is used instead of inlining into modifier because modifiers are copied into each method,\n /// and the use of immutable means the address bytes are copied in every place the modifier is used.\n function checkNotDelegateCall() private view {\n require(address(this) == original);\n }\n\n /// @notice Prevents delegatecall into the modified method\n modifier noDelegateCall() {\n checkNotDelegateCall();\n _;\n }\n}\n" }, "contracts/libraries/LowGasSafeMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.0;\n\n/// @title Optimized overflow and underflow safe math operations\n/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost\nlibrary LowGasSafeMath {\n /// @notice Returns x + y, reverts if sum overflows uint256\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x);\n }\n\n /// @notice Returns x - y, reverts if underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x);\n }\n\n /// @notice Returns x * y, reverts if overflows\n /// @param x The multiplicand\n /// @param y The multiplier\n /// @return z The product of x and y\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(x == 0 || (z = x * y) / x == y);\n }\n\n /// @notice Returns x + y, reverts if overflows or underflows\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x + y) >= x == (y >= 0));\n }\n\n /// @notice Returns x - y, reverts if overflows or underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x - y) <= x == (y >= 0));\n }\n}\n" }, "contracts/libraries/SafeCast.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Safe casting methods\n/// @notice Contains methods for safely casting between types\nlibrary SafeCast {\n /// @notice Cast a uint256 to a uint160, revert on overflow\n /// @param y The uint256 to be downcasted\n /// @return z The downcasted integer, now type uint160\n function toUint160(uint256 y) internal pure returns (uint160 z) {\n require((z = uint160(y)) == y);\n }\n\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\n /// @param y The int256 to be downcasted\n /// @return z The downcasted integer, now type int128\n function toInt128(int256 y) internal pure returns (int128 z) {\n require((z = int128(y)) == y);\n }\n\n /// @notice Cast a uint256 to a int256, revert on overflow\n /// @param y The uint256 to be casted\n /// @return z The casted integer, now type int256\n function toInt256(uint256 y) internal pure returns (int256 z) {\n require(y < 2**255);\n z = int256(y);\n }\n}\n" }, "contracts/libraries/Tick.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './LowGasSafeMath.sol';\nimport './SafeCast.sol';\n\nimport './TickMath.sol';\nimport './LiquidityMath.sol';\n\n/// @title Tick\n/// @notice Contains functions for managing tick processes and relevant calculations\nlibrary Tick {\n using LowGasSafeMath for int256;\n using SafeCast for int256;\n\n // info stored for each initialized individual tick\n struct Info {\n // the total position liquidity that references this tick\n uint128 liquidityGross;\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\n int128 liquidityNet;\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint256 feeGrowthOutside0X128;\n uint256 feeGrowthOutside1X128;\n // the cumulative tick value on the other side of the tick\n int56 tickCumulativeOutside;\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint160 secondsPerLiquidityOutsideX128;\n // the seconds spent on the other side of the tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint32 secondsOutside;\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\n bool initialized;\n }\n\n /// @notice Derives max liquidity per tick from given tick spacing\n /// @dev Executed within the pool constructor\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\n /// @return The max liquidity per tick\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\n return type(uint128).max / numTicks;\n }\n\n /// @notice Retrieves fee growth data\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @param tickCurrent The current tick\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function getFeeGrowthInside(\n mapping(int24 => Tick.Info) storage self,\n int24 tickLower,\n int24 tickUpper,\n int24 tickCurrent,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128\n ) internal view returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\n Info storage lower = self[tickLower];\n Info storage upper = self[tickUpper];\n\n // calculate fee growth below\n uint256 feeGrowthBelow0X128;\n uint256 feeGrowthBelow1X128;\n if (tickCurrent >= tickLower) {\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\n } else {\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove0X128;\n uint256 feeGrowthAbove1X128;\n if (tickCurrent < tickUpper) {\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\n } else {\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\n }\n\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\n }\n\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The tick that will be updated\n /// @param tickCurrent The current tick\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\n /// @param time The current block timestamp cast to a uint32\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\n function update(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n int24 tickCurrent,\n int128 liquidityDelta,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time,\n bool upper,\n uint128 maxLiquidity\n ) internal returns (bool flipped) {\n Tick.Info storage info = self[tick];\n\n uint128 liquidityGrossBefore = info.liquidityGross;\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\n\n require(liquidityGrossAfter <= maxLiquidity, 'LO');\n\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\n\n if (liquidityGrossBefore == 0) {\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\n if (tick <= tickCurrent) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\n info.tickCumulativeOutside = tickCumulative;\n info.secondsOutside = time;\n }\n info.initialized = true;\n }\n\n info.liquidityGross = liquidityGrossAfter;\n\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\n info.liquidityNet = upper\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\n }\n\n /// @notice Clears tick data\n /// @param self The mapping containing all initialized tick information for initialized ticks\n /// @param tick The tick that will be cleared\n function clear(mapping(int24 => Tick.Info) storage self, int24 tick) internal {\n delete self[tick];\n }\n\n /// @notice Transitions to next tick as needed by price movement\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The destination tick of the transition\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\n /// @param time The current block.timestamp\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\n function cross(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time\n ) internal returns (int128 liquidityNet) {\n Tick.Info storage info = self[tick];\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\n info.secondsOutside = time - info.secondsOutside;\n liquidityNet = info.liquidityNet;\n }\n}\n" }, "contracts/libraries/TickBitmap.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './BitMath.sol';\n\n/// @title Packed tick initialized state library\n/// @notice Stores a packed mapping of tick index to its initialized state\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\nlibrary TickBitmap {\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\n /// @param tick The tick for which to compute the position\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\n /// @return bitPos The bit position in the word where the flag is stored\n function position(int24 tick) private pure returns (int16 wordPos, uint8 bitPos) {\n wordPos = int16(tick >> 8);\n bitPos = uint8(tick % 256);\n }\n\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\n /// @param self The mapping in which to flip the tick\n /// @param tick The tick to flip\n /// @param tickSpacing The spacing between usable ticks\n function flipTick(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing\n ) internal {\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\n (int16 wordPos, uint8 bitPos) = position(tick / tickSpacing);\n uint256 mask = 1 << bitPos;\n self[wordPos] ^= mask;\n }\n\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\n /// to the left (less than or equal to) or right (greater than) of the given tick\n /// @param self The mapping in which to compute the next initialized tick\n /// @param tick The starting tick\n /// @param tickSpacing The spacing between usable ticks\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\n function nextInitializedTickWithinOneWord(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal view returns (int24 next, bool initialized) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n if (lte) {\n (int16 wordPos, uint8 bitPos) = position(compressed);\n // all the 1s at or to the right of the current bitPos\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed - int24(bitPos - BitMath.mostSignificantBit(masked))) * tickSpacing\n : (compressed - int24(bitPos)) * tickSpacing;\n } else {\n // start from the word of the next tick, since the current tick state doesn't matter\n (int16 wordPos, uint8 bitPos) = position(compressed + 1);\n // all the 1s at or to the left of the bitPos\n uint256 mask = ~((1 << bitPos) - 1);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed + 1 + int24(BitMath.leastSignificantBit(masked) - bitPos)) * tickSpacing\n : (compressed + 1 + int24(type(uint8).max - bitPos)) * tickSpacing;\n }\n }\n}\n" }, "contracts/libraries/Position.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './FixedPoint128.sol';\nimport './LiquidityMath.sol';\n\n/// @title Position\n/// @notice Positions represent an owner address' liquidity between a lower and upper tick boundary\n/// @dev Positions store additional state for tracking fees owed to the position\nlibrary Position {\n // info stored for each user's position\n struct Info {\n // the amount of liquidity owned by this position\n uint128 liquidity;\n // fee growth per unit of liquidity as of the last update to liquidity or fees owed\n uint256 feeGrowthInside0LastX128;\n uint256 feeGrowthInside1LastX128;\n // the fees owed to the position owner in token0/token1\n uint128 tokensOwed0;\n uint128 tokensOwed1;\n }\n\n /// @notice Returns the Info struct of a position, given an owner and position boundaries\n /// @param self The mapping containing all user positions\n /// @param owner The address of the position owner\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @return position The position info struct of the given owners' position\n function get(\n mapping(bytes32 => Info) storage self,\n address owner,\n int24 tickLower,\n int24 tickUpper\n ) internal view returns (Position.Info storage position) {\n position = self[keccak256(abi.encodePacked(owner, tickLower, tickUpper))];\n }\n\n /// @notice Credits accumulated fees to a user's position\n /// @param self The individual position to update\n /// @param liquidityDelta The change in pool liquidity as a result of the position update\n /// @param feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @param feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function update(\n Info storage self,\n int128 liquidityDelta,\n uint256 feeGrowthInside0X128,\n uint256 feeGrowthInside1X128\n ) internal {\n Info memory _self = self;\n\n uint128 liquidityNext;\n if (liquidityDelta == 0) {\n require(_self.liquidity > 0, 'NP'); // disallow pokes for 0 liquidity positions\n liquidityNext = _self.liquidity;\n } else {\n liquidityNext = LiquidityMath.addDelta(_self.liquidity, liquidityDelta);\n }\n\n // calculate accumulated fees\n uint128 tokensOwed0 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside0X128 - _self.feeGrowthInside0LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n uint128 tokensOwed1 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside1X128 - _self.feeGrowthInside1LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n\n // update the position\n if (liquidityDelta != 0) self.liquidity = liquidityNext;\n self.feeGrowthInside0LastX128 = feeGrowthInside0X128;\n self.feeGrowthInside1LastX128 = feeGrowthInside1X128;\n if (tokensOwed0 > 0 || tokensOwed1 > 0) {\n // overflow is acceptable, have to withdraw before you hit type(uint128).max fees\n self.tokensOwed0 += tokensOwed0;\n self.tokensOwed1 += tokensOwed1;\n }\n }\n}\n" }, "contracts/libraries/Oracle.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\n/// @title Oracle\n/// @notice Provides price and liquidity data useful for a wide variety of system designs\n/// @dev Instances of stored oracle data, \"observations\", are collected in the oracle array\n/// Every pool is initialized with an oracle array length of 1. Anyone can pay the SSTOREs to increase the\n/// maximum length of the oracle array. New slots will be added when the array is fully populated.\n/// Observations are overwritten when the full length of the oracle array is populated.\n/// The most recent observation is available, independent of the length of the oracle array, by passing 0 to observe()\nlibrary Oracle {\n struct Observation {\n // the block timestamp of the observation\n uint32 blockTimestamp;\n // the tick accumulator, i.e. tick * time elapsed since the pool was first initialized\n int56 tickCumulative;\n // the seconds per liquidity, i.e. seconds elapsed / max(1, liquidity) since the pool was first initialized\n uint160 secondsPerLiquidityCumulativeX128;\n // whether or not the observation is initialized\n bool initialized;\n }\n\n /// @notice Transforms a previous observation into a new observation, given the passage of time and the current tick and liquidity values\n /// @dev blockTimestamp _must_ be chronologically equal to or greater than last.blockTimestamp, safe for 0 or 1 overflows\n /// @param last The specified observation to be transformed\n /// @param blockTimestamp The timestamp of the new observation\n /// @param tick The active tick at the time of the new observation\n /// @param liquidity The total in-range liquidity at the time of the new observation\n /// @return Observation The newly populated observation\n function transform(\n Observation memory last,\n uint32 blockTimestamp,\n int24 tick,\n uint128 liquidity\n ) private pure returns (Observation memory) {\n uint32 delta = blockTimestamp - last.blockTimestamp;\n return\n Observation({\n blockTimestamp: blockTimestamp,\n tickCumulative: last.tickCumulative + int56(tick) * delta,\n secondsPerLiquidityCumulativeX128: last.secondsPerLiquidityCumulativeX128 +\n ((uint160(delta) << 128) / (liquidity > 0 ? liquidity : 1)),\n initialized: true\n });\n }\n\n /// @notice Initialize the oracle array by writing the first slot. Called once for the lifecycle of the observations array\n /// @param self The stored oracle array\n /// @param time The time of the oracle initialization, via block.timestamp truncated to uint32\n /// @return cardinality The number of populated elements in the oracle array\n /// @return cardinalityNext The new length of the oracle array, independent of population\n function initialize(Observation[65535] storage self, uint32 time)\n internal\n returns (uint16 cardinality, uint16 cardinalityNext)\n {\n self[0] = Observation({\n blockTimestamp: time,\n tickCumulative: 0,\n secondsPerLiquidityCumulativeX128: 0,\n initialized: true\n });\n return (1, 1);\n }\n\n /// @notice Writes an oracle observation to the array\n /// @dev Writable at most once per block. Index represents the most recently written element. cardinality and index must be tracked externally.\n /// If the index is at the end of the allowable array length (according to cardinality), and the next cardinality\n /// is greater than the current one, cardinality may be increased. This restriction is created to preserve ordering.\n /// @param self The stored oracle array\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param blockTimestamp The timestamp of the new observation\n /// @param tick The active tick at the time of the new observation\n /// @param liquidity The total in-range liquidity at the time of the new observation\n /// @param cardinality The number of populated elements in the oracle array\n /// @param cardinalityNext The new length of the oracle array, independent of population\n /// @return indexUpdated The new index of the most recently written element in the oracle array\n /// @return cardinalityUpdated The new cardinality of the oracle array\n function write(\n Observation[65535] storage self,\n uint16 index,\n uint32 blockTimestamp,\n int24 tick,\n uint128 liquidity,\n uint16 cardinality,\n uint16 cardinalityNext\n ) internal returns (uint16 indexUpdated, uint16 cardinalityUpdated) {\n Observation memory last = self[index];\n\n // early return if we've already written an observation this block\n if (last.blockTimestamp == blockTimestamp) return (index, cardinality);\n\n // if the conditions are right, we can bump the cardinality\n if (cardinalityNext > cardinality && index == (cardinality - 1)) {\n cardinalityUpdated = cardinalityNext;\n } else {\n cardinalityUpdated = cardinality;\n }\n\n indexUpdated = (index + 1) % cardinalityUpdated;\n self[indexUpdated] = transform(last, blockTimestamp, tick, liquidity);\n }\n\n /// @notice Prepares the oracle array to store up to `next` observations\n /// @param self The stored oracle array\n /// @param current The current next cardinality of the oracle array\n /// @param next The proposed next cardinality which will be populated in the oracle array\n /// @return next The next cardinality which will be populated in the oracle array\n function grow(\n Observation[65535] storage self,\n uint16 current,\n uint16 next\n ) internal returns (uint16) {\n require(current > 0, 'I');\n // no-op if the passed next value isn't greater than the current next value\n if (next <= current) return current;\n // store in each slot to prevent fresh SSTOREs in swaps\n // this data will not be used because the initialized boolean is still false\n for (uint16 i = current; i < next; i++) self[i].blockTimestamp = 1;\n return next;\n }\n\n /// @notice comparator for 32-bit timestamps\n /// @dev safe for 0 or 1 overflows, a and b _must_ be chronologically before or equal to time\n /// @param time A timestamp truncated to 32 bits\n /// @param a A comparison timestamp from which to determine the relative position of `time`\n /// @param b From which to determine the relative position of `time`\n /// @return bool Whether `a` is chronologically <= `b`\n function lte(\n uint32 time,\n uint32 a,\n uint32 b\n ) private pure returns (bool) {\n // if there hasn't been overflow, no need to adjust\n if (a <= time && b <= time) return a <= b;\n\n uint256 aAdjusted = a > time ? a : a + 2**32;\n uint256 bAdjusted = b > time ? b : b + 2**32;\n\n return aAdjusted <= bAdjusted;\n }\n\n /// @notice Fetches the observations beforeOrAt and atOrAfter a target, i.e. where [beforeOrAt, atOrAfter] is satisfied.\n /// The result may be the same observation, or adjacent observations.\n /// @dev The answer must be contained in the array, used when the target is located within the stored observation\n /// boundaries: older than the most recent observation and younger, or the same age as, the oldest observation\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param target The timestamp at which the reserved observation should be for\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param cardinality The number of populated elements in the oracle array\n /// @return beforeOrAt The observation recorded before, or at, the target\n /// @return atOrAfter The observation recorded at, or after, the target\n function binarySearch(\n Observation[65535] storage self,\n uint32 time,\n uint32 target,\n uint16 index,\n uint16 cardinality\n ) private view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {\n uint256 l = (index + 1) % cardinality; // oldest observation\n uint256 r = l + cardinality - 1; // newest observation\n uint256 i;\n while (true) {\n i = (l + r) / 2;\n\n beforeOrAt = self[i % cardinality];\n\n // we've landed on an uninitialized tick, keep searching higher (more recently)\n if (!beforeOrAt.initialized) {\n l = i + 1;\n continue;\n }\n\n atOrAfter = self[(i + 1) % cardinality];\n\n bool targetAtOrAfter = lte(time, beforeOrAt.blockTimestamp, target);\n\n // check if we've found the answer!\n if (targetAtOrAfter && lte(time, target, atOrAfter.blockTimestamp)) break;\n\n if (!targetAtOrAfter) r = i - 1;\n else l = i + 1;\n }\n }\n\n /// @notice Fetches the observations beforeOrAt and atOrAfter a given target, i.e. where [beforeOrAt, atOrAfter] is satisfied\n /// @dev Assumes there is at least 1 initialized observation.\n /// Used by observeSingle() to compute the counterfactual accumulator values as of a given block timestamp.\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param target The timestamp at which the reserved observation should be for\n /// @param tick The active tick at the time of the returned or simulated observation\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The total pool liquidity at the time of the call\n /// @param cardinality The number of populated elements in the oracle array\n /// @return beforeOrAt The observation which occurred at, or before, the given timestamp\n /// @return atOrAfter The observation which occurred at, or after, the given timestamp\n function getSurroundingObservations(\n Observation[65535] storage self,\n uint32 time,\n uint32 target,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) private view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {\n // optimistically set before to the newest observation\n beforeOrAt = self[index];\n\n // if the target is chronologically at or after the newest observation, we can early return\n if (lte(time, beforeOrAt.blockTimestamp, target)) {\n if (beforeOrAt.blockTimestamp == target) {\n // if newest observation equals target, we're in the same block, so we can ignore atOrAfter\n return (beforeOrAt, atOrAfter);\n } else {\n // otherwise, we need to transform\n return (beforeOrAt, transform(beforeOrAt, target, tick, liquidity));\n }\n }\n\n // now, set before to the oldest observation\n beforeOrAt = self[(index + 1) % cardinality];\n if (!beforeOrAt.initialized) beforeOrAt = self[0];\n\n // ensure that the target is chronologically at or after the oldest observation\n require(lte(time, beforeOrAt.blockTimestamp, target), 'OLD');\n\n // if we've reached this point, we have to binary search\n return binarySearch(self, time, target, index, cardinality);\n }\n\n /// @dev Reverts if an observation at or before the desired observation timestamp does not exist.\n /// 0 may be passed as `secondsAgo' to return the current cumulative values.\n /// If called with a timestamp falling between two observations, returns the counterfactual accumulator values\n /// at exactly the timestamp between the two observations.\n /// @param self The stored oracle array\n /// @param time The current block timestamp\n /// @param secondsAgo The amount of time to look back, in seconds, at which point to return an observation\n /// @param tick The current tick\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The current in-range pool liquidity\n /// @param cardinality The number of populated elements in the oracle array\n /// @return tickCumulative The tick * time elapsed since the pool was first initialized, as of `secondsAgo`\n /// @return secondsPerLiquidityCumulativeX128 The time elapsed / max(1, liquidity) since the pool was first initialized, as of `secondsAgo`\n function observeSingle(\n Observation[65535] storage self,\n uint32 time,\n uint32 secondsAgo,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) internal view returns (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) {\n if (secondsAgo == 0) {\n Observation memory last = self[index];\n if (last.blockTimestamp != time) last = transform(last, time, tick, liquidity);\n return (last.tickCumulative, last.secondsPerLiquidityCumulativeX128);\n }\n\n uint32 target = time - secondsAgo;\n\n (Observation memory beforeOrAt, Observation memory atOrAfter) =\n getSurroundingObservations(self, time, target, tick, index, liquidity, cardinality);\n\n if (target == beforeOrAt.blockTimestamp) {\n // we're at the left boundary\n return (beforeOrAt.tickCumulative, beforeOrAt.secondsPerLiquidityCumulativeX128);\n } else if (target == atOrAfter.blockTimestamp) {\n // we're at the right boundary\n return (atOrAfter.tickCumulative, atOrAfter.secondsPerLiquidityCumulativeX128);\n } else {\n // we're in the middle\n uint32 observationTimeDelta = atOrAfter.blockTimestamp - beforeOrAt.blockTimestamp;\n uint32 targetDelta = target - beforeOrAt.blockTimestamp;\n return (\n beforeOrAt.tickCumulative +\n ((atOrAfter.tickCumulative - beforeOrAt.tickCumulative) / observationTimeDelta) *\n targetDelta,\n beforeOrAt.secondsPerLiquidityCumulativeX128 +\n uint160(\n (uint256(\n atOrAfter.secondsPerLiquidityCumulativeX128 - beforeOrAt.secondsPerLiquidityCumulativeX128\n ) * targetDelta) / observationTimeDelta\n )\n );\n }\n }\n\n /// @notice Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`\n /// @dev Reverts if `secondsAgos` > oldest observation\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param secondsAgos Each amount of time to look back, in seconds, at which point to return an observation\n /// @param tick The current tick\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The current in-range pool liquidity\n /// @param cardinality The number of populated elements in the oracle array\n /// @return tickCumulatives The tick * time elapsed since the pool was first initialized, as of each `secondsAgo`\n /// @return secondsPerLiquidityCumulativeX128s The cumulative seconds / max(1, liquidity) since the pool was first initialized, as of each `secondsAgo`\n function observe(\n Observation[65535] storage self,\n uint32 time,\n uint32[] memory secondsAgos,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) internal view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) {\n require(cardinality > 0, 'I');\n\n tickCumulatives = new int56[](secondsAgos.length);\n secondsPerLiquidityCumulativeX128s = new uint160[](secondsAgos.length);\n for (uint256 i = 0; i < secondsAgos.length; i++) {\n (tickCumulatives[i], secondsPerLiquidityCumulativeX128s[i]) = observeSingle(\n self,\n time,\n secondsAgos[i],\n tick,\n index,\n liquidity,\n cardinality\n );\n }\n }\n}\n" }, "contracts/libraries/FullMath.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = -denominator & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n}\n" }, "contracts/libraries/FixedPoint128.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint128\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\nlibrary FixedPoint128 {\n uint256 internal constant Q128 = 0x100000000000000000000000000000000;\n}\n" }, "contracts/libraries/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.0;\n\nimport '../interfaces/IERC20Minimal.sol';\n\n/// @title TransferHelper\n/// @notice Contains helper methods for interacting with ERC20 tokens that do not consistently return true/false\nlibrary TransferHelper {\n /// @notice Transfers tokens from msg.sender to a recipient\n /// @dev Calls transfer on token contract, errors with TF if transfer fails\n /// @param token The contract address of the token which will be transferred\n /// @param to The recipient of the transfer\n /// @param value The value of the transfer\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n (bool success, bytes memory data) =\n token.call(abi.encodeWithSelector(IERC20Minimal.transfer.selector, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TF');\n }\n}\n" }, "contracts/libraries/TickMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(MAX_TICK), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n /// ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" }, "contracts/libraries/LiquidityMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math library for liquidity\nlibrary LiquidityMath {\n /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows\n /// @param x The liquidity before change\n /// @param y The delta by which liquidity should be changed\n /// @return z The liquidity delta\n function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) {\n if (y < 0) {\n require((z = x - uint128(-y)) < x, 'LS');\n } else {\n require((z = x + uint128(y)) >= x, 'LA');\n }\n }\n}\n" }, "contracts/libraries/SqrtPriceMath.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './LowGasSafeMath.sol';\nimport './SafeCast.sol';\n\nimport './FullMath.sol';\nimport './UnsafeMath.sol';\nimport './FixedPoint96.sol';\n\n/// @title Functions based on Q64.96 sqrt price and liquidity\n/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas\nlibrary SqrtPriceMath {\n using LowGasSafeMath for uint256;\n using SafeCast for uint256;\n\n /// @notice Gets the next sqrt price given a delta of token0\n /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the\n /// price less in order to not send too much output.\n /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),\n /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).\n /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token0 to add or remove from virtual reserves\n /// @param add Whether to add or remove the amount of token0\n /// @return The price after adding or removing amount, depending on add\n function getNextSqrtPriceFromAmount0RoundingUp(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price\n if (amount == 0) return sqrtPX96;\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n\n if (add) {\n uint256 product;\n if ((product = amount * sqrtPX96) / amount == sqrtPX96) {\n uint256 denominator = numerator1 + product;\n if (denominator >= numerator1)\n // always fits in 160 bits\n return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));\n }\n\n return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));\n } else {\n uint256 product;\n // if the product overflows, we know the denominator underflows\n // in addition, we must check that the denominator does not underflow\n require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);\n uint256 denominator = numerator1 - product;\n return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();\n }\n }\n\n /// @notice Gets the next sqrt price given a delta of token1\n /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the\n /// price less in order to not send too much output.\n /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity\n /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token1 to add, or remove, from virtual reserves\n /// @param add Whether to add, or remove, the amount of token1\n /// @return The price after adding or removing `amount`\n function getNextSqrtPriceFromAmount1RoundingDown(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // if we're adding (subtracting), rounding down requires rounding the quotient down (up)\n // in both cases, avoid a mulDiv for most inputs\n if (add) {\n uint256 quotient =\n (\n amount <= type(uint160).max\n ? (amount << FixedPoint96.RESOLUTION) / liquidity\n : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)\n );\n\n return uint256(sqrtPX96).add(quotient).toUint160();\n } else {\n uint256 quotient =\n (\n amount <= type(uint160).max\n ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)\n : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)\n );\n\n require(sqrtPX96 > quotient);\n // always fits 160 bits\n return uint160(sqrtPX96 - quotient);\n }\n }\n\n /// @notice Gets the next sqrt price given an input amount of token0 or token1\n /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds\n /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountIn How much of token0, or token1, is being swapped in\n /// @param zeroForOne Whether the amount in is token0 or token1\n /// @return sqrtQX96 The price after adding the input amount to token0 or token1\n function getNextSqrtPriceFromInput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountIn,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we don't pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)\n : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);\n }\n\n /// @notice Gets the next sqrt price given an output amount of token0 or token1\n /// @dev Throws if price or liquidity are 0 or the next price is out of bounds\n /// @param sqrtPX96 The starting price before accounting for the output amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountOut How much of token0, or token1, is being swapped out\n /// @param zeroForOne Whether the amount out is token0 or token1\n /// @return sqrtQX96 The price after removing the output amount of token0 or token1\n function getNextSqrtPriceFromOutput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountOut,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)\n : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);\n }\n\n /// @notice Gets the amount0 delta between two prices\n /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),\n /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up or down\n /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;\n\n require(sqrtRatioAX96 > 0);\n\n return\n roundUp\n ? UnsafeMath.divRoundingUp(\n FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96),\n sqrtRatioAX96\n )\n : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n /// @notice Gets the amount1 delta between two prices\n /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up, or down\n /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n roundUp\n ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)\n : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n /// @notice Helper that gets signed token0 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount0 delta\n /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount0) {\n return\n liquidity < 0\n ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n\n /// @notice Helper that gets signed token1 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount1 delta\n /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount1) {\n return\n liquidity < 0\n ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n}\n" }, "contracts/libraries/SwapMath.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './SqrtPriceMath.sol';\n\n/// @title Computes the result of a swap within ticks\n/// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.\nlibrary SwapMath {\n /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap\n /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive\n /// @param sqrtRatioCurrentX96 The current sqrt price of the pool\n /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred\n /// @param liquidity The usable liquidity\n /// @param amountRemaining How much input or output amount is remaining to be swapped in/out\n /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip\n /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target\n /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap\n /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap\n /// @return feeAmount The amount of input that will be taken as a fee\n function computeSwapStep(\n uint160 sqrtRatioCurrentX96,\n uint160 sqrtRatioTargetX96,\n uint128 liquidity,\n int256 amountRemaining,\n uint24 feePips\n )\n internal\n pure\n returns (\n uint160 sqrtRatioNextX96,\n uint256 amountIn,\n uint256 amountOut,\n uint256 feeAmount\n )\n {\n bool zeroForOne = sqrtRatioCurrentX96 >= sqrtRatioTargetX96;\n bool exactIn = amountRemaining >= 0;\n\n if (exactIn) {\n uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6);\n amountIn = zeroForOne\n ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true)\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);\n if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(\n sqrtRatioCurrentX96,\n liquidity,\n amountRemainingLessFee,\n zeroForOne\n );\n } else {\n amountOut = zeroForOne\n ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false)\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);\n if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(\n sqrtRatioCurrentX96,\n liquidity,\n uint256(-amountRemaining),\n zeroForOne\n );\n }\n\n bool max = sqrtRatioTargetX96 == sqrtRatioNextX96;\n\n // get the input/output amounts\n if (zeroForOne) {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);\n } else {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false);\n }\n\n // cap the output amount to not exceed the remaining output amount\n if (!exactIn && amountOut > uint256(-amountRemaining)) {\n amountOut = uint256(-amountRemaining);\n }\n\n if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) {\n // we didn't reach the target, so take the remainder of the maximum input as fee\n feeAmount = uint256(amountRemaining) - amountIn;\n } else {\n feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips);\n }\n }\n}\n" }, "contracts/interfaces/IUniswapV3PoolDeployer.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title An interface for a contract that is capable of deploying Uniswap V3 Pools\n/// @notice A contract that constructs a pool must implement this to pass arguments to the pool\n/// @dev This is used to avoid having constructor arguments in the pool contract, which results in the init code hash\n/// of the pool being constant allowing the CREATE2 address of the pool to be cheaply computed on-chain\ninterface IUniswapV3PoolDeployer {\n /// @notice Get the parameters to be used in constructing the pool, set transiently during pool creation.\n /// @dev Called by the pool constructor to fetch the parameters of the pool\n /// Returns factory The factory address\n /// Returns token0 The first token of the pool by address sort order\n /// Returns token1 The second token of the pool by address sort order\n /// Returns fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// Returns tickSpacing The minimum number of ticks between initialized ticks\n function parameters()\n external\n view\n returns (\n address factory,\n address token0,\n address token1,\n uint24 fee,\n int24 tickSpacing\n );\n}\n" }, "contracts/interfaces/IUniswapV3Factory.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n /// @notice Emitted when the owner of the factory is changed\n /// @param oldOwner The owner before the owner was changed\n /// @param newOwner The owner after the owner was changed\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n /// @notice Emitted when a pool is created\n /// @param token0 The first token of the pool by address sort order\n /// @param token1 The second token of the pool by address sort order\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks\n /// @param pool The address of the created pool\n event PoolCreated(\n address indexed token0,\n address indexed token1,\n uint24 indexed fee,\n int24 tickSpacing,\n address pool\n );\n\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n /// @param fee The enabled fee, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n /// @notice Returns the current owner of the factory\n /// @dev Can be changed by the current owner via setOwner\n /// @return The address of the factory owner\n function owner() external view returns (address);\n\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n /// @return The tick spacing\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n /// @param tokenA The contract address of either token0 or token1\n /// @param tokenB The contract address of the other token\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @return pool The pool address\n function getPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external view returns (address pool);\n\n /// @notice Creates a pool for the given two tokens and fee\n /// @param tokenA One of the two tokens in the desired pool\n /// @param tokenB The other of the two tokens in the desired pool\n /// @param fee The desired fee for the pool\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n /// are invalid.\n /// @return pool The address of the newly created pool\n function createPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external returns (address pool);\n\n /// @notice Updates the owner of the factory\n /// @dev Must be called by the current owner\n /// @param _owner The new owner of the factory\n function setOwner(address _owner) external;\n\n /// @notice Enables a fee amount with the given tickSpacing\n /// @dev Fee amounts may never be removed once enabled\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}\n" }, "contracts/interfaces/IERC20Minimal.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" }, "contracts/interfaces/callback/IUniswapV3MintCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#mint\n/// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface\ninterface IUniswapV3MintCallback {\n /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.\n /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/callback/IUniswapV3SwapCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/callback/IUniswapV3FlashCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolState.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolActions.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" }, "contracts/libraries/BitMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title BitMath\n/// @dev This library provides functionality for computing bit properties of an unsigned integer\nlibrary BitMath {\n /// @notice Returns the index of the most significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)\n /// @param x the value for which to compute the most significant bit, must be greater than 0\n /// @return r the index of the most significant bit\n function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n if (x >= 0x100000000000000000000000000000000) {\n x >>= 128;\n r += 128;\n }\n if (x >= 0x10000000000000000) {\n x >>= 64;\n r += 64;\n }\n if (x >= 0x100000000) {\n x >>= 32;\n r += 32;\n }\n if (x >= 0x10000) {\n x >>= 16;\n r += 16;\n }\n if (x >= 0x100) {\n x >>= 8;\n r += 8;\n }\n if (x >= 0x10) {\n x >>= 4;\n r += 4;\n }\n if (x >= 0x4) {\n x >>= 2;\n r += 2;\n }\n if (x >= 0x2) r += 1;\n }\n\n /// @notice Returns the index of the least significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0)\n /// @param x the value for which to compute the least significant bit, must be greater than 0\n /// @return r the index of the least significant bit\n function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n r = 255;\n if (x & type(uint128).max > 0) {\n r -= 128;\n } else {\n x >>= 128;\n }\n if (x & type(uint64).max > 0) {\n r -= 64;\n } else {\n x >>= 64;\n }\n if (x & type(uint32).max > 0) {\n r -= 32;\n } else {\n x >>= 32;\n }\n if (x & type(uint16).max > 0) {\n r -= 16;\n } else {\n x >>= 16;\n }\n if (x & type(uint8).max > 0) {\n r -= 8;\n } else {\n x >>= 8;\n }\n if (x & 0xf > 0) {\n r -= 4;\n } else {\n x >>= 4;\n }\n if (x & 0x3 > 0) {\n r -= 2;\n } else {\n x >>= 2;\n }\n if (x & 0x1 > 0) r -= 1;\n }\n}\n" }, "contracts/libraries/UnsafeMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math functions that do not check inputs or outputs\n/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks\nlibrary UnsafeMath {\n /// @notice Returns ceil(x / y)\n /// @dev division by 0 has unspecified behavior, and must be checked externally\n /// @param x The dividend\n /// @param y The divisor\n /// @return z The quotient, ceil(x / y)\n function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n z := add(div(x, y), gt(mod(x, y), 0))\n }\n }\n}\n" }, "contracts/libraries/FixedPoint96.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 800 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} } }}
1
20,290,317
8b172a8c851f5f0e0dd851b5efabd128aaaaabbc039f7c9c201a42a48a02b509
7d3601cda2c872bc9e0f24b20852edd292647bf71c49cb42b0d72f9e08305815
bfbcdd04dda68cfcfba2d687ffce365fd46d5f5f
bfbcdd04dda68cfcfba2d687ffce365fd46d5f5f
f69c581a44c5a9d5b54696616702ebff24a06524
60a06040526c054f529ca52576bc68920000006009556b1b2fbb73f163a79bb1000000600a819055600b556b0d97ddb9f8b1d3cdd8800000600c55600d805460ff191690556014600e556023600f553480156200005b57600080fd5b506040518060400160405280601081526020016f26baba30b73a102137bcb99021b63ab160811b8152506040518060400160405280600681526020016526a121a62aa160d11b8152508160039081620000b59190620006c5565b506004620000c48282620006c5565b505050620000e1620000db6200041860201b60201c565b6200041c565b737a250d5630b4cf539739df2c5dacb4c659f2488d60808190526040805163c45a015560e01b8152905163c45a0155916004808201926020929091908290030181865afa15801562000137573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200015d919062000791565b6001600160a01b031663c9c65396306080516001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001ad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001d3919062000791565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801562000221573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000247919062000791565b600680546001600160a01b0319166001600160a01b03929092169182179055620002739060016200046e565b6006546001600160a01b039081166000908152601160205260408082208054600160ff199182168117909255608051909416835291208054909216179055600880546001600160a01b03191633908117909155600780546001600160a01b0319166001600160a01b03928316179055600554620002f491165b6001620004c2565b62000301306001620004c2565b6200030c33620002ec565b6200031b61dead6001620004c2565b62000356620003326005546001600160a01b031690565b6001600160a01b03166000908152601160205260409020805460ff19166001179055565b306000908152601160205260409020805460ff191660011790556200037b3362000332565b61dead60005260116020527f97847ee99463795296047093514439c3127772df3715e628aa85601cf8541716805460ff19166001179055600954600090620003d490606490620003cd90605862000521565b9062000538565b600954909150600090620003e9908362000546565b60075490915062000404906001600160a01b03168362000554565b62000410308262000554565b505062000842565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216600081815260126020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b6001600160a01b038216600081815260106020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b60006200052f8284620007d9565b90505b92915050565b60006200052f8284620007f3565b60006200052f828462000816565b6001600160a01b038216620005af5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620005c391906200082c565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200064a57607f821691505b6020821081036200066b57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200061a576000816000526020600020601f850160051c810160208610156200069c5750805b601f850160051c820191505b81811015620006bd57828155600101620006a8565b505050505050565b81516001600160401b03811115620006e157620006e16200061f565b620006f981620006f2845462000635565b8462000671565b602080601f831160018114620007315760008415620007185750858301515b600019600386901b1c1916600185901b178555620006bd565b600085815260208120601f198616915b82811015620007625788860151825594840194600190910190840162000741565b5085821015620007815787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215620007a457600080fd5b81516001600160a01b0381168114620007bc57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417620005325762000532620007c3565b6000826200081157634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115620005325762000532620007c3565b80820180821115620005325762000532620007c3565b608051611cf4620008736000396000818161038b01528181611505015281816115be01526115fd0152611cf46000f3fe6080604052600436106101db5760003560e01c806389291a8f11610102578063c8c8ebe411610095578063e2f4560511610064578063e2f456051461055a578063f2fde38b14610570578063f8b45b0514610590578063fb201b1d146105a657600080fd5b8063c8c8ebe4146104f8578063cf9522fd1461050e578063dd62ed3e14610524578063dd8546521461054457600080fd5b8063a457c2d7116100d1578063a457c2d714610478578063a9059cbb14610498578063afa4f3b2146104b8578063b70143c9146104d857600080fd5b806389291a8f146104105780638da5cb5b1461042557806395d89b41146104435780639a7a23d61461045857600080fd5b8063313ce5671161017a57806352f7c9881161014957806352f7c98814610359578063583e05681461037957806370a08231146103c5578063715018a6146103fb57600080fd5b8063313ce567146102c4578063346cc7be146102e057806339509351146103005780634fbee1931461032057600080fd5b806318160ddd116101b657806318160ddd1461025857806323b872dd14610277578063284f289914610297578063311028af146102ae57600080fd5b806299d386146101e757806306fdde0314610216578063095ea7b31461023857600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50600d546102019060ff1681565b60405190151581526020015b60405180910390f35b34801561022257600080fd5b5061022b6105bb565b60405161020d919061190d565b34801561024457600080fd5b50610201610253366004611971565b61064d565b34801561026457600080fd5b506002545b60405190815260200161020d565b34801561028357600080fd5b5061020161029236600461199d565b610667565b3480156102a357600080fd5b506102ac61068b565b005b3480156102ba57600080fd5b5061026960095481565b3480156102d057600080fd5b506040516012815260200161020d565b3480156102ec57600080fd5b506102ac6102fb3660046119de565b6106a9565b34801561030c57600080fd5b5061020161031b366004611971565b6107ff565b34801561032c57600080fd5b5061020161033b3660046119de565b6001600160a01b031660009081526010602052604090205460ff1690565b34801561036557600080fd5b506102ac6103743660046119fb565b610821565b34801561038557600080fd5b506103ad7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161020d565b3480156103d157600080fd5b506102696103e03660046119de565b6001600160a01b031660009081526020819052604090205490565b34801561040757600080fd5b506102ac61088b565b34801561041c57600080fd5b506102ac61089f565b34801561043157600080fd5b506005546001600160a01b03166103ad565b34801561044f57600080fd5b5061022b610937565b34801561046457600080fd5b506102ac610473366004611a2b565b610946565b34801561048457600080fd5b50610201610493366004611971565b6109e0565b3480156104a457600080fd5b506102016104b3366004611971565b610a5b565b3480156104c457600080fd5b506102ac6104d3366004611a64565b610a69565b3480156104e457600080fd5b506102ac6104f3366004611a64565b610a89565b34801561050457600080fd5b50610269600a5481565b34801561051a57600080fd5b50610269600f5481565b34801561053057600080fd5b5061026961053f366004611a7d565b610b5f565b34801561055057600080fd5b50610269600e5481565b34801561056657600080fd5b50610269600c5481565b34801561057c57600080fd5b506102ac61058b3660046119de565b610b8a565b34801561059c57600080fd5b50610269600b5481565b3480156105b257600080fd5b506102ac610c00565b6060600380546105ca90611aab565b80601f01602080910402602001604051908101604052809291908181526020018280546105f690611aab565b80156106435780601f1061061857610100808354040283529160200191610643565b820191906000526020600020905b81548152906001019060200180831161062657829003601f168201915b5050505050905090565b60003361065b818585610c17565b60019150505b92915050565b600033610675858285610d3b565b610680858585610daf565b506001949350505050565b6106936113ae565b600061069e60025490565b600a819055600b5550565b6007546001600160a01b0316336001600160a01b0316146106c957600080fd5b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610712573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107369190611ae5565b9050600081116107825760405162461bcd60e51b81526020600482015260126024820152712737903a37b5b2b739903a379031b632b0b960711b60448201526064015b60405180910390fd5b60075460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb906044016020604051808303816000875af11580156107d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f99190611afe565b50505050565b60003361065b8185856108128383610b5f565b61081c9190611b31565b610c17565b6108296113ae565b6028821115801561083b575060328111155b6108805760405162461bcd60e51b8152602060048201526016602482015275466565732063616e6e6f74206578636565642039392560501b6044820152606401610779565b600e91909155600f55565b6108936113ae565b61089d6000611408565b565b6007546001600160a01b0316336001600160a01b0316146108bf57600080fd5b600047116109085760405162461bcd60e51b81526020600482015260166024820152752a37b5b2b71d1037379022aa24103a379031b632b0b960511b6044820152606401610779565b60405133904780156108fc02916000818181858888f19350505050158015610934573d6000803e3d6000fd5b50565b6060600480546105ca90611aab565b61094e6113ae565b6006546001600160a01b03908116908316036109d25760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610779565b6109dc828261145a565b5050565b600033816109ee8286610b5f565b905083811015610a4e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610779565b6106808286868403610c17565b60003361065b818585610daf565b610a716113ae565b610a8381670de0b6b3a7640000611b44565b600c5550565b6007546001600160a01b0316336001600160a01b031614610aa957600080fd5b6000610ab460025490565b306000908152602081905260408120549192506064849003610ad7575080610afa565b6064610ae38585611b44565b610aed9190611b5b565b905081811115610afa5750805b81811115610b565760405162461bcd60e51b8152602060048201526024808201527f5377617020616d6f756e74206578636565647320636f6e74726163742062616c604482015263616e636560e01b6064820152608401610779565b6107f9816114ae565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610b926113ae565b6001600160a01b038116610bf75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610779565b61093481611408565b610c086113ae565b600d805460ff19166001179055565b6001600160a01b038316610c795760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610779565b6001600160a01b038216610cda5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610779565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610d478484610b5f565b905060001981146107f95781811015610da25760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610779565b6107f98484848403610c17565b6001600160a01b038316610dd55760405162461bcd60e51b815260040161077990611b7d565b6001600160a01b038216610dfb5760405162461bcd60e51b815260040161077990611bc2565b80600003610e1457610e0f83836000611675565b505050565b6001600160a01b03831660009081526012602052604081205460ff16158015610e5657506001600160a01b03831660009081526012602052604090205460ff16155b9050610e6a6005546001600160a01b031690565b6001600160a01b0316846001600160a01b031614158015610e9957506005546001600160a01b03848116911614155b8015610ead57506001600160a01b03831615155b8015610ec457506001600160a01b03831661dead14155b8015610eda5750600854600160a01b900460ff16155b156111d357600d5460ff16610f6d576001600160a01b03841660009081526010602052604090205460ff1680610f2857506001600160a01b03831660009081526010602052604090205460ff165b610f6d5760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610779565b6001600160a01b03841660009081526012602052604090205460ff168015610fae57506001600160a01b03831660009081526011602052604090205460ff16155b1561109257600a548211156110235760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610779565b600b546001600160a01b0384166000908152602081905260409020546110499084611b31565b111561108d5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610779565b6111d3565b6001600160a01b03831660009081526012602052604090205460ff1680156110d357506001600160a01b03841660009081526011602052604090205460ff16155b1561114957600a5482111561108d5760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610779565b6001600160a01b03831660009081526011602052604090205460ff166111d357600b546001600160a01b03841660009081526020819052604090205461118f9084611b31565b11156111d35760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610779565b306000908152602081905260408120549081158015906111f1575082155b905080801561120a5750600854600160a01b900460ff16155b801561122f57506001600160a01b03861660009081526012602052604090205460ff16155b801561125457506001600160a01b03861660009081526010602052604090205460ff16155b801561127957506001600160a01b03851660009081526010602052604090205460ff16155b156112a8576008805460ff60a01b1916600160a01b17905561129a8461179f565b6008805460ff60a01b191690555b600854600090600160a01b900460ff161580156112c3575083155b6001600160a01b03881660009081526010602052604090205490915060ff168061130557506001600160a01b03861660009081526010602052604090205460ff165b1561130e575060005b60008115611399576001600160a01b03871660009081526012602052604090205460ff161561135e576113576064611351600f54896118ee90919063ffffffff16565b90611901565b905061137b565b6113786064611351600e54896118ee90919063ffffffff16565b90505b801561138c5761138c883083611675565b6113968187611c05565b95505b6113a4888888611675565b5050505050505050565b6005546001600160a01b0316331461089d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610779565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216600081815260126020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106114e3576114e3611c18565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115859190611c2e565b8160018151811061159857611598611c18565b60200260200101906001600160a01b031690816001600160a01b0316815250506115e3307f000000000000000000000000000000000000000000000000000000000000000084610c17565b60085460405163791ac94760e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169263791ac9479261163f928792600092889291909116904290600401611c4b565b600060405180830381600087803b15801561165957600080fd5b505af115801561166d573d6000803e3d6000fd5b505050505050565b6001600160a01b03831661169b5760405162461bcd60e51b815260040161077990611b7d565b6001600160a01b0382166116c15760405162461bcd60e51b815260040161077990611bc2565b6001600160a01b038316600090815260208190526040902054818110156117395760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610779565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36107f9565b30600090815260208190526040812054908181036117bc57505050565b600f54600e546117cc9190611b31565b600003611838576000821180156117e45750600c5482105b156117f05750806118e5565b600061180c6064611351600f54876118ee90919063ffffffff16565b90506118188185611c05565b9350600c5484111561182e57600c549150611832565b8391505b506118e5565b6000821180156118545750600c54611851906005611901565b82105b1561185e57505050565b60008211801561187a5750600c54611877906005611901565b82115b80156118875750600c5482105b156118a157600c5461189a906005611901565b90506118e5565b60006118bd6064611351600f54876118ee90919063ffffffff16565b90506118c98185611c05565b9350600c548411156118df57600c5491506118e3565b8391505b505b610e0f816114ae565b60006118fa8284611b44565b9392505050565b60006118fa8284611b5b565b60006020808352835180602085015260005b8181101561193b5785810183015185820160400152820161191f565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461093457600080fd5b6000806040838503121561198457600080fd5b823561198f8161195c565b946020939093013593505050565b6000806000606084860312156119b257600080fd5b83356119bd8161195c565b925060208401356119cd8161195c565b929592945050506040919091013590565b6000602082840312156119f057600080fd5b81356118fa8161195c565b60008060408385031215611a0e57600080fd5b50508035926020909101359150565b801515811461093457600080fd5b60008060408385031215611a3e57600080fd5b8235611a498161195c565b91506020830135611a5981611a1d565b809150509250929050565b600060208284031215611a7657600080fd5b5035919050565b60008060408385031215611a9057600080fd5b8235611a9b8161195c565b91506020830135611a598161195c565b600181811c90821680611abf57607f821691505b602082108103611adf57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611af757600080fd5b5051919050565b600060208284031215611b1057600080fd5b81516118fa81611a1d565b634e487b7160e01b600052601160045260246000fd5b8082018082111561066157610661611b1b565b808202811582820484141761066157610661611b1b565b600082611b7857634e487b7160e01b600052601260045260246000fd5b500490565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b8181038181111561066157610661611b1b565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c4057600080fd5b81516118fa8161195c565b600060a08201878352602087602085015260a0604085015281875180845260c08601915060208901935060005b81811015611c9d5784516001600160a01b031683529383019391830191600101611c78565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220605f80474180cf84725c6186e27cd4c1265dd3eb970f5d1dd382fbe04d24ea0d64736f6c63430008170033
6080604052600436106101db5760003560e01c806389291a8f11610102578063c8c8ebe411610095578063e2f4560511610064578063e2f456051461055a578063f2fde38b14610570578063f8b45b0514610590578063fb201b1d146105a657600080fd5b8063c8c8ebe4146104f8578063cf9522fd1461050e578063dd62ed3e14610524578063dd8546521461054457600080fd5b8063a457c2d7116100d1578063a457c2d714610478578063a9059cbb14610498578063afa4f3b2146104b8578063b70143c9146104d857600080fd5b806389291a8f146104105780638da5cb5b1461042557806395d89b41146104435780639a7a23d61461045857600080fd5b8063313ce5671161017a57806352f7c9881161014957806352f7c98814610359578063583e05681461037957806370a08231146103c5578063715018a6146103fb57600080fd5b8063313ce567146102c4578063346cc7be146102e057806339509351146103005780634fbee1931461032057600080fd5b806318160ddd116101b657806318160ddd1461025857806323b872dd14610277578063284f289914610297578063311028af146102ae57600080fd5b806299d386146101e757806306fdde0314610216578063095ea7b31461023857600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50600d546102019060ff1681565b60405190151581526020015b60405180910390f35b34801561022257600080fd5b5061022b6105bb565b60405161020d919061190d565b34801561024457600080fd5b50610201610253366004611971565b61064d565b34801561026457600080fd5b506002545b60405190815260200161020d565b34801561028357600080fd5b5061020161029236600461199d565b610667565b3480156102a357600080fd5b506102ac61068b565b005b3480156102ba57600080fd5b5061026960095481565b3480156102d057600080fd5b506040516012815260200161020d565b3480156102ec57600080fd5b506102ac6102fb3660046119de565b6106a9565b34801561030c57600080fd5b5061020161031b366004611971565b6107ff565b34801561032c57600080fd5b5061020161033b3660046119de565b6001600160a01b031660009081526010602052604090205460ff1690565b34801561036557600080fd5b506102ac6103743660046119fb565b610821565b34801561038557600080fd5b506103ad7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b03909116815260200161020d565b3480156103d157600080fd5b506102696103e03660046119de565b6001600160a01b031660009081526020819052604090205490565b34801561040757600080fd5b506102ac61088b565b34801561041c57600080fd5b506102ac61089f565b34801561043157600080fd5b506005546001600160a01b03166103ad565b34801561044f57600080fd5b5061022b610937565b34801561046457600080fd5b506102ac610473366004611a2b565b610946565b34801561048457600080fd5b50610201610493366004611971565b6109e0565b3480156104a457600080fd5b506102016104b3366004611971565b610a5b565b3480156104c457600080fd5b506102ac6104d3366004611a64565b610a69565b3480156104e457600080fd5b506102ac6104f3366004611a64565b610a89565b34801561050457600080fd5b50610269600a5481565b34801561051a57600080fd5b50610269600f5481565b34801561053057600080fd5b5061026961053f366004611a7d565b610b5f565b34801561055057600080fd5b50610269600e5481565b34801561056657600080fd5b50610269600c5481565b34801561057c57600080fd5b506102ac61058b3660046119de565b610b8a565b34801561059c57600080fd5b50610269600b5481565b3480156105b257600080fd5b506102ac610c00565b6060600380546105ca90611aab565b80601f01602080910402602001604051908101604052809291908181526020018280546105f690611aab565b80156106435780601f1061061857610100808354040283529160200191610643565b820191906000526020600020905b81548152906001019060200180831161062657829003601f168201915b5050505050905090565b60003361065b818585610c17565b60019150505b92915050565b600033610675858285610d3b565b610680858585610daf565b506001949350505050565b6106936113ae565b600061069e60025490565b600a819055600b5550565b6007546001600160a01b0316336001600160a01b0316146106c957600080fd5b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610712573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107369190611ae5565b9050600081116107825760405162461bcd60e51b81526020600482015260126024820152712737903a37b5b2b739903a379031b632b0b960711b60448201526064015b60405180910390fd5b60075460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb906044016020604051808303816000875af11580156107d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f99190611afe565b50505050565b60003361065b8185856108128383610b5f565b61081c9190611b31565b610c17565b6108296113ae565b6028821115801561083b575060328111155b6108805760405162461bcd60e51b8152602060048201526016602482015275466565732063616e6e6f74206578636565642039392560501b6044820152606401610779565b600e91909155600f55565b6108936113ae565b61089d6000611408565b565b6007546001600160a01b0316336001600160a01b0316146108bf57600080fd5b600047116109085760405162461bcd60e51b81526020600482015260166024820152752a37b5b2b71d1037379022aa24103a379031b632b0b960511b6044820152606401610779565b60405133904780156108fc02916000818181858888f19350505050158015610934573d6000803e3d6000fd5b50565b6060600480546105ca90611aab565b61094e6113ae565b6006546001600160a01b03908116908316036109d25760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610779565b6109dc828261145a565b5050565b600033816109ee8286610b5f565b905083811015610a4e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610779565b6106808286868403610c17565b60003361065b818585610daf565b610a716113ae565b610a8381670de0b6b3a7640000611b44565b600c5550565b6007546001600160a01b0316336001600160a01b031614610aa957600080fd5b6000610ab460025490565b306000908152602081905260408120549192506064849003610ad7575080610afa565b6064610ae38585611b44565b610aed9190611b5b565b905081811115610afa5750805b81811115610b565760405162461bcd60e51b8152602060048201526024808201527f5377617020616d6f756e74206578636565647320636f6e74726163742062616c604482015263616e636560e01b6064820152608401610779565b6107f9816114ae565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610b926113ae565b6001600160a01b038116610bf75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610779565b61093481611408565b610c086113ae565b600d805460ff19166001179055565b6001600160a01b038316610c795760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610779565b6001600160a01b038216610cda5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610779565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610d478484610b5f565b905060001981146107f95781811015610da25760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610779565b6107f98484848403610c17565b6001600160a01b038316610dd55760405162461bcd60e51b815260040161077990611b7d565b6001600160a01b038216610dfb5760405162461bcd60e51b815260040161077990611bc2565b80600003610e1457610e0f83836000611675565b505050565b6001600160a01b03831660009081526012602052604081205460ff16158015610e5657506001600160a01b03831660009081526012602052604090205460ff16155b9050610e6a6005546001600160a01b031690565b6001600160a01b0316846001600160a01b031614158015610e9957506005546001600160a01b03848116911614155b8015610ead57506001600160a01b03831615155b8015610ec457506001600160a01b03831661dead14155b8015610eda5750600854600160a01b900460ff16155b156111d357600d5460ff16610f6d576001600160a01b03841660009081526010602052604090205460ff1680610f2857506001600160a01b03831660009081526010602052604090205460ff165b610f6d5760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610779565b6001600160a01b03841660009081526012602052604090205460ff168015610fae57506001600160a01b03831660009081526011602052604090205460ff16155b1561109257600a548211156110235760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610779565b600b546001600160a01b0384166000908152602081905260409020546110499084611b31565b111561108d5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610779565b6111d3565b6001600160a01b03831660009081526012602052604090205460ff1680156110d357506001600160a01b03841660009081526011602052604090205460ff16155b1561114957600a5482111561108d5760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610779565b6001600160a01b03831660009081526011602052604090205460ff166111d357600b546001600160a01b03841660009081526020819052604090205461118f9084611b31565b11156111d35760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610779565b306000908152602081905260408120549081158015906111f1575082155b905080801561120a5750600854600160a01b900460ff16155b801561122f57506001600160a01b03861660009081526012602052604090205460ff16155b801561125457506001600160a01b03861660009081526010602052604090205460ff16155b801561127957506001600160a01b03851660009081526010602052604090205460ff16155b156112a8576008805460ff60a01b1916600160a01b17905561129a8461179f565b6008805460ff60a01b191690555b600854600090600160a01b900460ff161580156112c3575083155b6001600160a01b03881660009081526010602052604090205490915060ff168061130557506001600160a01b03861660009081526010602052604090205460ff165b1561130e575060005b60008115611399576001600160a01b03871660009081526012602052604090205460ff161561135e576113576064611351600f54896118ee90919063ffffffff16565b90611901565b905061137b565b6113786064611351600e54896118ee90919063ffffffff16565b90505b801561138c5761138c883083611675565b6113968187611c05565b95505b6113a4888888611675565b5050505050505050565b6005546001600160a01b0316331461089d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610779565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216600081815260126020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106114e3576114e3611c18565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115859190611c2e565b8160018151811061159857611598611c18565b60200260200101906001600160a01b031690816001600160a01b0316815250506115e3307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610c17565b60085460405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81169263791ac9479261163f928792600092889291909116904290600401611c4b565b600060405180830381600087803b15801561165957600080fd5b505af115801561166d573d6000803e3d6000fd5b505050505050565b6001600160a01b03831661169b5760405162461bcd60e51b815260040161077990611b7d565b6001600160a01b0382166116c15760405162461bcd60e51b815260040161077990611bc2565b6001600160a01b038316600090815260208190526040902054818110156117395760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610779565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36107f9565b30600090815260208190526040812054908181036117bc57505050565b600f54600e546117cc9190611b31565b600003611838576000821180156117e45750600c5482105b156117f05750806118e5565b600061180c6064611351600f54876118ee90919063ffffffff16565b90506118188185611c05565b9350600c5484111561182e57600c549150611832565b8391505b506118e5565b6000821180156118545750600c54611851906005611901565b82105b1561185e57505050565b60008211801561187a5750600c54611877906005611901565b82115b80156118875750600c5482105b156118a157600c5461189a906005611901565b90506118e5565b60006118bd6064611351600f54876118ee90919063ffffffff16565b90506118c98185611c05565b9350600c548411156118df57600c5491506118e3565b8391505b505b610e0f816114ae565b60006118fa8284611b44565b9392505050565b60006118fa8284611b5b565b60006020808352835180602085015260005b8181101561193b5785810183015185820160400152820161191f565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461093457600080fd5b6000806040838503121561198457600080fd5b823561198f8161195c565b946020939093013593505050565b6000806000606084860312156119b257600080fd5b83356119bd8161195c565b925060208401356119cd8161195c565b929592945050506040919091013590565b6000602082840312156119f057600080fd5b81356118fa8161195c565b60008060408385031215611a0e57600080fd5b50508035926020909101359150565b801515811461093457600080fd5b60008060408385031215611a3e57600080fd5b8235611a498161195c565b91506020830135611a5981611a1d565b809150509250929050565b600060208284031215611a7657600080fd5b5035919050565b60008060408385031215611a9057600080fd5b8235611a9b8161195c565b91506020830135611a598161195c565b600181811c90821680611abf57607f821691505b602082108103611adf57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611af757600080fd5b5051919050565b600060208284031215611b1057600080fd5b81516118fa81611a1d565b634e487b7160e01b600052601160045260246000fd5b8082018082111561066157610661611b1b565b808202811582820484141761066157610661611b1b565b600082611b7857634e487b7160e01b600052601260045260246000fd5b500490565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b8181038181111561066157610661611b1b565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c4057600080fd5b81516118fa8161195c565b600060a08201878352602087602085015260a0604085015281875180845260c08601915060208901935060005b81811015611c9d5784516001600160a01b031683529383019391830191600101611c78565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220605f80474180cf84725c6186e27cd4c1265dd3eb970f5d1dd382fbe04d24ea0d64736f6c63430008170033
{{ "language": "Solidity", "sources": { "src/MBCLUB.sol": { "content": "\n/*\nPepe, Brett, Landwolf, and Andy stumbled upon a hidden, glowing cave in a forgotten forest. They drank from a mysterious cauldron, instantly transforming into bizarre, grotesque forms... \nMeet their new identities: the Mutant Boy's Club.\n\nLAUNCHING FRIDAY 12th JULY - 1pm UTC\n\nhttps://mutantboysclub.xyz/\nhttps://x.com/boysclubmutant\nhttps://t.me/mutantboysclub\n\nBe aware of the many copycats/scams, the official CA will ​be deployed by 0xbfbCdD04DDa68cfCFBa2d687fFCe365fD46d5F5F\n*/\n\npragma solidity ^0.8.23;\npragma experimental ABIEncoderV2;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n\ninterface IUniswapV2Router02 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n )\n external\n returns (\n uint256 amountA,\n uint256 amountB,\n uint256 liquidity\n );\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (\n uint256 amountToken,\n uint256 amountETH,\n uint256 liquidity\n );\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n\ninterface IUniswapV2Pair {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (\n uint112 reserve0,\n uint112 reserve1,\n uint32 blockTimestampLast\n );\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB)\n external\n view\n returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(address tokenA, address tokenB)\n external\n returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n\nlibrary SafeMath {\n\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n\ninterface IERC20 {\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n\ninterface IERC20Metadata is IERC20 {\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n}\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n\ncontract MBCLUB is ERC20, Ownable {\n\n using SafeMath for uint256;\n \n IUniswapV2Router02 public immutable _uniswapV2Router;\n address private uniswapV2Pair;\n address private deployerWallet;\n address private marketingWallet;\n address private constant deadAddress = address(0xdead);\n\n bool private swapping;\n\n string private constant _name = \"Mutant Boys Club\";\n string private constant _symbol = \"MBCLUB\";\n\n uint256 public initialTotalSupply = 420_690_000_000 * 1e18;\n uint256 public maxTransactionAmount = 8_413_800_000 * 1e18;\n uint256 public maxWallet = 8_413_800_000 * 1e18;\n uint256 public swapTokensAtAmount = 4_206_900_000 * 1e18;\n\n bool public enableTrade = false;\n\n uint256 public BuyFee = 20;\n uint256 public SellFee = 35;\n\n mapping(address => bool) private _isExcludedFromFees;\n mapping(address => bool) private _isExcludedMaxTransactionAmount;\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n constructor() ERC20(_name, _symbol) {\n\n _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n excludeFromMaxTransaction(address(uniswapV2Pair), true);\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n marketingWallet = payable(_msgSender()); \n \n deployerWallet = payable(_msgSender());\n excludeFromFees(owner(), true);\n excludeFromFees(address(this), true);\n excludeFromFees(address(_msgSender()), true);\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(owner(), true);\n excludeFromMaxTransaction(address(this), true);\n excludeFromMaxTransaction(address(_msgSender()), true);\n excludeFromMaxTransaction(address(0xdead), true);\n\n uint devTx = initialTotalSupply.mul(88).div(100);\n uint remain = initialTotalSupply.sub(devTx);\n\n _mint(deployerWallet, devTx);\n _mint(address(this),remain);\n\n }\n\n receive() external payable {}\n\n function openTrade() external onlyOwner() {\n enableTrade = true;\n }\n\n function excludeFromMaxTransaction(address updAds, bool isEx) private {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function excludeFromFees(address account, bool excluded) private {\n _isExcludedFromFees[account] = excluded;\n emit ExcludeFromFees(account, excluded);\n }\n\n function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {\n require(pair != uniswapV2Pair, \"The pair cannot be removed from automatedMarketMakerPairs\");\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n }\n\n function _transfer(address from, address to, uint256 amount) internal override {\n\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n return;\n }\n \n bool isTransfer = !automatedMarketMakerPairs[from] && !automatedMarketMakerPairs[to];\n\n if (from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping) {\n\n if (!enableTrade) {\n require(_isExcludedFromFees[from] || _isExcludedFromFees[to], \"Trading is not active.\");\n }\n\n if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) {\n require(amount <= maxTransactionAmount, \"Buy transfer amount exceeds the maxTransactionAmount.\");\n require(amount + balanceOf(to) <= maxWallet, \"Max wallet exceeded\");\n }\n\n else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {\n require(amount <= maxTransactionAmount, \"Sell transfer amount exceeds the maxTransactionAmount.\");\n } \n \n else if (!_isExcludedMaxTransactionAmount[to]) {\n require(amount + balanceOf(to) <= maxWallet, \"Max wallet exceeded\");\n }\n \n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance > 0 && !isTransfer;\n\n if (canSwap && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to]) {\n swapping = true;\n swapBack(amount);\n swapping = false;\n }\n\n bool takeFee = !swapping && !isTransfer;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to]) {\n fees = amount.mul(SellFee).div(100);\n }\n else {\n fees = amount.mul(BuyFee).div(100);\n }\n\n if (fees > 0) {\n super._transfer(from, address(this), fees);\n }\n amount -= fees;\n }\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = _uniswapV2Router.WETH();\n\n _approve(address(this), address(_uniswapV2Router), tokenAmount);\n\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n }\n\n function removeSkullLimits() external onlyOwner {\n uint256 totalSupplyAmount = totalSupply();\n maxTransactionAmount = totalSupplyAmount;\n maxWallet = totalSupplyAmount;\n }\n\n function clearStuckEth() external {\n require(_msgSender() == deployerWallet);\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function clearStuckTokens(address tokenAddress) external {\n require(_msgSender() == deployerWallet);\n IERC20 tokenContract = IERC20(tokenAddress);\n uint256 balance = tokenContract.balanceOf(address(this));\n require(balance > 0, \"No tokens to clear\");\n tokenContract.transfer(deployerWallet, balance);\n }\n\n function setFee(uint256 _buyFee, uint256 _sellFee) external onlyOwner {\n require(_buyFee <= 40 && _sellFee <= 50, \"Fees cannot exceed 99%\");\n BuyFee = _buyFee;\n SellFee = _sellFee;\n }\n\n function setSwapTokensAtAmount(uint256 _amount) external onlyOwner {\n swapTokensAtAmount = _amount * (10 ** 18);\n }\n\n function manualSwap(uint256 percent) external {\n require(_msgSender() == deployerWallet);\n uint256 totalSupplyAmount = totalSupply();\n uint256 contractBalance = balanceOf(address(this));\n uint256 tokensToSwap;\n\n if (percent == 100) {\n tokensToSwap = contractBalance;\n } else {\n tokensToSwap = totalSupplyAmount * percent / 100;\n if (tokensToSwap > contractBalance) {\n tokensToSwap = contractBalance;\n }\n }\n\n require(tokensToSwap <= contractBalance, \"Swap amount exceeds contract balance\");\n swapTokensForEth(tokensToSwap);\n }\n\n function swapBack(uint256 tokens) private {\n uint256 contractBalance = balanceOf(address(this));\n uint256 tokensToSwap; \n\n if (contractBalance == 0) {\n return;\n }\n\n if ((BuyFee+SellFee) == 0) {\n\n if(contractBalance > 0 && contractBalance < swapTokensAtAmount) {\n tokensToSwap = contractBalance;\n }\n else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n tokens -= sellFeeTokens;\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n }\n else {\n tokensToSwap = tokens;\n }\n }\n }\n\n else {\n\n if(contractBalance > 0 && contractBalance < swapTokensAtAmount.div(5)) {\n return;\n }\n else if (contractBalance > 0 && contractBalance > swapTokensAtAmount.div(5) && contractBalance < swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount.div(5);\n }\n else {\n uint256 sellFeeTokens = tokens.mul(SellFee).div(100);\n tokens -= sellFeeTokens;\n if (tokens > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n } else {\n tokensToSwap = tokens;\n }\n }\n }\n swapTokensForEth(tokensToSwap);\n }\n\n \n}" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} } }}
1
20,290,317
8b172a8c851f5f0e0dd851b5efabd128aaaaabbc039f7c9c201a42a48a02b509
7d3601cda2c872bc9e0f24b20852edd292647bf71c49cb42b0d72f9e08305815
bfbcdd04dda68cfcfba2d687ffce365fd46d5f5f
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
c2aa158a12192fe8dec449651bf36941d4c6a2bd
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,318
0a4ad47505a89cb32a22af333fe946974aac4cdd489ce1ec890d0c2229bba270
ac2a8381438df55585b153eb689a16993c3aa179ea1daedf588e453fb35f1a04
7ca4f790018c6ac00d392ff6e1b59a3329e352e4
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
d6b607ce86c0a92e4a6042d8acbdbff7c86a785f
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,318
0a4ad47505a89cb32a22af333fe946974aac4cdd489ce1ec890d0c2229bba270
2e738d9fdfd55d047abdc9e8ec7744b004288ebffa8d651dc300b66123bcaa05
54c1c72df0ab9934ae0144155ecad3f0b66e5155
54c1c72df0ab9934ae0144155ecad3f0b66e5155
35fedfe99bf42919755870ddedd9caf6c9a82b48
60a06040523480156200001157600080fd5b506040516200229e3803806200229e83398101604081905262000034916200006e565b6001600160a01b0381166200005c576040516302f4924160e51b815260040160405180910390fd5b6001600160a01b0316608052620000a0565b6000602082840312156200008157600080fd5b81516001600160a01b03811681146200009957600080fd5b9392505050565b6080516121e2620000bc600039600061093101526121e26000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c8063674032b8116100cd578063b69ef8a811610081578063dff01deb11610066578063dff01deb146102f9578063e14a30e61461033c578063fc0c546a1461036357600080fd5b8063b69ef8a8146102de578063d547741f146102e657600080fd5b8063853828b6116100b2578063853828b6146102bb57806391d14854146102c3578063a217fddf146102d657600080fd5b8063674032b81461029557806370a08231146102a857600080fd5b80632f2ff15d1161012457806336568abe1161010957806336568abe1461025c5780633c66fe681461026f578063485cc9551461028257600080fd5b80632f2ff15d1461022257806335f6fb871461023557600080fd5b806301ffc9a714610156578063124f52011461017e57806316f0115b14610193578063248a9ca3146101f1575b600080fd5b610169610164366004611f1f565b6103a0565b60405190151581526020015b60405180910390f35b61019161018c366004611f61565b610439565b005b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4a5473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610175565b6102146101ff366004611f83565b60009081526020819052604090206001015490565b604051908152602001610175565b610191610230366004611fbe565b6104f7565b6102147f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f81565b61019161026a366004611fbe565b610522565b61019161027d366004611f83565b61057b565b610191610290366004611fee565b610811565b6101916102a3366004611fbe565b610c12565b6102146102b636600461201c565b610d4e565b610191610d98565b6101696102d1366004611fbe565b610e93565b610214600081565b610214610f14565b6101916102f4366004611fbe565b610f43565b61030c610307366004611f83565b610f68565b6040805182516fffffffffffffffffffffffffffffffff9081168252602093840151169281019290925201610175565b6102147f49cf9bb579052dad400f02031bdd7fb5ee6f0b8520e1055ddea5b5c2bd6caf0b81565b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff166101cc565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061043357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600161046d7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b67ffffffffffffffff1610156104af576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f6104d981610ff6565b6104e38383611000565b90935091506104f283836111eb565b505050565b60008281526020819052604090206001015461051281610ff6565b61051c83836112f0565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610571576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104f282826113c7565b60016105af7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b67ffffffffffffffff1610156105f1576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f49cf9bb579052dad400f02031bdd7fb5ee6f0b8520e1055ddea5b5c2bd6caf0b61061b81610ff6565b604080518082018252600080825260209182018190528481527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b882528290208251808401909352546fffffffffffffffffffffffffffffffff80821680855270010000000000000000000000000000000090920416918301919091521580156106b8575060208101516fffffffffffffffffffffffffffffffff16155b156106f7576040517fd9f3f7b1000000000000000000000000000000000000000000000000000000008152600481018490526024015b60405180910390fd5b602081015181516107089190612068565b6fffffffffffffffffffffffffffffffff166107427f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65490565b101561077d576040517f4351fa0d000000000000000000000000000000000000000000000000000000008152600481018490526024016106ee565b6107b381600001516fffffffffffffffffffffffffffffffff1682602001516fffffffffffffffffffffffffffffffff166111eb565b60008381527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b8602052604081205560405183907f4c6989bc6f46356e229b673b390d22269cb986ea211eb0c4f082012d6c1582f490600090a2505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546002919068010000000000000000900460ff16806108605750805467ffffffffffffffff808416911610155b15610897576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80547fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001667ffffffffffffffff831617680100000000000000001781556108df6000326112f0565b5061090a7f49cf9bb579052dad400f02031bdd7fb5ee6f0b8520e1055ddea5b5c2bd6caf0b846112f0565b506109557f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f7f00000000000000000000000000000000000000000000000000000000000000006112f0565b507f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915573ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a269190612098565b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691821790556040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8681166024830152919091169063dd62ed3e90604401602060405180830381865afa158015610afd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2191906120b5565b600003610ba857610ba8847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610b8b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16919061145d565b80547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020015b60405180910390a150505050565b6001610c467ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b67ffffffffffffffff161015610c88576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f610cb281610ff6565b610d14333085610cf67f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1692919061150d565b610d1e8383611596565b60405183907f544e668bbe767cde49bd57b791c5511ab932d6a373f42a04237c509af06befd790600090a2505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b96020526040812054610433565b3360009081527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b9602052604081205490819003610e01576040517fd0d04f6000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b96020526040812055610e903382610e737f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1691906116c4565b50565b600082158015610ed557508173ffffffffffffffffffffffffffffffffffffffff16610ebd611702565b73ffffffffffffffffffffffffffffffffffffffff16145b80610f0d575060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b9392505050565b6000610f3e7f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65490565b905090565b600082815260208190526040902060010154610f5e81610ff6565b61051c83836113c7565b604080518082018252600080825260208083018290528351808501855282815281018290528482527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b88152908390208351808501909452546fffffffffffffffffffffffffffffffff8082168552700100000000000000000000000000000000909104169083015290610433565b610e90813361172c565b600080600061100f858561178b565b91945092509050600061102283856120ce565b905081801561106757507f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b75473ffffffffffffffffffffffffffffffffffffffff1615155b1561118b577f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65460009061109c9083906120e1565b60007f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b68190557f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b75473ffffffffffffffffffffffffffffffffffffffff1681527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b960205260408120805492935083929091906111399084906120ce565b90915550507f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b780547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055506111e1565b807f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b560010160008282546111bf91906120e1565b909155506111e190506111d285886120e1565b6111dc85886120e1565b611864565b50505b9250929050565b811580156111f7575080155b15611200575050565b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4a5473ffffffffffffffffffffffffffffffffffffffff166040517f413a0f4b000000000000000000000000000000000000000000000000000000008152600481018490526024810183905273ffffffffffffffffffffffffffffffffffffffff919091169063413a0f4b90604401600060405180830381600087803b1580156112a957600080fd5b505af11580156112bd573d6000803e3d6000fd5b50506040518492507f6d6c62c4853ee2ccc569c1d81b83de5d128716d2ebfb6f0c1dedade7323c67eb9150600090a25050565b60006112fc8383610e93565b6113bf5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561135d3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610433565b506000610433565b60006113d38383610e93565b156113bf5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610433565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156114d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f791906120b5565b905061051c848461150885856120ce565b61195f565b60405173ffffffffffffffffffffffffffffffffffffffff848116602483015283811660448301526064820183905261051c9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611a33565b817f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b560010160008282546115ca91906120ce565b909155505073ffffffffffffffffffffffffffffffffffffffff8116156116c0577f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b75473ffffffffffffffffffffffffffffffffffffffff1661168e577f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6040517f54c54af100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b60405173ffffffffffffffffffffffffffffffffffffffff8381166024830152604482018390526104f291859182169063a9059cbb9060640161154f565b6000610f3e7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c13205490565b6117368282610e93565b6116c0576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602481018390526044016106ee565b600080600080600061179d8787611ac9565b91509150816117c957507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b7f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65481116118025786866001945094509450505061185d565b7f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65461182f908883611af0565b9450847f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b56001015403935050505b9250925092565b8115158061187157508015155b156116c0576000806118b684847f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b580549060006118ad836120f4565b91905055611beb565b91509150806118e27f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b590565b60008481526003919091016020908152604091829020835193909101516fffffffffffffffffffffffffffffffff90811670010000000000000000000000000000000002931692909217909155517f7a6e48f1a6a33adfbffb7990ea00761cf457894986b5d062d5b4bc584972377190610c049084815260200190565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790526119eb8482611cfd565b61051c5760405173ffffffffffffffffffffffffffffffffffffffff848116602483015260006044830152611a2d91869182169063095ea7b39060640161154f565b61051c84825b6000611a5573ffffffffffffffffffffffffffffffffffffffff841683611dbf565b90508051600014158015611a7a575080806020019051810190611a78919061212c565b155b156104f2576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016106ee565b60008083830184811015611ae45760008092509250506111e4565b60019590945092505050565b6000838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098281108382030391505080600003611b4557838281611b3b57611b3b61214e565b0492505050610f0d565b808411611b7e576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60408051808201825260008082526020808301829052835190810185905292830186905260608301859052916080016040516020818303038152906040528051906020012091506fffffffffffffffffffffffffffffffff8016851115611c81576040517fd7c91dc2000000000000000000000000000000000000000000000000000000008152600481018690526024016106ee565b6fffffffffffffffffffffffffffffffff841115611cce576040517fd7c91dc2000000000000000000000000000000000000000000000000000000008152600481018590526024016106ee565b50604080518082019091526fffffffffffffffffffffffffffffffff9485168152929093166020830152509091565b60008060008473ffffffffffffffffffffffffffffffffffffffff1684604051611d27919061217d565b6000604051808303816000865af19150503d8060008114611d64576040519150601f19603f3d011682016040523d82523d6000602084013e611d69565b606091505b5091509150818015611d93575080511580611d93575080806020019051810190611d93919061212c565b8015611db6575060008573ffffffffffffffffffffffffffffffffffffffff163b115b95945050505050565b6060610f0d83836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051611df2919061217d565b60006040518083038185875af1925050503d8060008114611e2f576040519150601f19603f3d011682016040523d82523d6000602084013e611e34565b606091505b5091509150611e44868383611e4e565b9695505050505050565b606082611e6357611e5e82611edd565b610f0d565b8151158015611e87575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611ed6576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016106ee565b5080610f0d565b805115611eed5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215611f3157600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f0d57600080fd5b60008060408385031215611f7457600080fd5b50508035926020909101359150565b600060208284031215611f9557600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610e9057600080fd5b60008060408385031215611fd157600080fd5b823591506020830135611fe381611f9c565b809150509250929050565b6000806040838503121561200157600080fd5b823561200c81611f9c565b91506020830135611fe381611f9c565b60006020828403121561202e57600080fd5b8135610f0d81611f9c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6fffffffffffffffffffffffffffffffff81811683821601908082111561209157612091612039565b5092915050565b6000602082840312156120aa57600080fd5b8151610f0d81611f9c565b6000602082840312156120c757600080fd5b5051919050565b8082018082111561043357610433612039565b8181038181111561043357610433612039565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361212557612125612039565b5060010190565b60006020828403121561213e57600080fd5b81518015158114610f0d57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000825160005b8181101561219e5760208186018101518583015201612184565b50600092019182525091905056fea264697066735822122010ea5a1299991c67b3366685e4716a48bb8e3ce923f41ccec20feb57f2f3945464736f6c63430008160033000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e1
608060405234801561001057600080fd5b50600436106101515760003560e01c8063674032b8116100cd578063b69ef8a811610081578063dff01deb11610066578063dff01deb146102f9578063e14a30e61461033c578063fc0c546a1461036357600080fd5b8063b69ef8a8146102de578063d547741f146102e657600080fd5b8063853828b6116100b2578063853828b6146102bb57806391d14854146102c3578063a217fddf146102d657600080fd5b8063674032b81461029557806370a08231146102a857600080fd5b80632f2ff15d1161012457806336568abe1161010957806336568abe1461025c5780633c66fe681461026f578063485cc9551461028257600080fd5b80632f2ff15d1461022257806335f6fb871461023557600080fd5b806301ffc9a714610156578063124f52011461017e57806316f0115b14610193578063248a9ca3146101f1575b600080fd5b610169610164366004611f1f565b6103a0565b60405190151581526020015b60405180910390f35b61019161018c366004611f61565b610439565b005b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4a5473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610175565b6102146101ff366004611f83565b60009081526020819052604090206001015490565b604051908152602001610175565b610191610230366004611fbe565b6104f7565b6102147f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f81565b61019161026a366004611fbe565b610522565b61019161027d366004611f83565b61057b565b610191610290366004611fee565b610811565b6101916102a3366004611fbe565b610c12565b6102146102b636600461201c565b610d4e565b610191610d98565b6101696102d1366004611fbe565b610e93565b610214600081565b610214610f14565b6101916102f4366004611fbe565b610f43565b61030c610307366004611f83565b610f68565b6040805182516fffffffffffffffffffffffffffffffff9081168252602093840151169281019290925201610175565b6102147f49cf9bb579052dad400f02031bdd7fb5ee6f0b8520e1055ddea5b5c2bd6caf0b81565b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff166101cc565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061043357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600161046d7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b67ffffffffffffffff1610156104af576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f6104d981610ff6565b6104e38383611000565b90935091506104f283836111eb565b505050565b60008281526020819052604090206001015461051281610ff6565b61051c83836112f0565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610571576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104f282826113c7565b60016105af7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b67ffffffffffffffff1610156105f1576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f49cf9bb579052dad400f02031bdd7fb5ee6f0b8520e1055ddea5b5c2bd6caf0b61061b81610ff6565b604080518082018252600080825260209182018190528481527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b882528290208251808401909352546fffffffffffffffffffffffffffffffff80821680855270010000000000000000000000000000000090920416918301919091521580156106b8575060208101516fffffffffffffffffffffffffffffffff16155b156106f7576040517fd9f3f7b1000000000000000000000000000000000000000000000000000000008152600481018490526024015b60405180910390fd5b602081015181516107089190612068565b6fffffffffffffffffffffffffffffffff166107427f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65490565b101561077d576040517f4351fa0d000000000000000000000000000000000000000000000000000000008152600481018490526024016106ee565b6107b381600001516fffffffffffffffffffffffffffffffff1682602001516fffffffffffffffffffffffffffffffff166111eb565b60008381527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b8602052604081205560405183907f4c6989bc6f46356e229b673b390d22269cb986ea211eb0c4f082012d6c1582f490600090a2505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0080546002919068010000000000000000900460ff16806108605750805467ffffffffffffffff808416911610155b15610897576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80547fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001667ffffffffffffffff831617680100000000000000001781556108df6000326112f0565b5061090a7f49cf9bb579052dad400f02031bdd7fb5ee6f0b8520e1055ddea5b5c2bd6caf0b846112f0565b506109557f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f7f000000000000000000000000e1bf82658ea0dc05efbb1f4ff97b0412913dd2e16112f0565b507f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915573ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a269190612098565b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691821790556040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8681166024830152919091169063dd62ed3e90604401602060405180830381865afa158015610afd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2191906120b5565b600003610ba857610ba8847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610b8b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16919061145d565b80547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16815560405167ffffffffffffffff831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2906020015b60405180910390a150505050565b6001610c467ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005467ffffffffffffffff1690565b67ffffffffffffffff161015610c88576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f3fb90a982568460bdf5505b984928e3c942db3525e60c25e39051cacec08b60f610cb281610ff6565b610d14333085610cf67f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1692919061150d565b610d1e8383611596565b60405183907f544e668bbe767cde49bd57b791c5511ab932d6a373f42a04237c509af06befd790600090a2505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b96020526040812054610433565b3360009081527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b9602052604081205490819003610e01576040517fd0d04f6000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b96020526040812055610e903382610e737f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1691906116c4565b50565b600082158015610ed557508173ffffffffffffffffffffffffffffffffffffffff16610ebd611702565b73ffffffffffffffffffffffffffffffffffffffff16145b80610f0d575060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b9392505050565b6000610f3e7f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65490565b905090565b600082815260208190526040902060010154610f5e81610ff6565b61051c83836113c7565b604080518082018252600080825260208083018290528351808501855282815281018290528482527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b88152908390208351808501909452546fffffffffffffffffffffffffffffffff8082168552700100000000000000000000000000000000909104169083015290610433565b610e90813361172c565b600080600061100f858561178b565b91945092509050600061102283856120ce565b905081801561106757507f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b75473ffffffffffffffffffffffffffffffffffffffff1615155b1561118b577f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65460009061109c9083906120e1565b60007f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b68190557f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b75473ffffffffffffffffffffffffffffffffffffffff1681527f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b960205260408120805492935083929091906111399084906120ce565b90915550507f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b780547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055506111e1565b807f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b560010160008282546111bf91906120e1565b909155506111e190506111d285886120e1565b6111dc85886120e1565b611864565b50505b9250929050565b811580156111f7575080155b15611200575050565b7f4b6410d1a93cf86a6543bde66863c4848fc2f289b843f6849aaf274d7309eb4a5473ffffffffffffffffffffffffffffffffffffffff166040517f413a0f4b000000000000000000000000000000000000000000000000000000008152600481018490526024810183905273ffffffffffffffffffffffffffffffffffffffff919091169063413a0f4b90604401600060405180830381600087803b1580156112a957600080fd5b505af11580156112bd573d6000803e3d6000fd5b50506040518492507f6d6c62c4853ee2ccc569c1d81b83de5d128716d2ebfb6f0c1dedade7323c67eb9150600090a25050565b60006112fc8383610e93565b6113bf5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561135d3390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610433565b506000610433565b60006113d38383610e93565b156113bf5760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610433565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156114d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f791906120b5565b905061051c848461150885856120ce565b61195f565b60405173ffffffffffffffffffffffffffffffffffffffff848116602483015283811660448301526064820183905261051c9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611a33565b817f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b560010160008282546115ca91906120ce565b909155505073ffffffffffffffffffffffffffffffffffffffff8116156116c0577f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b75473ffffffffffffffffffffffffffffffffffffffff1661168e577f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6040517f54c54af100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b60405173ffffffffffffffffffffffffffffffffffffffff8381166024830152604482018390526104f291859182169063a9059cbb9060640161154f565b6000610f3e7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c13205490565b6117368282610e93565b6116c0576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602481018390526044016106ee565b600080600080600061179d8787611ac9565b91509150816117c957507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b7f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65481116118025786866001945094509450505061185d565b7f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b65461182f908883611af0565b9450847f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b56001015403935050505b9250925092565b8115158061187157508015155b156116c0576000806118b684847f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b580549060006118ad836120f4565b91905055611beb565b91509150806118e27f1dd85a2a5c11318d7addaa9149e011f633d2a996caa802781d2aa2aaaa2f16b590565b60008481526003919091016020908152604091829020835193909101516fffffffffffffffffffffffffffffffff90811670010000000000000000000000000000000002931692909217909155517f7a6e48f1a6a33adfbffb7990ea00761cf457894986b5d062d5b4bc584972377190610c049084815260200190565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790526119eb8482611cfd565b61051c5760405173ffffffffffffffffffffffffffffffffffffffff848116602483015260006044830152611a2d91869182169063095ea7b39060640161154f565b61051c84825b6000611a5573ffffffffffffffffffffffffffffffffffffffff841683611dbf565b90508051600014158015611a7a575080806020019051810190611a78919061212c565b155b156104f2576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016106ee565b60008083830184811015611ae45760008092509250506111e4565b60019590945092505050565b6000838302817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098281108382030391505080600003611b4557838281611b3b57611b3b61214e565b0492505050610f0d565b808411611b7e576040517f227bc15300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60408051808201825260008082526020808301829052835190810185905292830186905260608301859052916080016040516020818303038152906040528051906020012091506fffffffffffffffffffffffffffffffff8016851115611c81576040517fd7c91dc2000000000000000000000000000000000000000000000000000000008152600481018690526024016106ee565b6fffffffffffffffffffffffffffffffff841115611cce576040517fd7c91dc2000000000000000000000000000000000000000000000000000000008152600481018590526024016106ee565b50604080518082019091526fffffffffffffffffffffffffffffffff9485168152929093166020830152509091565b60008060008473ffffffffffffffffffffffffffffffffffffffff1684604051611d27919061217d565b6000604051808303816000865af19150503d8060008114611d64576040519150601f19603f3d011682016040523d82523d6000602084013e611d69565b606091505b5091509150818015611d93575080511580611d93575080806020019051810190611d93919061212c565b8015611db6575060008573ffffffffffffffffffffffffffffffffffffffff163b115b95945050505050565b6060610f0d83836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051611df2919061217d565b60006040518083038185875af1925050503d8060008114611e2f576040519150601f19603f3d011682016040523d82523d6000602084013e611e34565b606091505b5091509150611e44868383611e4e565b9695505050505050565b606082611e6357611e5e82611edd565b610f0d565b8151158015611e87575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611ed6576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016106ee565b5080610f0d565b805115611eed5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215611f3157600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f0d57600080fd5b60008060408385031215611f7457600080fd5b50508035926020909101359150565b600060208284031215611f9557600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610e9057600080fd5b60008060408385031215611fd157600080fd5b823591506020830135611fe381611f9c565b809150509250929050565b6000806040838503121561200157600080fd5b823561200c81611f9c565b91506020830135611fe381611f9c565b60006020828403121561202e57600080fd5b8135610f0d81611f9c565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6fffffffffffffffffffffffffffffffff81811683821601908082111561209157612091612039565b5092915050565b6000602082840312156120aa57600080fd5b8151610f0d81611f9c565b6000602082840312156120c757600080fd5b5051919050565b8082018082111561043357610433612039565b8181038181111561043357610433612039565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361212557612125612039565b5060010190565b60006020828403121561213e57600080fd5b81518015158114610f0d57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000825160005b8181101561219e5760208186018101518583015201612184565b50600092019182525091905056fea264697066735822122010ea5a1299991c67b3366685e4716a48bb8e3ce923f41ccec20feb57f2f3945464736f6c63430008160033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/access/AccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControl} from \"./IAccessControl.sol\";\nimport {Context} from \"../utils/Context.sol\";\nimport {ERC165} from \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account => bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n" }, "@openzeppelin/contracts/access/IAccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev The `account` is missing a role.\n */\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n /**\n * @dev The caller of a function is not the expected one.\n *\n * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n */\n error AccessControlBadConfirmation();\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n */\n function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n" }, "@openzeppelin/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Storage of the initializable contract.\n *\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n * when using with upgradeable contracts.\n *\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n */\n struct InitializableStorage {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n uint64 _initialized;\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool _initializing;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant INITIALIZABLE_STORAGE =\n 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n /**\n * @dev The contract is already initialized.\n */\n error InvalidInitialization();\n\n /**\n * @dev The contract is not initializing.\n */\n error NotInitializing();\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint64 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n * production.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n // Cache values to avoid duplicated sloads\n bool isTopLevelCall = !$._initializing;\n uint64 initialized = $._initialized;\n\n // Allowed calls:\n // - initialSetup: the contract is not in the initializing state and no previous version was\n // initialized\n // - construction: the contract is initialized at version 1 (no reininitialization) and the\n // current contract is just being deployed\n bool initialSetup = initialized == 0 && isTopLevelCall;\n bool construction = initialized == 1 && address(this).code.length == 0;\n\n if (!initialSetup && !construction) {\n revert InvalidInitialization();\n }\n $._initialized = 1;\n if (isTopLevelCall) {\n $._initializing = true;\n }\n _;\n if (isTopLevelCall) {\n $._initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint64 version) {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing || $._initialized >= version) {\n revert InvalidInitialization();\n }\n $._initialized = version;\n $._initializing = true;\n _;\n $._initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n _checkInitializing();\n _;\n }\n\n /**\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n */\n function _checkInitializing() internal view virtual {\n if (!_isInitializing()) {\n revert NotInitializing();\n }\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing) {\n revert InvalidInitialization();\n }\n if ($._initialized != type(uint64).max) {\n $._initialized = type(uint64).max;\n emit Initialized(type(uint64).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint64) {\n return _getInitializableStorage()._initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _getInitializableStorage()._initializing;\n }\n\n /**\n * @dev Returns a pointer to the storage namespace.\n */\n // solhint-disable-next-line var-name-mixedcase\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n assembly {\n $.slot := INITIALIZABLE_STORAGE\n }\n }\n}\n" }, "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n *\n * CAUTION: See Security Considerations above.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" }, "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n forceApprove(token, spender, oldAllowance + value);\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n * value, non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance < requestedDecrease) {\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n }\n forceApprove(token, spender, currentAllowance - requestedDecrease);\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Context.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" }, "@openzeppelin/contracts/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@openzeppelin/contracts/utils/math/Math.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Muldiv operation overflow.\n */\n error MathOverflowedMulDiv();\n\n enum Rounding {\n Floor, // Toward negative infinity\n Ceil, // Toward positive infinity\n Trunc, // Toward zero\n Expand // Away from zero\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds towards infinity instead\n * of rounding towards zero.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n if (b == 0) {\n // Guarantee the same behavior as in a regular Solidity division.\n return a / b;\n }\n\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n * denominator == 0.\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n * Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0 = x * y; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n if (denominator <= prod1) {\n revert MathOverflowedMulDiv();\n }\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n uint256 twos = denominator & (0 - denominator);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n // works in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n * towards zero.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n */\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}\n" }, "contracts/base/auth/AccessControlDS.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {OwnableReadonlyDS} from \"./OwnableReadonlyDS.sol\";\n\nabstract contract AccessControlDS is AccessControl, OwnableReadonlyDS {\n function hasRole(bytes32 _role, address _account) public view virtual override returns (bool) {\n return (isOwnerRole(_role) && _owner() == _account) || super.hasRole(_role, _account);\n }\n\n function isOwnerRole(bytes32 _role) private pure returns (bool) {\n return _role == DEFAULT_ADMIN_ROLE;\n }\n}\n" }, "contracts/base/auth/OwnableReadonly.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {UnauthorizedAccount} from \"contracts/interfaces/base/CommonErrors.sol\";\nimport {Address} from \"contracts/libraries/Address.sol\";\n\n/**\n * @dev We intentionally do not expose \"owner()\" publicly\n * due to possible conflicts with \"OwnershipFacet\"\n * https://github.com/mudgen/diamond-3-hardhat/blob/main/contracts/facets/OwnershipFacet.sol\n */\nabstract contract OwnableReadonly {\n using Address for bytes32;\n\n modifier onlyOwner() {\n enforceIsContractOwner();\n _;\n }\n\n function _owner() internal view returns (address) {\n return _ownerSlot().get();\n }\n\n function _ownerSlot() internal pure virtual returns (bytes32);\n\n function enforceIsContractOwner() private view {\n if (msg.sender != _owner()) revert UnauthorizedAccount(msg.sender);\n }\n}\n" }, "contracts/base/auth/OwnableReadonlyDS.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {DiamondLibrary} from \"contracts/libraries/DiamondLibrary.sol\";\nimport {OwnableReadonly} from \"./OwnableReadonly.sol\";\n\n/**\n * @notice Use DiamondStorage's owner slot for OwnableReadonly\n */\nabstract contract OwnableReadonlyDS is OwnableReadonly {\n function _ownerSlot() internal pure override returns (bytes32 slot_) {\n DiamondLibrary.DiamondStorage storage ds = DiamondLibrary.diamondStorage();\n assembly {\n // DiamondLib will not change so it's safe to hardcode owner offset here\n let ownerOffsetInDiamondStorage := 4\n slot_ := add(ds.slot, ownerOffsetInDiamondStorage)\n }\n }\n}\n" }, "contracts/interfaces/base/CommonErrors.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @notice An error indicating that the amount for the specified token is zero.\n * @param token The address of the token with a zero amount.\n */\nerror AmountMustNotBeZero(address token);\n\n/**\n * @notice An error indicating that an address must not be zero.\n */\nerror AddressMustNotBeZero();\n\n/**\n * @notice An error indicating that an array must not be empty.\n */\nerror ArrayMustNotBeEmpty();\n\n/**\n * @notice An error indicating storage is already up to date and doesn't need further processing.\n * @dev This error is thrown when attempting to update an entity(s) that is(are) already up to date.\n */\nerror AlreadyUpToDate();\n\n/**\n * @notice An error indicating that an action is unauthorized for the specified account.\n * @param account The address of the unauthorized account.\n */\nerror UnauthorizedAccount(address account);\n" }, "contracts/interfaces/liquidityManagement/insuranceFund/Debt.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @title FundDebt\n * @notice This type of debt is created following an uncovered liquidation due to rapid changes in the market.\n * @notice Authorization for this debt can be granted by the account having `DEBT_AUTHORITY` role in Insurance Fund.\n * Funds to cover such debts are accumulated from all liquidations with a surplus in tokens.\n * @dev `amount` The debt amount allocated to the Pool.\n * @dev `reward` The amount designated as a reward for Liquidity Providers in the Pool.\n */\nstruct FundDebt {\n uint128 amount;\n uint128 reward;\n}\n" }, "contracts/interfaces/liquidityManagement/insuranceFund/IFund.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IPool} from \"contracts/interfaces/liquidityManagement/liquidityPool/IPool.sol\";\nimport {FundDebt} from \"./Debt.sol\";\n\ninterface IFund {\n /**\n * @notice Emitted when tokens are supplied to the insurance fund.\n * @dev Emitted from [`supply()`](#supply).\n * @param amount The amount of tokens supplied.\n */\n event Supplied(uint256 indexed amount);\n\n /**\n * @notice Emitted when tokens are forwarded to the liquidity pool.\n * @dev Emitted from [`forward()`](#forward).\n * @param amount The amount of tokens forwarded.\n */\n event Forwarded(uint256 indexed amount);\n\n /**\n * @notice Emitted when a debt is successfully authorized and forwarded.\n * @dev Emitted from [`authorize()`](#authorize).\n * @param id The identifier of the authorized debt.\n */\n event DebtPaid(bytes32 indexed id);\n\n /**\n * @notice Error indicating that a debt with the specified ID does not exist.\n * @dev Fired from [`authorize()`](#authorize).\n */\n error DebtDoesNotExists(bytes32 id);\n\n /**\n * @notice Error indicating that the sum of the debt amount and rewards exceeds the contract's token balance.\n * @dev Fired from [`authorize()`](#authorize).\n */\n error DebtAmountExceedsBalance(bytes32 id);\n\n /**\n * @notice Error indicating that the account sent transaction has zero token balance on the contract.\n * @dev Fired from [`withdrawAll()`](#withdrawall).\n */\n error NothingToWithdraw();\n\n /**\n * @notice Allows authorized addresses to supply tokens in Insurance Fund.\n * @dev Requires `msg.sender` to have the `keccak256('FORWARDER_ROLE')` role within the fund contract,\n * otherwise, it throws an `\"AccessControl: account msg.sender is missing role keccak256('FORWARDER_ROLE')\"` error.\n * @dev Emits a [`Supplied()`](#supplied) event on successful supply.\n * @param amount of tokens to supply.\n * @param beneficiary optional address which may receive surplus from the future spending.\n */\n function supply(uint256 amount, address beneficiary) external;\n\n /**\n * @notice Allows authorized addresses to forward tokens in Liquidity Pool\n * (see [`IPool.returnAndDistribute()`](/interfaces/liquidityManagement/liquidityPool/IPool.sol/interface.IPool.html#returnanddistribute)).\n * @dev Requires `msg.sender` to have the `keccak256('FORWARDER_ROLE')` role within the fund contract,\n * otherwise, it throws an `\"AccessControl: account msg.sender is missing role keccak256('FORWARDER_ROLE')\"` error.\n * @dev Emits a [`Forwarded()`](#forwarded) event on success.\n * @param amount of token to return to liquidity pool.\n * @param rewards amount of rewards to add to liquidity pool.\n */\n function forward(uint256 amount, uint256 rewards) external;\n\n /**\n * @notice Allows authorized addresses to approve a debt and potentially [`forward()`](#forward) it.\n * @dev Throws a [`DebtDoesNotExists()`](#debtdoesnotexists) error if the corresponding `amount` and `reward` are zero.\n * @dev Throws a [`DebtAmountExceedsBalance()`](#debtamountexceedsbalance) error if the sum of `amount` and `reward` exceeds the contract's token balance.\n * @dev Emits a [`DebtPaid()`](#debtpaid) event on success.\n * @param id Identifier of the debt to authorize.\n */\n function authorize(bytes32 id) external;\n\n /**\n * @notice Allows account owner to withdraw its whole token balance.\n * @dev Throws a [`NothingToWithdraw()`](#nothingtowithdraw) error if the account has zero balance.\n */\n function withdrawAll() external;\n\n /**\n * @notice Returns contract balance.\n * @return returns The internal token balance of the contract.\n */\n function balance() external view returns (uint256);\n\n /**\n * @notice Returns account balance.\n * @param account The address of the account to check the balance of.\n * @return returns The balance of the account.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @notice Returns the details of a debt.\n * @param id Identifier of the debt.\n * @return A [`FundDebt`](../Debt.sol/struct.FundDebt.html) struct containing information about the debt.\n */\n function getDebt(bytes32 id) external view returns (FundDebt memory);\n\n /**\n * @notice Liquidity pool associated with this insurance fund.\n */\n function pool() external view returns (IPool);\n\n /**\n * @notice ERC20 token associated with the pool associated with this fund.\n */\n function token() external view returns (IERC20);\n}\n" }, "contracts/interfaces/liquidityManagement/insuranceFund/IFundInitializer.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IFundInitializer {\n error NotInitialized();\n\n function initialize(address liquidityPool, address debtAuthority) external;\n}\n" }, "contracts/interfaces/liquidityManagement/liquidityPool/IPool.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @title IPool\n * @notice Interface for a liquidity pool.\n */\ninterface IPool {\n /**\n * @notice Emitted when tokens are borrowed from the pool.\n * @param amount The amount of tokens borrowed.\n * @dev Emitted from [`borrow()`](#borrow).\n */\n event Borrowed(uint256 amount);\n\n /**\n * @notice Emitted when tokens are claimed.\n * @param recipient The address of the recipient.\n * @param amount The amount of rewards claimed.\n * @dev Emitted from [`claim()`](#claim).\n */\n event Claimed(address indexed recipient, uint256 amount);\n\n /**\n * @notice Emitted when tokens are deposited into a liquidity pool.\n * @param depositor The address of the depositor.\n * @param amount The amount of tokens deposited.\n * @dev Emitted from [`deposit()`](#deposit).\n */\n event Deposited(address indexed depositor, uint256 amount);\n\n /**\n * @notice Emitted when tokens are returned to the pool, repaying debts, and triggering an epoch switch.\n * @param distributed The amount of tokens distributed as rewards in the current epoch.\n * @param returned The amount of tokens used to repay debts.\n * @dev Emitted from [`returnAndDistribute()`](#returnanddistribute).\n */\n event Returned(uint256 returned, uint256 distributed);\n\n /**\n * @notice Emitted when tokens are withdrawn from the pool.\n * @param amount The amount of tokens withdrawn.\n * @param recipient The address of the recipient.\n * @dev Emitted from [`withdraw()`](#withdraw).\n */\n event Withdrawn(address indexed recipient, uint256 amount);\n\n /**\n * @notice Fired from [`borrow()`](#borrow).\n * @dev Error indicating that the borrower's requested amount exceeds the available balance in the pool.\n */\n error BorrowAmountExceedsBalance();\n\n /**\n * @notice Error indicating that the Merkle tree verification failed.\n * @dev Fired from [`deposit()`](#deposit).\n */\n error MerkleTreeVerificationFailed();\n\n /**\n * @notice Error indicating that the total deposit threshold has been exceeded by the user's deposit.\n * @dev Fired from [`deposit()`](#deposit).\n */\n error TotalDepositThresholdExceeded();\n\n /**\n * @notice Error indicating that there are no pending rewards for the user.\n * @dev Fired from [`claim()`](#claim).\n */\n error NoPendingRewards();\n\n /**\n * @notice Error indicating that the user is trying to withdraw an amount greater than their position's value.\n * @dev Fired from [`withdraw()`](#withdraw).\n */\n error WithdrawAmountExceedsBalance();\n\n /**\n * @notice Allows whitelisted addresses to deposit tokens into the liquidity pool.\n * @dev If verification is not disabled (see [`IMerkleTreeWhitelist.setRoot()`](/interfaces/liquidityManagement/liquidityPool/IMerkleTreeWhitelist.sol/interface.IMerkleTreeWhitelist.html#setroot)),\n * it requires a valid Merkle Proof for `msg.sender` to confirm deposit authorization.\n * @dev Throws a [`TotalDepositThresholdExceeded()`](#totaldepositthresholdexceeded) error if `amount` + `token.balanceOf(pool)` exceeds [`thresholdOnTotalDeposit()`](#thresholdontotaldeposit).\n * @dev Emits a [`Deposited()`](#deposited) event on successful deposit.\n * @param amount The amount of tokens to deposit.\n * @param permission Merkle Proof for `msg.sender`, confirming deposit authorization.\n */\n function deposit(uint128 amount, bytes32[] calldata permission) external;\n\n /**\n * @notice Allows a user to withdraw tokens from the liquidity pool.\n * @dev If the pool has a sufficient token balance, tokens will be sent immediately to the specified `recipient`.\n * Otherwise, the withdrawal amount will be added to the debt queue for processing during [`returnAndDistribute()`](#returnanddistribute).\n * @dev If `recipient` is `address(0)`, it will be changed to `msg.sender`.\n * @dev Throws a [`WithdrawAmountExceedsBalance()`](#withdrawamountexceedsbalance) error if the user has an insufficient balance.\n * @dev Emits a [`Withdrawn()`](#withdrawn) event on successful withdrawal.\n * @param amount The amount of tokens to withdraw.\n * @param recipient The address that will receive the withdrawn tokens. If `address(0)` is passed, it will be changed to `msg.sender`.\n */\n function withdraw(uint128 amount, address recipient) external;\n\n /**\n * @notice Allows a user to claim rewards earned in the liquidity pool.\n * @dev If the pool has a sufficient token balance, rewards will be sent immediately to the `recipient`.\n * Otherwise, the rewards will be added to the debt queue for processing during [`returnAndDistribute()`](#returnanddistribute).\n * @dev If `recipient` is `address(0)`, it will be changed to `msg.sender`.\n * @dev Throws a [`NoPendingRewards()`](#nopendingrewards) error if the user has no pending rewards (see [`getPendingRewards()`](#getpendingrewards)).\n * @dev Emits a [`Claimed()`](#claimed) event on successful claim.\n * @param recipient The address to receive the claimed rewards. If `address(0)` is passed, it will be changed to `msg.sender`.\n */\n function claim(address recipient) external;\n\n /**\n * @notice Allows authorized addresses to borrow tokens from the pool.\n * @dev Requires `msg.sender` to have the `keccak256('BORROWER_ROLE')` role within the pool contract,\n * otherwise, it throws an `\"AccessControl: account msg.sender is missing role keccak256('BORROWER_ROLE')\"` error.\n * @dev Throws a [`BorrowAmountExceedsBalance()`](#borrowamountexceedsbalance) error if the pool's token balance is less than the requested amount.\n * @dev Emits a [`Borrowed()`](#borrowed) event on successful borrow.\n * @param amount The amount of tokens to borrow.\n */\n function borrow(uint256 amount) external;\n\n /**\n * @notice Allows authorized addresses to deposit tokens into the liquidity pool, pay off as many debts as possible,\n * distribute rewards for the current epoch, and start a new epoch.\n * @dev Requires `msg.sender` to have the `keccak256('REPAYER_ROLE')` role within the pool contract;\n * otherwise, it throws an `\"AccessControl: account msg.sender is missing role keccak256('REPAYER_ROLE')\"` error.\n * @dev Emits a [`Returned()`](#returned) event upon successful return.\n * @param amount Amount of tokens used for debt payment.\n * @param rewards Amount of tokens to distribute as rewards for the current epoch.\n */\n function returnAndDistribute(uint256 amount, uint256 rewards) external;\n\n /**\n * @notice Returns the token address associated with the pool.\n * @return Token address.\n */\n function token() external view returns (address);\n\n /**\n * @notice Returns the current threshold on the total deposit value. The pool's token balance cannot exceed this threshold.\n * @return Current threshold value.\n */\n function thresholdOnTotalDeposit() external view returns (uint256);\n\n /**\n * @notice Returns amount of tokens currently deposited into the pool.\n * A portion of that may be allocated as leverage onto margin accounts.\n * @return Amount of deposited tokens to the pool.\n */\n function totalDeposited() external view returns (uint256);\n\n /**\n * @notice Calculates the pending rewards that a user can claim.\n * @param user address for which to calculate rewards.\n * @return rewards amount of tokens that the user can claim right now.\n */\n function getPendingRewards(address user) external view returns (uint256 rewards);\n\n /**\n * @notice Retrieves the amount of tokens owned by a user in the pool.\n * @param user address.\n * @return balance amount of tokens.\n */\n function getPositionInfo(address user) external view returns (uint256 balance);\n}\n" }, "contracts/libraries/Address.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nlibrary Address {\n address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function set(bytes32 _slot, address _value) internal {\n assembly {\n sstore(_slot, _value)\n }\n }\n\n function get(bytes32 _slot) internal view returns (address result_) {\n assembly {\n result_ := sload(_slot)\n }\n }\n\n function isEth(address _token) internal pure returns (bool) {\n return _token == ETH || _token == address(0);\n }\n\n function sort(address _a, address _b) internal pure returns (address, address) {\n return _a < _b ? (_a, _b) : (_b, _a);\n }\n\n function sort(address[4] memory _array) internal pure returns (address[4] memory _sorted) {\n // Sorting network for the array of length 4\n (_sorted[0], _sorted[1]) = sort(_array[0], _array[1]);\n (_sorted[2], _sorted[3]) = sort(_array[2], _array[3]);\n\n (_sorted[0], _sorted[2]) = sort(_sorted[0], _sorted[2]);\n (_sorted[1], _sorted[3]) = sort(_sorted[1], _sorted[3]);\n (_sorted[1], _sorted[2]) = sort(_sorted[1], _sorted[2]);\n }\n}\n" }, "contracts/libraries/DiamondLibrary.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nlibrary DiamondLibrary {\n struct FacetAddressAndPosition {\n address facetAddress;\n uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array\n }\n\n struct FacetFunctionSelectors {\n bytes4[] functionSelectors;\n uint256 facetAddressPosition; // position of facetAddress in facetAddresses array\n }\n\n struct DiamondStorage {\n // maps function selector to the facet address and\n // the position of the selector in the facetFunctionSelectors.selectors array\n mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition;\n // maps facet addresses to function selectors\n mapping(address => FacetFunctionSelectors) facetFunctionSelectors;\n // facet addresses\n address[] facetAddresses;\n // Used to query if a contract implements an interface.\n // Used to implement ERC-165.\n mapping(bytes4 => bool) supportedInterfaces;\n // owner of the contract\n address contractOwner;\n }\n\n bytes32 private constant DIAMOND_STORAGE_POSITION =\n keccak256(\"diamond.standard.diamond.storage\");\n\n function diamondStorage() internal pure returns (DiamondStorage storage ds_) {\n bytes32 position = DIAMOND_STORAGE_POSITION;\n assembly {\n ds_.slot := position\n }\n }\n}\n" }, "contracts/liquidityManagement/insuranceFund/fund/Fund.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport {IERC20, SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport {AddressMustNotBeZero} from \"contracts/interfaces/base/CommonErrors.sol\";\nimport {IFund, IPool} from \"contracts/interfaces/liquidityManagement/insuranceFund/IFund.sol\";\nimport {\n IFundInitializer\n} from \"contracts/interfaces/liquidityManagement/insuranceFund/IFundInitializer.sol\";\n\nimport {AccessControlDS} from \"contracts/base/auth/AccessControlDS.sol\";\n\nimport {FundDebt, MoneyAccountant} from \"../libraries/MoneyAccountant.sol\";\n\ncontract Fund is IFund, IFundInitializer, AccessControlDS, Initializable {\n using SafeERC20 for IERC20;\n\n struct Storage {\n IPool pool;\n IERC20 token;\n }\n\n bytes32 private constant STORAGE_SLOT = keccak256(\"Fund storage slot V1\");\n\n address private immutable forwarder;\n\n bytes32 public constant DEBT_ADMIN_ROLE = keccak256(\"DEBT_ADMIN_ROLE\");\n bytes32 public constant FORWARDER_ROLE = keccak256(\"FORWARDER_ROLE\");\n\n modifier onlyInitialized() {\n if (Initializable._getInitializedVersion() < 1) revert IFundInitializer.NotInitialized();\n _;\n }\n\n constructor(address _forwarder) {\n if (_forwarder == address(0)) revert AddressMustNotBeZero();\n forwarder = _forwarder;\n }\n\n function initialize(\n address _liquidityPool,\n address debtAdmin\n ) external override reinitializer(2) {\n _grantRole(DEFAULT_ADMIN_ROLE, tx.origin);\n _grantRole(DEBT_ADMIN_ROLE, debtAdmin);\n _grantRole(FORWARDER_ROLE, forwarder);\n\n _storage().pool = IPool(_liquidityPool);\n _storage().token = IERC20(pool().token());\n\n if (token().allowance(address(this), _liquidityPool) == 0) {\n token().safeIncreaseAllowance(_liquidityPool, type(uint256).max);\n }\n }\n\n /// @inheritdoc IFund\n function supply(\n uint256 amount,\n address beneficiary\n ) external override onlyInitialized onlyRole(FORWARDER_ROLE) {\n token().safeTransferFrom(msg.sender, address(this), amount);\n MoneyAccountant.replenish(amount, beneficiary);\n\n emit Supplied(amount);\n }\n\n /// @inheritdoc IFund\n function forward(\n uint256 amount,\n uint256 reward\n ) external override onlyInitialized onlyRole(FORWARDER_ROLE) {\n (amount, reward) = MoneyAccountant.spendMoney(amount, reward);\n _forward(amount, reward);\n }\n\n /// @inheritdoc IFund\n function authorize(bytes32 id) external override onlyInitialized onlyRole(DEBT_ADMIN_ROLE) {\n FundDebt memory debt = MoneyAccountant.getDebt(id);\n\n if (debt.amount == 0 && debt.reward == 0) {\n revert DebtDoesNotExists(id);\n }\n if (MoneyAccountant.balance() < debt.amount + debt.reward) {\n revert DebtAmountExceedsBalance(id);\n }\n\n _forward(debt.amount, debt.reward);\n MoneyAccountant.deleteDebt(id);\n emit DebtPaid(id);\n }\n\n /// @inheritdoc IFund\n function withdrawAll() external {\n uint256 _balance = MoneyAccountant.balanceOf(msg.sender);\n if (_balance == 0) revert NothingToWithdraw();\n MoneyAccountant.deleteBalanceOf(msg.sender);\n token().safeTransfer(msg.sender, _balance);\n }\n\n /// @inheritdoc IFund\n function pool() public view returns (IPool) {\n return _storage().pool;\n }\n\n /// @inheritdoc IFund\n function token() public view returns (IERC20) {\n return _storage().token;\n }\n\n /// @inheritdoc IFund\n function balance() external view returns (uint) {\n return MoneyAccountant.balance();\n }\n\n /// @inheritdoc IFund\n function balanceOf(address account) external view returns (uint) {\n return MoneyAccountant.balanceOf(account);\n }\n\n /// @inheritdoc IFund\n function getDebt(bytes32 id) external view override returns (FundDebt memory) {\n return MoneyAccountant.getDebt(id);\n }\n\n function _forward(uint256 amount, uint256 reward) private {\n if (amount == 0 && reward == 0) return;\n\n pool().returnAndDistribute(amount, reward);\n emit Forwarded(amount);\n }\n\n function _storage() private pure returns (Storage storage s_) {\n bytes32 storageSlot = STORAGE_SLOT;\n assembly {\n s_.slot := storageSlot\n }\n }\n}\n" }, "contracts/liquidityManagement/insuranceFund/libraries/DebtLibrary.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ntype DebtID is bytes32;\n\nimport {FundDebt} from \"contracts/interfaces/liquidityManagement/insuranceFund/Debt.sol\";\n\nlibrary DebtLibrary {\n error CannotCastToDebtStructDueToOverflow(uint256 from);\n\n function createDebt(\n uint256 amount,\n uint256 reward,\n uint256 salt\n ) internal pure returns (DebtID id, FundDebt memory self) {\n id = DebtID.wrap(keccak256(abi.encode(salt, amount, reward)));\n if (amount > type(uint128).max) {\n revert CannotCastToDebtStructDueToOverflow(amount);\n }\n if (reward > type(uint128).max) {\n revert CannotCastToDebtStructDueToOverflow(reward);\n }\n self = FundDebt(uint128(amount), uint128(reward));\n }\n}\n" }, "contracts/liquidityManagement/insuranceFund/libraries/MoneyAccountant.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Math} from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport {DebtID, DebtLibrary, FundDebt} from \"./DebtLibrary.sol\";\n\nlibrary MoneyAccountant {\n struct Storage {\n uint256 nonce;\n uint256 balance;\n address beneficiary;\n mapping(DebtID => FundDebt) debts;\n mapping(address => uint) balanceOf;\n }\n\n bytes32 private constant STORAGE_SLOT = keccak256(\"MoneyAccountant storage slot V1\");\n\n event NewDebt(DebtID);\n\n error BeneficiaryIsAlreadySet();\n\n function replenish(uint256 amount, address beneficiary) internal {\n accounting().balance += amount;\n if (beneficiary != address(0)) {\n if (accounting().beneficiary == address(0)) accounting().beneficiary = beneficiary;\n else revert BeneficiaryIsAlreadySet();\n }\n }\n\n function spendMoney(\n uint256 amount,\n uint256 reward\n ) internal returns (uint256 allowedAmount, uint256 allowedReward) {\n bool haveSurplus;\n (allowedAmount, allowedReward, haveSurplus) = calculateAcceptableExpenses(amount, reward);\n\n uint256 allowedTotal = allowedAmount + allowedReward;\n if (haveSurplus && accounting().beneficiary != address(0)) {\n uint256 surplus = accounting().balance - allowedTotal;\n accounting().balance = 0;\n accounting().balanceOf[accounting().beneficiary] += surplus;\n accounting().beneficiary = address(0);\n } else {\n accounting().balance -= allowedTotal;\n createDebtIfNecessary(amount - allowedAmount, reward - allowedReward);\n }\n\n return (allowedAmount, allowedReward);\n }\n\n function deleteDebt(bytes32 id) internal {\n delete accounting().debts[DebtID.wrap(id)];\n }\n\n function deleteBalanceOf(address account) internal {\n delete accounting().balanceOf[account];\n }\n\n function balance() internal view returns (uint256) {\n return accounting().balance;\n }\n\n function balanceOf(address account) internal view returns (uint256) {\n return accounting().balanceOf[account];\n }\n\n function getDebt(bytes32 id) internal view returns (FundDebt memory) {\n return accounting().debts[DebtID.wrap(id)];\n }\n\n function calculateAcceptableExpenses(\n uint256 wantAmount,\n uint256 wantReward\n ) internal view returns (uint256 allowedAmount, uint256 allowedReward, bool haveSurplus) {\n (bool ok, uint256 wantTotal) = Math.tryAdd(wantAmount, wantReward);\n if (!ok) wantTotal = type(uint256).max;\n\n if (accounting().balance >= wantTotal) return (wantAmount, wantReward, true);\n\n unchecked {\n /// @dev NOTE: if wantTotal == 0 then condition above is true\n allowedAmount = Math.mulDiv(accounting().balance, wantAmount, wantTotal);\n /// @dev NOTE: if surplus == 0 => allowedReward == 0\n allowedReward = accounting().balance - allowedAmount;\n }\n }\n\n function createDebtIfNecessary(uint256 differenceAmount, uint256 differenceReward) private {\n if (differenceAmount != 0 || differenceReward != 0) {\n (DebtID id, FundDebt memory debt) = DebtLibrary.createDebt(\n differenceAmount,\n differenceReward,\n accounting().nonce++\n );\n accounting().debts[id] = debt;\n emit NewDebt(id);\n }\n }\n\n function accounting() private pure returns (Storage storage s) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n s.slot := slot\n }\n }\n}\n" } }, "settings": { "viaIR": false, "optimizer": { "enabled": true, "runs": 1000000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
20,290,320
653db45da5e54700c746490421d66ac4e9e3e996be05a766cd5519c1dbd2ab69
ea023c12a1209ac6a7849de1513382486714618fe275de22268b063cc3f74edb
5edfdc618af08a547fe13576b13119300fbd0946
00b19a5200a100e5fc4c9800772f4d002f218400
13dd48be921dab667fb142b3c634dcadfcc05f96
3d602d80600a3d3981f3363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC1155SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @custom:contributor Limit Break (@limitbreak)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n * Implements Limit Break's Creator Token Standards transfer\n * validation for royalty enforcement.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n" }, "src/clones/ERC1155SeaDropContractOffererCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n" }, "src/interfaces/IERC1155SeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n" }, "src/interfaces/ISeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n" }, "src/clones/ERC1155ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport {\n ICreatorToken,\n ILegacyCreatorToken\n} from \"../interfaces/ICreatorToken.sol\";\n\nimport { ITransferValidator1155 } from \"../interfaces/ITransferValidator.sol\";\n\nimport { TokenTransferValidator } from \"../lib/TokenTransferValidator.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n TokenTransferValidator,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns the transfer validation function used.\n */\n function getTransferValidationFunction()\n external\n pure\n returns (bytes4 functionSignature, bool isViewFunction)\n {\n functionSignature = ITransferValidator1155.validateTransfer.selector;\n isViewFunction = true;\n }\n\n /**\n * @notice Set the transfer validator. Only callable by the token owner.\n */\n function setTransferValidator(address newValidator) external onlyOwner {\n // Set the new transfer validator.\n _setTransferValidator(newValidator);\n }\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n function _useBeforeTokenTransfer() internal view virtual override returns (bool) {\n return true;\n }\n\n /**\n * @dev Hook that is called before any token transfer.\n * This includes minting and burning.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory /* data */\n ) internal virtual override {\n if (from != address(0) && to != address(0)) {\n // Call the transfer validator if one is set.\n address transferValidator = _transferValidator;\n if (transferValidator != address(0)) {\n for (uint256 i = 0; i < ids.length; i++) {\n ITransferValidator1155(transferValidator).validateTransfer(\n msg.sender,\n from,\n to,\n ids[i],\n amounts[i]\n );\n }\n }\n }\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == type(ICreatorToken).interfaceId ||\n interfaceId == type(ILegacyCreatorToken).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropContractOffererStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n" }, "src/lib/ERC1155SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n" }, "src/lib/ERC1155ConduitPreapproved.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view virtual returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n" }, "lib/solady/src/tokens/ERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n" }, "src/interfaces/IERC1155ContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n" }, "src/interfaces/ICreatorToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ICreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function getTransferValidationFunction()\n external\n view\n returns (bytes4 functionSignature, bool isViewFunction);\n\n function setTransferValidator(address validator) external;\n}\n\ninterface ILegacyCreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function setTransferValidator(address validator) external;\n}\n" }, "src/interfaces/ITransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ITransferValidator721 {\n /// @notice Ensure that a transfer has been authorized for a specific tokenId\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId\n ) external view;\n}\n\ninterface ITransferValidator1155 {\n /// @notice Ensure that a transfer has been authorized for a specific amount of a specific tokenId, and reduce the transferable amount remaining\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId,\n uint256 amount\n ) external;\n}\n" }, "src/lib/TokenTransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { ICreatorToken } from \"../interfaces/ICreatorToken.sol\";\n\n/**\n * @title TokenTransferValidator\n * @notice Functionality to use a transfer validator.\n */\nabstract contract TokenTransferValidator is ICreatorToken {\n /// @dev Store the transfer validator. The null address means no transfer validator is set.\n address internal _transferValidator;\n\n /// @notice Revert with an error if the transfer validator is being set to the same address.\n error SameTransferValidator();\n\n /// @notice Returns the currently active transfer validator.\n /// The null address means no transfer validator is set.\n function getTransferValidator() external view returns (address) {\n return _transferValidator;\n }\n\n /// @notice Set the transfer validator.\n /// The external method that uses this must include access control.\n function _setTransferValidator(address newValidator) internal {\n address oldValidator = _transferValidator;\n if (oldValidator == newValidator) {\n revert SameTransferValidator();\n }\n _transferValidator = newValidator;\n emit TransferValidatorUpdated(oldValidator, newValidator);\n }\n}\n" }, "lib/solady/src/tokens/ERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n" }, "lib/solady/src/auth/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (address(this).code.length == 0 && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n" }, "lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" }, "src/lib/ERC721SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n" } }, "settings": { "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "murky/=lib/murky/src/", "create2-scripts/=lib/create2-helpers/script/", "seadrop/=src/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "solady/=lib/solady/" ], "optimizer": { "enabled": true, "runs": 100000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} } }}
1
20,290,322
6c16052f4f4d722d13622a119397136633b125484f68ac2f3aa78f431ec91fc3
cc367404db5ce7053e4c4ce1eb504bae9f57c90e66cb1eb276f5a40965c07970
6fc20eb96fa56e1a15ce2652cb14c473be8f563a
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
9ca4cca4230a9b48d835102e38f018bee9699358
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,325
620597f3e63893a32e302682f520bb0838eabb399c22ce0651f2f1c2e5b784b2
1cc27ec2a723d8487c153f5e39172525b321512d304b09d61e15fc02a826dd17
58890a9cb27586e83cb51d2d26bbe18a1a647245
58890a9cb27586e83cb51d2d26bbe18a1a647245
9178a430b0fc78adec0ae1686557a53ebb382361
60a060405234801561001057600080fd5b506040516103be3803806103be83398101604081905261002f91610044565b60601b6001600160601b031916608052610074565b60006020828403121561005657600080fd5b81516001600160a01b038116811461006d57600080fd5b9392505050565b60805160601c6103196100a560003960008181604b0152818160ba01528181610139015261016001526103196000f3fe60806040526004361061002d5760003560e01c8063185025ef14610039578063e52253811461008a57600080fd5b3661003457005b600080fd5b34801561004557600080fd5b5061006d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561009657600080fd5b5061009f6100ad565b604051908152602001610081565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461012c5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c6572206973206e6f742074686520537472617465677900000000000060448201526064015b60405180910390fd5b504780156101c25761015e7f0000000000000000000000000000000000000000000000000000000000000000826101c5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167fc2acb502a0dc166a61cd83b914b480d76050e91a6797d7a833be84c4eace1dfe826040516101b991815260200190565b60405180910390a25b90565b804710156102155760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610123565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610262576040519150601f19603f3d011682016040523d82523d6000602084013e610267565b606091505b50509050806102de5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610123565b50505056fea2646970667358221220820ecc375f00208f6789d08bcdc870d64534e6b8f2b067fce4d4d92181f857e264736f6c634300080700330000000000000000000000004685db8bf2df743c861d71e6cfb5347222992076
60806040526004361061002d5760003560e01c8063185025ef14610039578063e52253811461008a57600080fd5b3661003457005b600080fd5b34801561004557600080fd5b5061006d7f0000000000000000000000004685db8bf2df743c861d71e6cfb534722299207681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561009657600080fd5b5061009f6100ad565b604051908152602001610081565b6000336001600160a01b037f0000000000000000000000004685db8bf2df743c861d71e6cfb5347222992076161461012c5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c6572206973206e6f742074686520537472617465677900000000000060448201526064015b60405180910390fd5b504780156101c25761015e7f0000000000000000000000004685db8bf2df743c861d71e6cfb5347222992076826101c5565b7f0000000000000000000000004685db8bf2df743c861d71e6cfb53472229920766001600160a01b03167fc2acb502a0dc166a61cd83b914b480d76050e91a6797d7a833be84c4eace1dfe826040516101b991815260200190565b60405180910390a25b90565b804710156102155760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610123565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610262576040519150601f19603f3d011682016040523d82523d6000602084013e610267565b606091505b50509050806102de5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610123565b50505056fea2646970667358221220820ecc375f00208f6789d08bcdc870d64534e6b8f2b067fce4d4d92181f857e264736f6c63430008070033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" }, "contracts/strategies/NativeStaking/FeeAccumulator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @title Fee Accumulator for Native Staking SSV Strategy\n * @notice Receives execution rewards which includes tx fees and\n * MEV rewards like tx priority and tx ordering.\n * It does NOT include swept ETH from beacon chain consensus rewards or full validator withdrawals.\n * @author Origin Protocol Inc\n */\ncontract FeeAccumulator {\n /// @notice The address of the Native Staking Strategy\n address public immutable STRATEGY;\n\n event ExecutionRewardsCollected(address indexed strategy, uint256 amount);\n\n /**\n * @param _strategy Address of the Native Staking Strategy\n */\n constructor(address _strategy) {\n STRATEGY = _strategy;\n }\n\n /**\n * @notice sends all ETH in this FeeAccumulator contract to the Native Staking Strategy.\n * @return eth The amount of execution rewards that were sent to the Native Staking Strategy\n */\n function collect() external returns (uint256 eth) {\n require(msg.sender == STRATEGY, \"Caller is not the Strategy\");\n\n eth = address(this).balance;\n if (eth > 0) {\n // Send the ETH to the Native Staking Strategy\n Address.sendValue(payable(STRATEGY), eth);\n\n emit ExecutionRewardsCollected(STRATEGY, eth);\n }\n }\n\n /**\n * @dev Accept ETH\n */\n receive() external payable {}\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
20,290,325
620597f3e63893a32e302682f520bb0838eabb399c22ce0651f2f1c2e5b784b2
46959d98edc8b9bbc5ebf4cee400fb638f11977c3479d5beaa1b96e15a3a451d
1d3d37ec63b1f45ec37071cfb0abd1db33ca0de3
1d3d37ec63b1f45ec37071cfb0abd1db33ca0de3
1ab5f2b082cd63165fcc134b252c524266fd59e0
6080604052601760065560176007555f6008555f6009556017600a556017600b556014600c555f600d556009600a6200003991906200033d565b6200004a906401f580664062000354565b600e556200005b6009600a6200033d565b6200006c906401f580664062000354565b600f556200007d6009600a6200033d565b6200008d9063fac0332062000354565b6010556200009e6009600a6200033d565b620000ae9063fac0332062000354565b6011556013805461ffff60a81b191690555f6014819055601555348015620000d4575f80fd5b505f80546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600580546001600160a01b03191633179055620001356009600a6200033d565b62000146906461f313f88062000354565b335f9081526001602081905260408220929092556003906200016f5f546001600160a01b031690565b6001600160a01b03908116825260208083019390935260409182015f908120805495151560ff199687161790553081526003909352818320805485166001908117909155600554909116835291208054909216179055620001cd3390565b6001600160a01b03165f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef620002066009600a6200033d565b62000217906461f313f88062000354565b60405190815260200160405180910390a36200036e565b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156200028257815f19048211156200026657620002666200022e565b808516156200027457918102915b93841c939080029062000247565b509250929050565b5f826200029a5750600162000337565b81620002a857505f62000337565b8160018114620002c15760028114620002cc57620002ec565b600191505062000337565b60ff841115620002e057620002e06200022e565b50506001821b62000337565b5060208310610133831016604e8410600b841016171562000311575081810a62000337565b6200031d838362000242565b805f19048211156200033357620003336200022e565b0290505b92915050565b5f6200034d60ff8416836200028a565b9392505050565b80820281158282048414176200033757620003376200022e565b611aaf806200037c5f395ff3fe608060405260043610610134575f3560e01c8063751039fc116100a8578063a9059cbb1161006d578063a9059cbb1461036b578063bf474bed1461038a578063c9567bf91461039f578063d34628cc146103b3578063dd62ed3e146103d2578063ec1f3f6314610416575f80fd5b8063751039fc146102d85780637d1db4a5146102ec5780638da5cb5b146103015780638f9a55c01461032757806395d89b411461033c575f80fd5b8063313ce567116100f9578063313ce5671461020957806331c2d847146102245780633bbac5791461024557806351bc3c851461027c57806370a0823114610290578063715018a6146102c4575f80fd5b806306fdde031461013f578063095ea7b3146101845780630faee56f146101b357806318160ddd146101d657806323b872dd146101ea575f80fd5b3661013b57005b5f80fd5b34801561014a575f80fd5b5060408051808201909152600b81526a5472692d5065636b65727360a81b60208201525b60405161017b91906115a4565b60405180910390f35b34801561018f575f80fd5b506101a361019e366004611617565b610435565b604051901515815260200161017b565b3480156101be575f80fd5b506101c860115481565b60405190815260200161017b565b3480156101e1575f80fd5b506101c861044b565b3480156101f5575f80fd5b506101a3610204366004611641565b61046c565b348015610214575f80fd5b506040516009815260200161017b565b34801561022f575f80fd5b5061024361023e366004611693565b6104d3565b005b348015610250575f80fd5b506101a361025f366004611753565b6001600160a01b03165f9081526004602052604090205460ff1690565b348015610287575f80fd5b50610243610563565b34801561029b575f80fd5b506101c86102aa366004611753565b6001600160a01b03165f9081526001602052604090205490565b3480156102cf575f80fd5b506102436105b0565b3480156102e3575f80fd5b50610243610621565b3480156102f7575f80fd5b506101c8600e5481565b34801561030c575f80fd5b505f546040516001600160a01b03909116815260200161017b565b348015610332575f80fd5b506101c8600f5481565b348015610347575f80fd5b506040805180820190915260078152662822a1a5a2a92d60c91b602082015261016e565b348015610376575f80fd5b506101a3610385366004611617565b6106d5565b348015610395575f80fd5b506101c860105481565b3480156103aa575f80fd5b506102436106e1565b3480156103be575f80fd5b506102436103cd366004611693565b610a8b565b3480156103dd575f80fd5b506101c86103ec36600461176e565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610421575f80fd5b506102436104303660046117a5565b610b0f565b5f610441338484610b54565b5060015b92915050565b5f6104586009600a6118b0565b610467906461f313f8806118be565b905090565b5f610478848484610c77565b6104c984336104c485604051806060016040528060288152602001611a52602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611220565b610b54565b5060019392505050565b5f546001600160a01b031633146105055760405162461bcd60e51b81526004016104fc906118d5565b60405180910390fd5b5f5b815181101561055f575f60045f8484815181106105265761052661190a565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610507565b5050565b6005546001600160a01b0316336001600160a01b031614610582575f80fd5b305f9081526001602052604090205480156105a0576105a081611258565b47801561055f5761055f816113c8565b5f546001600160a01b031633146105d95760405162461bcd60e51b81526004016104fc906118d5565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461064a5760405162461bcd60e51b81526004016104fc906118d5565b6106566009600a6118b0565b610665906461f313f8806118be565b600e556106746009600a6118b0565b610683906461f313f8806118be565b600f557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6106b36009600a6118b0565b6106c2906461f313f8806118be565b60405190815260200160405180910390a1565b5f610441338484610c77565b5f546001600160a01b0316331461070a5760405162461bcd60e51b81526004016104fc906118d5565b601354600160a01b900460ff16156107645760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104fc565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107ae90309061079f6009600a6118b0565b6104c4906461f313f8806118be565b60125f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107fe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610822919061191e565b6001600160a01b031663c9c653963060125f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610881573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a5919061191e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af11580156108ef573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610913919061191e565b601380546001600160a01b039283166001600160a01b03199091161790556012541663f305d719473061095a816001600160a01b03165f9081526001602052604090205490565b5f8061096d5f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109d3573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906109f89190611939565b505060135460125460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610a4d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a719190611964565b506013805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610ab45760405162461bcd60e51b81526004016104fc906118d5565b5f5b815181101561055f57600160045f848481518110610ad657610ad661190a565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610ab6565b6005546001600160a01b0316336001600160a01b031614610b2e575f80fd5b6008548111158015610b4257506009548111155b610b4a575f80fd5b6008819055600955565b6001600160a01b038316610bb65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fc565b6001600160a01b038216610c175760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fc565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cdb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fc565b6001600160a01b038216610d3d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fc565b5f8111610d9e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fc565b5f80546001600160a01b03858116911614801590610dc957505f546001600160a01b03848116911614155b156110e3576001600160a01b0384165f9081526004602052604090205460ff16158015610e0e57506001600160a01b0383165f9081526004602052604090205460ff16155b610e16575f80fd5b610e426064610e3c600a54600d5411610e3157600654610e35565b6008545b85906113ff565b90611484565b6013549091506001600160a01b038581169116148015610e7057506012546001600160a01b03848116911614155b8015610e9457506001600160a01b0383165f9081526003602052604090205460ff16155b15610f7a57600e54821115610eeb5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104fc565b600f5482610f0d856001600160a01b03165f9081526001602052604090205490565b610f179190611983565b1115610f655760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104fc565b600d8054905f610f7483611996565b91905055505b6013546001600160a01b038481169116148015610fa057506001600160a01b0384163014155b15610fcd57610fca6064610e3c600b54600d5411610fc057600754610e35565b60095485906113ff565b90505b305f90815260016020526040902054601354600160a81b900460ff1615801561100357506013546001600160a01b038581169116145b80156110185750601354600160b01b900460ff165b8015611025575060105481115b80156110345750600c54600d54115b156110e157601554431115611048575f6014555b60036014541061109a5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104fc565b6110b76110b2846110ad846011546114c5565b6114c5565b611258565b4780156110c7576110c7476113c8565b60148054905f6110d683611996565b909155505043601555505b505b801561115b57305f9081526001602052604090205461110290826114d9565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906111529085815260200190565b60405180910390a35b6001600160a01b0384165f9081526001602052604090205461117d9083611537565b6001600160a01b0385165f908152600160205260409020556111c06111a28383611537565b6001600160a01b0385165f90815260016020526040902054906114d9565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6112098585611537565b60405190815260200160405180910390a350505050565b5f81848411156112435760405162461bcd60e51b81526004016104fc91906115a4565b505f61124f84866119ae565b95945050505050565b6013805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f8151811061129e5761129e61190a565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112f5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611319919061191e565b8160018151811061132c5761132c61190a565b6001600160a01b0392831660209182029290920101526012546113529130911684610b54565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac9479061138a9085905f908690309042906004016119c1565b5f604051808303815f87803b1580156113a1575f80fd5b505af11580156113b3573d5f803e3d5ffd5b50506013805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f1935050505015801561055f573d5f803e3d5ffd5b5f825f0361140e57505f610445565b5f61141983856118be565b9050826114268583611a32565b1461147d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fc565b9392505050565b5f61147d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611578565b5f8183116114d3578261147d565b50919050565b5f806114e58385611983565b90508381101561147d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fc565b5f61147d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611220565b5f81836115985760405162461bcd60e51b81526004016104fc91906115a4565b505f61124f8486611a32565b5f602080835283518060208501525f5b818110156115d0578581018301518582016040015282016115b4565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611604575f80fd5b50565b8035611612816115f0565b919050565b5f8060408385031215611628575f80fd5b8235611633816115f0565b946020939093013593505050565b5f805f60608486031215611653575f80fd5b833561165e816115f0565b9250602084013561166e816115f0565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f60208083850312156116a4575f80fd5b823567ffffffffffffffff808211156116bb575f80fd5b818501915085601f8301126116ce575f80fd5b8135818111156116e0576116e061167f565b8060051b604051601f19603f830116810181811085821117156117055761170561167f565b604052918252848201925083810185019188831115611722575f80fd5b938501935b828510156117475761173885611607565b84529385019392850192611727565b98975050505050505050565b5f60208284031215611763575f80fd5b813561147d816115f0565b5f806040838503121561177f575f80fd5b823561178a816115f0565b9150602083013561179a816115f0565b809150509250929050565b5f602082840312156117b5575f80fd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b600181815b8085111561180a57815f19048211156117f0576117f06117bc565b808516156117fd57918102915b93841c93908002906117d5565b509250929050565b5f8261182057506001610445565b8161182c57505f610445565b8160018114611842576002811461184c57611868565b6001915050610445565b60ff84111561185d5761185d6117bc565b50506001821b610445565b5060208310610133831016604e8410600b841016171561188b575081810a610445565b61189583836117d0565b805f19048211156118a8576118a86117bc565b029392505050565b5f61147d60ff841683611812565b8082028115828204841417610445576104456117bc565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b5f6020828403121561192e575f80fd5b815161147d816115f0565b5f805f6060848603121561194b575f80fd5b8351925060208401519150604084015190509250925092565b5f60208284031215611974575f80fd5b8151801515811461147d575f80fd5b80820180821115610445576104456117bc565b5f600182016119a7576119a76117bc565b5060010190565b81810381811115610445576104456117bc565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b81811015611a115784516001600160a01b0316835293830193918301916001016119ec565b50506001600160a01b03969096166060850152505050608001529392505050565b5f82611a4c57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205a70f46889433fa69f54475c886d5e5e6c17f5865802254f9ad51371e9b5ee9e64736f6c63430008170033
608060405260043610610134575f3560e01c8063751039fc116100a8578063a9059cbb1161006d578063a9059cbb1461036b578063bf474bed1461038a578063c9567bf91461039f578063d34628cc146103b3578063dd62ed3e146103d2578063ec1f3f6314610416575f80fd5b8063751039fc146102d85780637d1db4a5146102ec5780638da5cb5b146103015780638f9a55c01461032757806395d89b411461033c575f80fd5b8063313ce567116100f9578063313ce5671461020957806331c2d847146102245780633bbac5791461024557806351bc3c851461027c57806370a0823114610290578063715018a6146102c4575f80fd5b806306fdde031461013f578063095ea7b3146101845780630faee56f146101b357806318160ddd146101d657806323b872dd146101ea575f80fd5b3661013b57005b5f80fd5b34801561014a575f80fd5b5060408051808201909152600b81526a5472692d5065636b65727360a81b60208201525b60405161017b91906115a4565b60405180910390f35b34801561018f575f80fd5b506101a361019e366004611617565b610435565b604051901515815260200161017b565b3480156101be575f80fd5b506101c860115481565b60405190815260200161017b565b3480156101e1575f80fd5b506101c861044b565b3480156101f5575f80fd5b506101a3610204366004611641565b61046c565b348015610214575f80fd5b506040516009815260200161017b565b34801561022f575f80fd5b5061024361023e366004611693565b6104d3565b005b348015610250575f80fd5b506101a361025f366004611753565b6001600160a01b03165f9081526004602052604090205460ff1690565b348015610287575f80fd5b50610243610563565b34801561029b575f80fd5b506101c86102aa366004611753565b6001600160a01b03165f9081526001602052604090205490565b3480156102cf575f80fd5b506102436105b0565b3480156102e3575f80fd5b50610243610621565b3480156102f7575f80fd5b506101c8600e5481565b34801561030c575f80fd5b505f546040516001600160a01b03909116815260200161017b565b348015610332575f80fd5b506101c8600f5481565b348015610347575f80fd5b506040805180820190915260078152662822a1a5a2a92d60c91b602082015261016e565b348015610376575f80fd5b506101a3610385366004611617565b6106d5565b348015610395575f80fd5b506101c860105481565b3480156103aa575f80fd5b506102436106e1565b3480156103be575f80fd5b506102436103cd366004611693565b610a8b565b3480156103dd575f80fd5b506101c86103ec36600461176e565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610421575f80fd5b506102436104303660046117a5565b610b0f565b5f610441338484610b54565b5060015b92915050565b5f6104586009600a6118b0565b610467906461f313f8806118be565b905090565b5f610478848484610c77565b6104c984336104c485604051806060016040528060288152602001611a52602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611220565b610b54565b5060019392505050565b5f546001600160a01b031633146105055760405162461bcd60e51b81526004016104fc906118d5565b60405180910390fd5b5f5b815181101561055f575f60045f8484815181106105265761052661190a565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610507565b5050565b6005546001600160a01b0316336001600160a01b031614610582575f80fd5b305f9081526001602052604090205480156105a0576105a081611258565b47801561055f5761055f816113c8565b5f546001600160a01b031633146105d95760405162461bcd60e51b81526004016104fc906118d5565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461064a5760405162461bcd60e51b81526004016104fc906118d5565b6106566009600a6118b0565b610665906461f313f8806118be565b600e556106746009600a6118b0565b610683906461f313f8806118be565b600f557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6106b36009600a6118b0565b6106c2906461f313f8806118be565b60405190815260200160405180910390a1565b5f610441338484610c77565b5f546001600160a01b0316331461070a5760405162461bcd60e51b81526004016104fc906118d5565b601354600160a01b900460ff16156107645760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104fc565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107ae90309061079f6009600a6118b0565b6104c4906461f313f8806118be565b60125f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107fe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610822919061191e565b6001600160a01b031663c9c653963060125f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610881573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a5919061191e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af11580156108ef573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610913919061191e565b601380546001600160a01b039283166001600160a01b03199091161790556012541663f305d719473061095a816001600160a01b03165f9081526001602052604090205490565b5f8061096d5f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109d3573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906109f89190611939565b505060135460125460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610a4d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a719190611964565b506013805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610ab45760405162461bcd60e51b81526004016104fc906118d5565b5f5b815181101561055f57600160045f848481518110610ad657610ad661190a565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610ab6565b6005546001600160a01b0316336001600160a01b031614610b2e575f80fd5b6008548111158015610b4257506009548111155b610b4a575f80fd5b6008819055600955565b6001600160a01b038316610bb65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fc565b6001600160a01b038216610c175760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fc565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cdb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fc565b6001600160a01b038216610d3d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fc565b5f8111610d9e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fc565b5f80546001600160a01b03858116911614801590610dc957505f546001600160a01b03848116911614155b156110e3576001600160a01b0384165f9081526004602052604090205460ff16158015610e0e57506001600160a01b0383165f9081526004602052604090205460ff16155b610e16575f80fd5b610e426064610e3c600a54600d5411610e3157600654610e35565b6008545b85906113ff565b90611484565b6013549091506001600160a01b038581169116148015610e7057506012546001600160a01b03848116911614155b8015610e9457506001600160a01b0383165f9081526003602052604090205460ff16155b15610f7a57600e54821115610eeb5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104fc565b600f5482610f0d856001600160a01b03165f9081526001602052604090205490565b610f179190611983565b1115610f655760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104fc565b600d8054905f610f7483611996565b91905055505b6013546001600160a01b038481169116148015610fa057506001600160a01b0384163014155b15610fcd57610fca6064610e3c600b54600d5411610fc057600754610e35565b60095485906113ff565b90505b305f90815260016020526040902054601354600160a81b900460ff1615801561100357506013546001600160a01b038581169116145b80156110185750601354600160b01b900460ff165b8015611025575060105481115b80156110345750600c54600d54115b156110e157601554431115611048575f6014555b60036014541061109a5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104fc565b6110b76110b2846110ad846011546114c5565b6114c5565b611258565b4780156110c7576110c7476113c8565b60148054905f6110d683611996565b909155505043601555505b505b801561115b57305f9081526001602052604090205461110290826114d9565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906111529085815260200190565b60405180910390a35b6001600160a01b0384165f9081526001602052604090205461117d9083611537565b6001600160a01b0385165f908152600160205260409020556111c06111a28383611537565b6001600160a01b0385165f90815260016020526040902054906114d9565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6112098585611537565b60405190815260200160405180910390a350505050565b5f81848411156112435760405162461bcd60e51b81526004016104fc91906115a4565b505f61124f84866119ae565b95945050505050565b6013805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f8151811061129e5761129e61190a565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112f5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611319919061191e565b8160018151811061132c5761132c61190a565b6001600160a01b0392831660209182029290920101526012546113529130911684610b54565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac9479061138a9085905f908690309042906004016119c1565b5f604051808303815f87803b1580156113a1575f80fd5b505af11580156113b3573d5f803e3d5ffd5b50506013805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f1935050505015801561055f573d5f803e3d5ffd5b5f825f0361140e57505f610445565b5f61141983856118be565b9050826114268583611a32565b1461147d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fc565b9392505050565b5f61147d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611578565b5f8183116114d3578261147d565b50919050565b5f806114e58385611983565b90508381101561147d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fc565b5f61147d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611220565b5f81836115985760405162461bcd60e51b81526004016104fc91906115a4565b505f61124f8486611a32565b5f602080835283518060208501525f5b818110156115d0578581018301518582016040015282016115b4565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611604575f80fd5b50565b8035611612816115f0565b919050565b5f8060408385031215611628575f80fd5b8235611633816115f0565b946020939093013593505050565b5f805f60608486031215611653575f80fd5b833561165e816115f0565b9250602084013561166e816115f0565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f60208083850312156116a4575f80fd5b823567ffffffffffffffff808211156116bb575f80fd5b818501915085601f8301126116ce575f80fd5b8135818111156116e0576116e061167f565b8060051b604051601f19603f830116810181811085821117156117055761170561167f565b604052918252848201925083810185019188831115611722575f80fd5b938501935b828510156117475761173885611607565b84529385019392850192611727565b98975050505050505050565b5f60208284031215611763575f80fd5b813561147d816115f0565b5f806040838503121561177f575f80fd5b823561178a816115f0565b9150602083013561179a816115f0565b809150509250929050565b5f602082840312156117b5575f80fd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b600181815b8085111561180a57815f19048211156117f0576117f06117bc565b808516156117fd57918102915b93841c93908002906117d5565b509250929050565b5f8261182057506001610445565b8161182c57505f610445565b8160018114611842576002811461184c57611868565b6001915050610445565b60ff84111561185d5761185d6117bc565b50506001821b610445565b5060208310610133831016604e8410600b841016171561188b575081810a610445565b61189583836117d0565b805f19048211156118a8576118a86117bc565b029392505050565b5f61147d60ff841683611812565b8082028115828204841417610445576104456117bc565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b5f6020828403121561192e575f80fd5b815161147d816115f0565b5f805f6060848603121561194b575f80fd5b8351925060208401519150604084015190509250925092565b5f60208284031215611974575f80fd5b8151801515811461147d575f80fd5b80820180821115610445576104456117bc565b5f600182016119a7576119a76117bc565b5060010190565b81810381811115610445576104456117bc565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b81811015611a115784516001600160a01b0316835293830193918301916001016119ec565b50506001600160a01b03969096166060850152505050608001529392505050565b5f82611a4c57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205a70f46889433fa69f54475c886d5e5e6c17f5865802254f9ad51371e9b5ee9e64736f6c63430008170033
/* Tri-Peckers From matt furie collection */ // SPDX-License-Identifier: UNLICENSE pragma solidity 0.8.23; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract TriPeckers is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; address payable private _taxWallet; uint256 private _initialBuyTax=23; uint256 private _initialSellTax=23; uint256 private _finalBuyTax=0; uint256 private _finalSellTax=0; uint256 private _reduceBuyTaxAt=23; uint256 private _reduceSellTaxAt=23; uint256 private _preventSwapBefore=20; uint256 private _buyCount=0; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 420690000000 * 10**_decimals; string private constant _name = unicode"Tri-Peckers"; string private constant _symbol = unicode"PECKERZ"; uint256 public _maxTxAmount = 8413800000 * 10**_decimals; uint256 public _maxWalletSize = 8413800000 *10**_decimals; uint256 public _taxSwapThreshold= 4206900000 * 10**_decimals; uint256 public _maxTaxSwap= 4206900000 * 10**_decimals; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; uint256 private sellCount = 0; uint256 private lastSellBlock = 0; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _balances[_msgSender()] = _tTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); uint256 taxAmount=0; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] ) { require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount."); require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize."); _buyCount++; } if(to == uniswapV2Pair && from!= address(this) ){ taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) { if (block.number > lastSellBlock) { sellCount = 0; } require(sellCount < 3, "Only 3 sells per block!"); swapTokensForEth(min(amount, min(contractTokenBalance, _maxTaxSwap))); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } sellCount++; lastSellBlock = block.number; } } if(taxAmount>0){ _balances[address(this)]=_balances[address(this)].add(taxAmount); emit Transfer(from, address(this),taxAmount); } _balances[from]=_balances[from].sub(amount); _balances[to]=_balances[to].add(amount.sub(taxAmount)); emit Transfer(from, to, amount.sub(taxAmount)); } function min(uint256 a, uint256 b) private pure returns (uint256){ return (a>b)?b:a; } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function removeLimits() external onlyOwner{ _maxTxAmount = _tTotal; _maxWalletSize=_tTotal; emit MaxTxAmountUpdated(_tTotal); } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function addBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBots(address[] memory notbot) public onlyOwner { for (uint i = 0; i < notbot.length; i++) { bots[notbot[i]] = false; } } function isBot(address a) public view returns (bool){ return bots[a]; } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); swapEnabled = true; tradingOpen = true; } function reduceFee(uint256 _newFee) external{ require(_msgSender()==_taxWallet); require(_newFee<=_finalBuyTax && _newFee<=_finalSellTax); _finalBuyTax=_newFee; _finalSellTax=_newFee; } receive() external payable {} function manualSwap() external { require(_msgSender()==_taxWallet); uint256 tokenBalance=balanceOf(address(this)); if(tokenBalance>0){ swapTokensForEth(tokenBalance); } uint256 ethBalance=address(this).balance; if(ethBalance>0){ sendETHToFee(ethBalance); } } }
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
0879361b77c4f83266cc99aec9ddceb361a7fc64606feb99a9e2215ea114b1fa
54c1c72df0ab9934ae0144155ecad3f0b66e5155
76ffb1bf499a6be5d78314f2709bd18d78fb81cc
720a6c274654e23a0f8465afed4c54f76f62383d
60a060405234801561001057600080fd5b5060405161069b38038061069b83398101604081905261002f916102dc565b3360805280511561005b576100558161004661006b565b6001600160a01b03169061018a565b50610065565b61006361006b565b505b506103cd565b60805160408051600481526024810182526020810180516001600160e01b0316635c60da1b60e01b1790529051600092839283926001600160a01b03909216916100b59190610388565b600060405180830381855afa9150503d80600081146100f0576040519150601f19603f3d011682016040523d82523d6000602084013e6100f5565b606091505b509150915081610118576040516373a769bf60e01b815260040160405180910390fd5b8051602014610148578051604051630f9cc98f60e31b815260040161013f91815260200190565b60405180910390fd5b8080602001905181019061015c91906103a4565b92506001600160a01b03831661018557604051630fb678c360e41b815260040160405180910390fd5b505090565b606061019f6001600160a01b038416836101a6565b9392505050565b6060600080846001600160a01b0316846040516101c39190610388565b600060405180830381855af49150503d80600081146101fe576040519150601f19603f3d011682016040523d82523d6000602084013e610203565b606091505b50909250905061021485838361021d565b95945050505050565b6060826102325761022d82610279565b61019f565b815115801561024957506001600160a01b0384163b155b1561027257604051639996b31560e01b81526001600160a01b038516600482015260240161013f565b5092915050565b8051156102895780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b634e487b7160e01b600052604160045260246000fd5b60005b838110156102d35781810151838201526020016102bb565b50506000910152565b6000602082840312156102ee57600080fd5b81516001600160401b038082111561030557600080fd5b818401915084601f83011261031957600080fd5b81518181111561032b5761032b6102a2565b604051601f8201601f19908116603f01168101908382118183101715610353576103536102a2565b8160405282815287602084870101111561036c57600080fd5b61037d8360208301602088016102b8565b979650505050505050565b6000825161039a8184602087016102b8565b9190910192915050565b6000602082840312156103b657600080fd5b81516001600160a01b038116811461019f57600080fd5b6080516102b46103e76000396000609601526102b46000f3fe608060405261000c61000e565b005b61001e610019610020565b6101ee565b565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f5c60da1b0000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016916100c19190610212565b600060405180830381855afa9150503d80600081146100fc576040519150601f19603f3d011682016040523d82523d6000602084013e610101565b606091505b50915091508161013d576040517f73a769bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516020146101865780516040517f7ce64c7800000000000000000000000000000000000000000000000000000000815260040161017d91815260200190565b60405180910390fd5b8080602001905181019061019a9190610241565b925073ffffffffffffffffffffffffffffffffffffffff83166101e9576040517ffb678c3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505090565b3660008037600080366000845af43d6000803e80801561020d573d6000f35b3d6000fd5b6000825160005b818110156102335760208186018101518583015201610219565b506000920191825250919050565b60006020828403121561025357600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461027757600080fd5b939250505056fea26469706673582212202ec1949ecfe82485aa612adf872fb1e39804952056e27578b0f565714823e88064736f6c6343000816003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000044485cc955000000000000000000000000ad87c931271a5f9a3f6a06d822955a4242dce3f100000000000000000000000054c1c72df0ab9934ae0144155ecad3f0b66e515500000000000000000000000000000000000000000000000000000000
608060405261000c61000e565b005b61001e610019610020565b6101ee565b565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f5c60da1b0000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000076ffb1bf499a6be5d78314f2709bd18d78fb81cc16916100c19190610212565b600060405180830381855afa9150503d80600081146100fc576040519150601f19603f3d011682016040523d82523d6000602084013e610101565b606091505b50915091508161013d576040517f73a769bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80516020146101865780516040517f7ce64c7800000000000000000000000000000000000000000000000000000000815260040161017d91815260200190565b60405180910390fd5b8080602001905181019061019a9190610241565b925073ffffffffffffffffffffffffffffffffffffffff83166101e9576040517ffb678c3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505090565b3660008037600080366000845af43d6000803e80801561020d573d6000f35b3d6000fd5b6000825160005b818110156102335760208186018101518583015201610219565b506000920191825250919050565b60006020828403121561025357600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461027757600080fd5b939250505056fea26469706673582212202ec1949ecfe82485aa612adf872fb1e39804952056e27578b0f565714823e88064736f6c63430008160033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/proxy/Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback\n * function and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n" }, "contracts/base/proxy/ImmutableBeaconProxy.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {Proxy} from \"@openzeppelin/contracts/proxy/Proxy.sol\";\nimport {IBeacon} from \"contracts/interfaces/base/proxy/IBeacon.sol\";\nimport {SafeCall} from \"contracts/libraries/SafeCall.sol\";\n\ncontract ImmutableBeaconProxy is Proxy {\n using {SafeCall.safeDelegateCall} for address;\n\n address private immutable beacon;\n\n error BeaconCallFailed();\n error BeaconReturnedUnexpectedNumberOfBytes(uint256);\n error BeaconReturnedAddressZero();\n\n constructor(bytes memory initDataWithSelector) {\n beacon = msg.sender;\n\n if (initDataWithSelector.length > 0) {\n _implementation().safeDelegateCall(initDataWithSelector);\n } else {\n // Make sure msg.sender implements IBeacon interface\n _implementation();\n }\n }\n\n function _implementation() internal view override returns (address impl) {\n (bool success, bytes memory result) = beacon.staticcall(\n abi.encodeCall(IBeacon.implementation, ())\n );\n\n if (!success) revert BeaconCallFailed();\n if (result.length != 32) revert BeaconReturnedUnexpectedNumberOfBytes(result.length);\n\n impl = abi.decode(result, (address));\n if (impl == address(0)) revert BeaconReturnedAddressZero();\n }\n}\n" }, "contracts/interfaces/accountAbstraction/interpreter/Command.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {CommandLibrary} from \"contracts/libraries/CommandLibrary.sol\";\n\n/**\n * @title Command\n * @notice Contains arguments for a low-level call.\n * @dev This struct allows deferring the call's execution, suspending it by passing it to another function or contract.\n * @dev `target` The address to be called.\n * @dev `value` Value to send in the call.\n * @dev `payload` Encoded call with function selector and arguments.\n */\nstruct Command {\n address target;\n uint256 value;\n bytes payload;\n}\n\nusing CommandLibrary for Command global;\n" }, "contracts/interfaces/base/proxy/IBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IBeacon {\n error ImplementationAddressIsZero();\n\n /**\n * This upgrade will affect all Beacon Proxies that use this Beacon\n * @param newImplementation New implementation to delegate calls from Beacon Proxies\n */\n function upgradeTo(address newImplementation) external;\n\n /**\n * Returns address of the current used by Beacon Proxies\n */\n function implementation() external view returns (address);\n}\n" }, "contracts/libraries/CommandLibrary.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Command} from \"contracts/interfaces/accountAbstraction/interpreter/Command.sol\";\nimport {SafeCall} from \"contracts/libraries/SafeCall.sol\";\n\n/**\n * @notice Utility to convert often-used methods into a Command object\n */\nlibrary CommandPresets {\n function approve(\n address _token,\n address _to,\n uint256 _amount\n ) internal pure returns (Command memory cmd_) {\n cmd_.target = _token;\n cmd_.payload = abi.encodeCall(IERC20.approve, (_to, _amount));\n }\n\n function transfer(\n address _token,\n address _to,\n uint256 _amount\n ) internal pure returns (Command memory cmd_) {\n cmd_.target = _token;\n cmd_.payload = abi.encodeCall(IERC20.transfer, (_to, _amount));\n }\n}\n\nlibrary CommandExecutor {\n using SafeCall for Command[];\n\n function execute(Command[] calldata _cmds) external {\n _cmds.safeCallAll();\n }\n}\n\nlibrary CommandLibrary {\n using CommandLibrary for Command[];\n\n function last(Command[] memory _self) internal pure returns (Command memory) {\n return _self[_self.length - 1];\n }\n\n function asArray(Command memory _self) internal pure returns (Command[] memory result_) {\n result_ = new Command[](1);\n result_[0] = _self;\n }\n\n function concat(\n Command memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](2);\n result_[0] = _self;\n result_[1] = _cmd;\n }\n\n function concat(\n Command memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_cmds.length + 1);\n result_[0] = _self;\n for (uint256 i = 1; i < result_.length; i++) {\n result_[i] = _cmds[i - 1];\n }\n }\n\n function append(\n Command[] memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_self.length + _cmds.length);\n uint256 i;\n for (; i < _self.length; i++) {\n result_[i] = _self[i];\n }\n for (; i < result_.length; i++) {\n result_[i] = _cmds[i - _self.length];\n }\n }\n\n function push(\n Command[] memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_self.length + 1);\n for (uint256 i; i < _self.length; i++) {\n result_[i] = _self[i];\n }\n result_[_self.length] = _cmd;\n }\n\n function unshift(\n Command[] memory _self,\n Command memory _cmd\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](1 + _self.length);\n result_[0] = _cmd;\n for (uint256 i = 1; i < result_.length; i++) {\n result_[i] = _self[i - 1];\n }\n }\n\n function unshift(\n Command[] memory _self,\n Command[] memory _cmds\n ) internal pure returns (Command[] memory result_) {\n result_ = new Command[](_cmds.length + _self.length);\n uint256 i;\n for (; i < _cmds.length; i++) {\n result_[i] = _cmds[i];\n }\n for (; i < result_.length; i++) {\n result_[i] = _self[i - _cmds.length];\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n if (_amount != 0) {\n result_ = CommandPresets.approve(_token, _self.target, _amount).concat(_self);\n } else {\n result_ = _self.asArray();\n }\n }\n\n function populateWithRevokeAndApprove(\n Command memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n return\n CommandPresets.approve(_token, _self.target, 0).concat(\n _self.populateWithApprove(_token, _amount)\n );\n }\n\n function populateWithApprove(\n Command[] memory _self,\n address _token,\n uint256 _amount\n ) internal pure returns (Command[] memory result_) {\n if (_amount != 0) {\n result_ = _self.unshift(\n CommandPresets.approve(_token, _self[_self.length - 1].target, _amount)\n );\n } else {\n result_ = _self;\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[2] memory _tokens,\n uint256[2] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(_self);\n } else {\n if (_amounts[0] != 0) {\n result_ = populateWithApprove(_self, _tokens[0], _amounts[0]);\n } else {\n result_ = populateWithApprove(_self, _tokens[1], _amounts[1]);\n }\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[3] memory _tokens,\n uint256[3] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0 && _amounts[2] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(CommandPresets.approve(_tokens[2], _self.target, _amounts[2]))\n .push(_self);\n } else {\n if (_amounts[0] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[1], _tokens[2]],\n [_amounts[1], _amounts[2]]\n );\n } else if (_amounts[1] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[2]],\n [_amounts[0], _amounts[2]]\n );\n } else {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1]],\n [_amounts[0], _amounts[1]]\n );\n }\n }\n }\n\n function populateWithApprove(\n Command memory _self,\n address[4] memory _tokens,\n uint256[4] memory _amounts\n ) internal pure returns (Command[] memory result_) {\n if (_amounts[0] != 0 && _amounts[1] != 0 && _amounts[2] != 0 && _amounts[3] != 0) {\n result_ = CommandPresets\n .approve(_tokens[0], _self.target, _amounts[0])\n .concat(CommandPresets.approve(_tokens[1], _self.target, _amounts[1]))\n .push(CommandPresets.approve(_tokens[2], _self.target, _amounts[2]))\n .push(CommandPresets.approve(_tokens[3], _self.target, _amounts[3]))\n .push(_self);\n } else {\n if (_amounts[0] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[1], _tokens[2], _tokens[3]],\n [_amounts[1], _amounts[2], _amounts[3]]\n );\n } else if (_amounts[1] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[2], _tokens[3]],\n [_amounts[0], _amounts[2], _amounts[3]]\n );\n } else if (_amounts[2] == 0) {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1], _tokens[3]],\n [_amounts[0], _amounts[1], _amounts[3]]\n );\n } else {\n result_ = populateWithApprove(\n _self,\n [_tokens[0], _tokens[1], _tokens[2]],\n [_amounts[0], _amounts[1], _amounts[2]]\n );\n }\n }\n }\n}\n" }, "contracts/libraries/SafeCall.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {Command} from \"contracts/interfaces/accountAbstraction/interpreter/Command.sol\";\n\n/**\n * @notice Safe methods performing a low-level calls that revert\n * if the call was not successful\n */\nlibrary SafeCall {\n using Address for address;\n\n function safeCallAll(Command[] memory _cmds) internal {\n for (uint256 i; i < _cmds.length; i++) {\n safeCall(_cmds[i]);\n }\n }\n\n function safeCall(Command memory _cmd) internal returns (bytes memory result_) {\n result_ = safeCall(_cmd.target, _cmd.value, _cmd.payload);\n }\n\n function safeCall(address _target, bytes memory _data) internal returns (bytes memory result_) {\n result_ = safeCall(_target, 0, _data);\n }\n\n function safeCall(\n address _target,\n uint256 _value,\n bytes memory _data\n ) internal returns (bytes memory result_) {\n result_ = _target.functionCallWithValue(_data, _value);\n }\n\n function safeDelegateCall(\n address _target,\n bytes memory _data\n ) internal returns (bytes memory result_) {\n result_ = _target.functionDelegateCall(_data);\n }\n}\n" } }, "settings": { "viaIR": false, "optimizer": { "enabled": true, "runs": 1000000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
96e2d5e67894d218569ce736f05e57d052eb1d99
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
fedd6236daa2afd1609447657ef1abd3b1ff13e4
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
144f9f9eb0fba6f9f7e3267386b99541c3d3ee92
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
6418affc6b05db4fa78b52d027398e88ad748af0
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
cb16fec2923e5b1f13acc7e9322e174075853953
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
d07797c46fcfe7a620a2cc911103042c1198f524
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
3580f8c8c2a27b86d5388077a860eb0262b7776d
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
440f3168e0760ce355c38c8960d357cd04f741c2
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
ebf9b751a0d6ff0fbe936c78f3921fae6da3e4b0
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
8994b545001dc9b14b246f7896b5aceb9f524027
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
84e16133695c9d75162773323ba4c6cdae478007
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
869504345c66f9dd45d1eb1811c92c748e252e6a
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
ef2dec794e8f666aaac8bea4aa16e015f44d4215
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
1f93eb68cdd9771de609fd3edfec339a20c68d2d
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
1f2cc36d55170373467ce925656b145d0e305a2c
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
4a2388890e520c6cfdecae0f309c57fa3be22578
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
02a3551cfbcb36f2bdbb3c40022e497cc7e7242c
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
70db4f54f074ef682df99d20454c29522ef23582
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
8c077aeec196dec1042f5076834bcfa09c27d2bc
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
1ada71412631283865f9f13ffe2934a2a8097ecb
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
202efd8930e53e3221dcef22534494928de23c57
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
5c99e655d135b0f5c7cb4681b21986fe17632baa
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
b09b7c20856c9dbc42dd2de7fc7f80f07461d700
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
b2fd71619f4124961be6c6b76e9223aa66233f00
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
900bf6273b87a6057c7fd7a02743606d38130a22
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
2ab56ffe540dfeaad9e1e40ef2b4c1021df2c370
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
497ab4962b4bd488ed19c3878a01e2aebe18d21d
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
14ba522e9498a659c33266efea823d136f878fe2
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
5a44e535be9ce16e39dcda94d216c651158e251f
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
0b524451d8987991ceadf84ddb8cd854d86b8615
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
d30fd04b6de462bc2a71d8b63294cd3673c43efe
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
158eaa8ee08b12794042f0381de4416c50fb1aa9
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
240b95aad79a92be1dc0cc809a4024fa7c03c7dd
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
fd4c20c8057f4ef3fbea19ed71bff32955ff25d3
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
59f046b5933b186a5e893241bde7f58b234c2c13
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,329
dc8cc15a24970ab715ed5ec079ee7cba293ba6e5917ed850185d92d6911548ce
6db2cfe278711eb0f0c67df654b40f4f581a6ca2c10bf5821a127ef468273510
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
f5e0825a25118c8d69c4424d6b22a7ddb4343226
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,331
4c896bb081f490e72157836259730ed5807a054ea8419a6a302b66d4d8e29aaf
6a1be6ad2f1024cf28ae2e510db56732d293aa617adbad87b838d2c4726d8ea4
58890a9cb27586e83cb51d2d26bbe18a1a647245
58890a9cb27586e83cb51d2d26bbe18a1a647245
af4bc205429cc6677b891701e94fdb1d6316c682
6101a06040523480156200001257600080fd5b506040516200549a3803806200549a833981016040819052620000359162000144565b86868860200151838787848484848462000055336200011460201b60201c565b6000805160206200547a833981519152546040516001600160a01b03909116906000907fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a908290a36033805460ff191690556001600160601b0319606095861b811660805292851b831660a05290841b821660c05291831b811660e052610100919091528751821b811661012052602090970151811b8716610140529a8b1b86166101605250505050509190941b1661018052506200022b9350505050565b6000805160206200547a83398151915255565b80516001600160a01b03811681146200013f57600080fd5b919050565b60008060008060008060008789036101008112156200016257600080fd5b60408112156200017157600080fd5b50604080519081016001600160401b0381118282101715620001a357634e487b7160e01b600052604160045260246000fd5b604052620001b18962000127565b8152620001c160208a0162000127565b60208201529650620001d66040890162000127565b9550620001e66060890162000127565b9450620001f66080890162000127565b935060a088015192506200020d60c0890162000127565b91506200021d60e0890162000127565b905092959891949750929550565b60805160601c60a05160601c60c05160601c60e05160601c610100516101205160601c6101405160601c6101605160601c6101805160601c615092620003e86000396000818161039501528181610b67015261348b0152600081816104850152612a8c01526000818161057301528181610f4701528181611e960152818161200f01528181612c780152612f1301526000610b33015260008181610737015261176401526000818161086601528181610d0f01528181611dc40152818161205f0152818161240a01528181613a7b0152613cd50152600081816108ba01528181610de50152818161129801528181611cc701528181612a5c0152612e3a015260008181610a8801526119d90152600081816103c70152818161098b01528181610a0201528181610c7601528181610fbc01528181611462015281816114c60152818161169a0152818161186201528181611f8001528181612030015281816123840152818161243901528181612ced01528181612f9e0152818161304601528181613590015281816136110152818161365301528181613923015281816139f501528181613aaa01528181613c4f0152613d0401526150926000f3fe6080604052600436106103855760003560e01c8063853828b6116101d1578063b16b7d0b11610102578063d9f00ec7116100a0578063de5f62681161006f578063de5f626814610b9f578063e752923914610bb4578063ee7afe2d14610bca578063f6ca71b014610bdf57600080fd5b8063d9f00ec714610b01578063dbe55e5614610b21578063dd505df614610b55578063de34d71314610b8957600080fd5b8063cceab750116100dc578063cceab75014610a76578063d059f6ef14610aaa578063d38bfff414610ac1578063d9caed1214610ae157600080fd5b8063b16b7d0b14610a24578063c2e1e3f414610a41578063c7af335214610a6157600080fd5b80639da0e4621161016f578063aa388af611610149578063aa388af61461096e578063ab12edf5146109bb578063ad1728cb146109db578063ad5c4648146109f057600080fd5b80639da0e462146108fc578063a3b81e7314610939578063a4f98af41461095957600080fd5b80639092c31c116101ab5780639092c31c146108545780639136616a1461088857806391649751146108a857806396d538bb146108dc57600080fd5b8063853828b6146107fa57806387bae8671461080f5780638d7c0e461461083457600080fd5b80635c975abb116102b65780636ef38795116102545780637b2d9b2c116102235780637b2d9b2c146107995780637b8962f7146107b9578063842f5c46146107cf5780638456cb59146107e557600080fd5b80636ef3879514610705578063714897df1461072557806371a735f3146107595780637260f8261461077957600080fd5b80636309238311610290578063630923831461069957806366e3667e146106af57806367c7066c146106c55780636e811d38146106e557600080fd5b80635c975abb146106405780635d36b190146106645780635f5152261461067957600080fd5b8063430bf08a11610323578063484be812116102fd578063484be812146105d55780635205c380146105eb57806359b80c0a1461060b5780635a063f631461062b57600080fd5b8063430bf08a14610561578063435356d11461059557806347e7ef24146105b557600080fd5b80630fc3b4c41161035f5780630fc3b4c4146104c75780631072cbea146104fd57806322495dc81461051d5780633c8649591461053d57600080fd5b80630c340a24146104415780630df1ecfd146104735780630ed57b3a146104a757600080fd5b3661043c57336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806103e95750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b61043a5760405162461bcd60e51b815260206004820152601e60248201527f457468206e6f742066726f6d20616c6c6f77656420636f6e747261637473000060448201526064015b60405180910390fd5b005b600080fd5b34801561044d57600080fd5b50610456610c01565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561047f57600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b3480156104b357600080fd5b5061043a6104c2366004614360565b610c1e565b3480156104d357600080fd5b506104566104e2366004614326565b609f602052600090815260409020546001600160a01b031681565b34801561050957600080fd5b5061043a6105183660046143da565b610c50565b34801561052957600080fd5b5061043a610538366004614582565b610d0d565b34801561054957600080fd5b5061055360695481565b60405190815260200161046a565b34801561056d57600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b3480156105a157600080fd5b5061043a6105b0366004614447565b610e57565b3480156105c157600080fd5b5061043a6105d03660046143da565b610f3c565b3480156105e157600080fd5b50610553606a5481565b3480156105f757600080fd5b5061043a610606366004614658565b611037565b34801561061757600080fd5b5061043a6106263660046144ce565b611096565b34801561063757600080fd5b5061043a611319565b34801561064c57600080fd5b5060335460ff165b604051901515815260200161046a565b34801561067057600080fd5b5061043a6113b8565b34801561068557600080fd5b50610553610694366004614326565b61145e565b3480156106a557600080fd5b50610553611c2081565b3480156106bb57600080fd5b5061055360345481565b3480156106d157600080fd5b5060a354610456906001600160a01b031681565b3480156106f157600080fd5b5061043a610700366004614326565b61156f565b34801561071157600080fd5b5061043a610720366004614406565b6115e5565b34801561073157600080fd5b506105537f000000000000000000000000000000000000000000000000000000000000000081565b34801561076557600080fd5b5061043a6107743660046146dc565b611baf565b34801561078557600080fd5b50603654610456906001600160a01b031681565b3480156107a557600080fd5b506104566107b4366004614658565b611d98565b3480156107c557600080fd5b5061055360375481565b3480156107db57600080fd5b5061055360685481565b3480156107f157600080fd5b5061043a611dc2565b34801561080657600080fd5b5061043a611e8b565b34801561081b57600080fd5b506033546104569061010090046001600160a01b031681565b34801561084057600080fd5b5061043a61084f36600461475d565b61205d565b34801561086057600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b34801561089457600080fd5b5061043a6108a3366004614658565b61255f565b3480156108b457600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b3480156108e857600080fd5b5061043a6108f7366004614406565b61272b565b34801561090857600080fd5b5061092c610917366004614658565b60356020526000908152604090205460ff1681565b60405161046a9190614c50565b34801561094557600080fd5b5061043a610954366004614326565b61284b565b34801561096557600080fd5b506106546128b9565b34801561097a57600080fd5b50610654610989366004614326565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b3480156109c757600080fd5b5061043a6109d63660046147a2565b612959565b3480156109e757600080fd5b5061043a612a45565b3480156109fc57600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b348015610a3057600080fd5b506105536801bc16d674ec80000081565b348015610a4d57600080fd5b5061043a610a5c366004614326565b612b0b565b348015610a6d57600080fd5b50610654612b98565b348015610a8257600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b348015610ab657600080fd5b506105536101075481565b348015610acd57600080fd5b5061043a610adc366004614326565b612bc9565b348015610aed57600080fd5b5061043a610afc366004614399565b612c6d565b348015610b0d57600080fd5b5061043a610b1c366004614671565b612d47565b348015610b2d57600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b348015610b6157600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b348015610b9557600080fd5b5061055360385481565b348015610bab57600080fd5b5061043a612f08565b348015610bc057600080fd5b50610553606b5481565b348015610bd657600080fd5b5061043a613075565b348015610beb57600080fd5b50610bf46130ff565b60405161046a9190614a2e565b6000610c1960008051602061503d8339815191525490565b905090565b610c26612b98565b610c425760405162461bcd60e51b815260040161043190614cc2565b610c4c8282613161565b5050565b610c58612b98565b610c745760405162461bcd60e51b815260040161043190614cc2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b039081169083161415610cf15760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74207472616e7366657220737570706f72746564206173736574006044820152606401610431565b610c4c610cfc610c01565b6001600160a01b03841690836132c0565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663570d8e1d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6657600080fd5b505afa158015610d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9e9190614343565b6001600160a01b0316336001600160a01b031614610dce5760405162461bcd60e51b815260040161043190614dad565b60405163bc26e7e560e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063bc26e7e590610e2090309087908790879060040161497e565b600060405180830381600087803b158015610e3a57600080fd5b505af1158015610e4e573d6000803e3d6000fd5b50505050505050565b610e5f612b98565b610e7b5760405162461bcd60e51b815260040161043190614cc2565b600054610100900460ff1680610e94575060005460ff16155b610ef75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610431565b600054610100900460ff16158015610f19576000805461ffff19166101011790555b610f24848484613317565b8015610f36576000805461ff00191690555b50505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610f845760405162461bcd60e51b815260040161043190614c8b565b60008051602061501d83398151915280546002811415610fb65760405162461bcd60e51b815260040161043190614d85565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b03161461100b5760405162461bcd60e51b815260040161043190614cf9565b82610107600082825461101e9190614ed4565b9091555061102e905084846133d2565b50600190555050565b61103f612b98565b61105b5760405162461bcd60e51b815260040161043190614cc2565b60378190556040518181527fe26b067424903962f951f568e52ec9a3bbe1589526ea54a4e69ca6eaae1a4c779060200160405180910390a150565b60335461010090046001600160a01b031633146110c55760405162461bcd60e51b815260040161043190614d4e565b60335460ff16156110e85760405162461bcd60e51b815260040161043190614d24565b8683146111375760405162461bcd60e51b815260206004820152601a60248201527f5075626b65792073686172657344617461206d69736d617463680000000000006044820152606401610431565b60008060005b89811015611280578a8a8281811061115757611157614fcd565b90506020028101906111699190614de4565b604051611177929190614952565b6040805191829003909120600081815260356020529182205490945060ff1692508260048111156111aa576111aa614fa1565b146111f75760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792072656769737465726564000000006044820152606401610431565b6000838152603560205260409020805460ff19166001179055827facd38e900350661e325d592c959664c0000a306efb2004e7dc283f44e0ea04238c8c8481811061124457611244614fcd565b90506020028101906112569190614de4565b8c8c6040516112689493929190614b75565b60405180910390a261127981614f70565b905061113d565b506040516322f18bf560e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906322f18bf5906112db908d908d908d908d908d908d908d908d90600401614b13565b600060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b5050505050505050505050505050565b60a3546001600160a01b031633146113735760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74207468652048617276657374657200000000006044820152606401610431565b60008051602061501d833981519152805460028114156113a55760405162461bcd60e51b815260040161043190614d85565b600282556113b1613464565b5060019055565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b0316146114535760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610431565b61145c336136a9565b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316146114b15760405162461bcd60e51b815260040161043190614cf9565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561151057600080fd5b505afa158015611524573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115489190614789565b6801bc16d674ec80000060345461155f9190614f0e565b6115699190614ed4565b92915050565b611577612b98565b6115935760405162461bcd60e51b815260040161043190614cc2565b60338054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517f83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f90600090a250565b60335461010090046001600160a01b031633146116145760405162461bcd60e51b815260040161043190614d4e565b60335460ff16156116375760405162461bcd60e51b815260040161043190614d24565b60008051602061501d833981519152805460028114156116695760405162461bcd60e51b815260040161043190614d85565b6002825560006116826801bc16d674ec80000085614f0e565b6040516370a0823160e01b81523060048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b1580156116e457600080fd5b505afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c9190614789565b81111561175f5760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae8aa89607b1b6044820152606401610431565b6034547f00000000000000000000000000000000000000000000000000000000000000009061178f908690614ed4565b11156117d65760405162461bcd60e51b815260206004820152601660248201527513585e081d985b1a59185d1bdc9cc81c995858da195960521b6044820152606401610431565b603754816038546117e79190614ed4565b11156118355760405162461bcd60e51b815260206004820152601a60248201527f5374616b696e6720455448206f766572207468726573686f6c640000000000006044820152606401610431565b80603860008282546118479190614ed4565b9091555050604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156118ae57600080fd5b505af11580156118c2573d6000803e3d6000fd5b505050506118cf8161376a565b60408051600160f81b60208201526000602182018190526bffffffffffffffffffffffff193060601b16602c8301529101604051602081830303815290604052905060005b85811015611b8857600087878381811061193057611930614fcd565b90506020028101906119429190614e2a565b61194c9080614de4565b60405161195a929190614952565b6040519081900390209050600160008281526035602052604090205460ff16600481111561198a5761198a614fa1565b146119d75760405162461bcd60e51b815260206004820152601860248201527f56616c696461746f72206e6f74207265676973746572656400000000000000006044820152606401610431565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663228951186801bc16d674ec8000008a8a86818110611a2257611a22614fcd565b9050602002810190611a349190614e2a565b611a3e9080614de4565b878d8d89818110611a5157611a51614fcd565b9050602002810190611a639190614e2a565b611a71906020810190614de4565b8f8f8b818110611a8357611a83614fcd565b9050602002810190611a959190614e2a565b604001356040518863ffffffff1660e01b8152600401611aba96959493929190614bdd565b6000604051808303818588803b158015611ad357600080fd5b505af1158015611ae7573d6000803e3d6000fd5b5050506000838152603560205260409020805460ff19166002179055508190507f958934bb53d6b4dc911b6173e586864efbc8076684a31f752c53d5778340b37f898985818110611b3a57611b3a614fcd565b9050602002810190611b4c9190614e2a565b611b569080614de4565b6801bc16d674ec800000604051611b6f93929190614c2c565b60405180910390a250611b8181614f70565b9050611914565b508585905060346000828254611b9e9190614ed4565b909155505060019093555050505050565b60335461010090046001600160a01b03163314611bde5760405162461bcd60e51b815260040161043190614d4e565b60335460ff1615611c015760405162461bcd60e51b815260040161043190614d24565b60008585604051611c13929190614952565b604080519182900390912060008181526035602052919091205490915060ff166003816004811115611c4757611c47614fa1565b1480611c6457506001816004811115611c6257611c62614fa1565b145b611cb05760405162461bcd60e51b815260206004820152601d60248201527f56616c696461746f72206e6f742072656764206f722065786974696e670000006044820152606401610431565b6040516312b3fc1960e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906312b3fc1990611d04908a908a908a908a908a90600401614b9c565b600060405180830381600087803b158015611d1e57600080fd5b505af1158015611d32573d6000803e3d6000fd5b50505060008381526035602052604090819020805460ff19166004179055518391507f6aecca20726a17c1b81989b2fd09dfdf636bae9e564d4066ca18df62dc1f3dc290611d87908a908a908a908a90614b75565b60405180910390a250505050505050565b60a48181548110611da857600080fd5b6000918252602090912001546001600160a01b0316905081565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663570d8e1d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1b57600080fd5b505afa158015611e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e539190614343565b6001600160a01b0316336001600160a01b031614611e835760405162461bcd60e51b815260040161043190614dad565b61145c613797565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480611eda5750611ec5610c01565b6001600160a01b0316336001600160a01b0316145b611f325760405162461bcd60e51b815260206004820152602360248201527f43616c6c6572206973206e6f7420746865205661756c74206f7220476f7665726044820152623737b960e91b6064820152608401610431565b60008051602061501d83398151915280546002811415611f645760405162461bcd60e51b815260040161043190614d85565b600282556040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015611fca57600080fd5b505afa158015611fde573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120029190614789565b90508015612055576120557f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008361380c565b505060019055565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663570d8e1d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156120b657600080fd5b505afa1580156120ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ee9190614343565b6001600160a01b0316336001600160a01b03161461211e5760405162461bcd60e51b815260040161043190614dad565b60335460ff166121675760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610431565b60008051602061501d833981519152805460028114156121995760405162461bcd60e51b815260040161043190614d85565b6002825543611c20606b546121ae9190614ed4565b106121fb5760405162461bcd60e51b815260206004820152601e60248201527f466978206163636f756e74696e672063616c6c656420746f6f20736f6f6e00006044820152606401610431565b600219851215801561220e575060038513155b801561222857506000856034546122259190614e93565b12155b6122745760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642076616c696461746f727344656c74610000000000000000006044820152606401610431565b6811ff6cf0fd15afffff19841215801561229757506811ff6cf0fd15b000008413155b80156122b157506000846068546122ae9190614e93565b12155b6122fd5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c696420636f6e73656e7375735265776172647344656c74610000006044820152606401610431565b68053444835ec58000008311156123565760405162461bcd60e51b815260206004820152601960248201527f496e76616c69642077657468546f5661756c74416d6f756e74000000000000006044820152606401610431565b846034546123649190614e93565b603455606854612375908590614e93565b60685543606b5582156124c3577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b1580156123dd57600080fd5b505af11580156123f1573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018890527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb92506044019050602060405180830381600087803b15801561248157600080fd5b505af1158015612495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b9919061463b565b506124c38361390a565b60408051868152602081018690529081018490527f80d022717ea022455c5886b8dd8a29c037570aae58aeb4d7b136d7a10ec2e4319060600160405180910390a161250e6000613972565b61254d5760405162461bcd60e51b815260206004820152601060248201526f233ab9b29039ba34b63610313637bbb760811b6044820152606401610431565b612555613df8565b5060019055505050565b612567612b98565b6125835760405162461bcd60e51b815260040161043190614cc2565b60a05481106125c45760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610431565b600060a082815481106125d9576125d9614fcd565b60009182526020808320909101546001600160a01b03908116808452609f90925260409092205460a0549193509091169061261690600190614f2d565b8310156126985760a0805461262d90600190614f2d565b8154811061263d5761263d614fcd565b60009182526020909120015460a080546001600160a01b03909216918590811061266957612669614fcd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60a08054806126a9576126a9614fb7565b60008281526020808220600019908401810180546001600160a01b031990811690915593019093556001600160a01b03858116808352609f855260409283902080549094169093559051908416815290917f16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c91015b60405180910390a2505050565b612733612b98565b61274f5760405162461bcd60e51b815260040161043190614cc2565b8060005b8181101561280257600084848381811061276f5761276f614fcd565b90506020020160208101906127849190614326565b6001600160a01b031614156127f25760405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f742073657420616e20656d70747920616464726573732061732060448201526d30903932bbb0b932103a37b5b2b760911b6064820152608401610431565b6127fb81614f70565b9050612753565b507f04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc60a4848460405161283793929190614a7b565b60405180910390a1610f3660a4848461407f565b612853612b98565b61286f5760405162461bcd60e51b815260040161043190614cc2565b603680546001600160a01b0319166001600160a01b0383169081179091556040517f3329861a0008b3348767567d2405492b997abd79a088d0f2cef6b1a09a8e7ff790600090a250565b60335460009061010090046001600160a01b031633146128eb5760405162461bcd60e51b815260040161043190614d4e565b60335460ff161561290e5760405162461bcd60e51b815260040161043190614d24565b60008051602061501d833981519152805460028114156129405760405162461bcd60e51b815260040161043190614d85565b6002825561294e6001613972565b925060018255505090565b612961612b98565b61297d5760405162461bcd60e51b815260040161043190614cc2565b808210801561299457506801bc16d674ec80000081105b80156129b15750673782dace9d9000006129ae8383614f2d565b10155b6129fd5760405162461bcd60e51b815260206004820152601760248201527f496e636f7272656374206675736520696e74657276616c0000000000000000006044820152606401610431565b6069829055606a81905560408051838152602081018390527fcb8d24e46eb3c402bf344ee60a6576cba9ef2f59ea1af3b311520704924e901a91015b60405180910390a15050565b60405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260001960248301527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b390604401602060405180830381600087803b158015612ad057600080fd5b505af1158015612ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b08919061463b565b50565b612b13612b98565b612b2f5760405162461bcd60e51b815260040161043190614cc2565b60a354604080516001600160a01b03928316815291831660208301527fe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796910160405180910390a160a380546001600160a01b0319166001600160a01b0392909216919091179055565b6000612bb060008051602061503d8339815191525490565b6001600160a01b0316336001600160a01b031614905090565b612bd1612b98565b612bed5760405162461bcd60e51b815260040161043190614cc2565b612c15817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b0316612c3560008051602061503d8339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612cb55760405162461bcd60e51b815260040161043190614c8b565b60008051602061501d83398151915280546002811415612ce75760405162461bcd60e51b815260040161043190614d85565b600282557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031614612d3c5760405162461bcd60e51b815260040161043190614cf9565b61255585858561380c565b60335461010090046001600160a01b03163314612d765760405162461bcd60e51b815260040161043190614d4e565b60335460ff1615612d995760405162461bcd60e51b815260040161043190614d24565b60008484604051612dab929190614952565b604080519182900390912060008181526035602052919091205490915060ff166002816004811115612ddf57612ddf614fa1565b14612e235760405162461bcd60e51b815260206004820152601460248201527315985b1a59185d1bdc881b9bdd081cdd185ad95960621b6044820152606401610431565b604051633877322b60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633877322b90612e75908990899089908990600401614b75565b600060405180830381600087803b158015612e8f57600080fd5b505af1158015612ea3573d6000803e3d6000fd5b50505060008381526035602052604090819020805460ff19166003179055518391507f8c2e15303eb94e531acc988c2a01d1193bdaaa15eda7f16dda85316ed463578d90612ef8908990899089908990614b75565b60405180910390a2505050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612f505760405162461bcd60e51b815260040161043190614c8b565b60008051602061501d83398151915280546002811415612f825760405162461bcd60e51b815260040161043190614d85565b600282556040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015612fe857600080fd5b505afa158015612ffc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130209190614789565b9050600061010754826130339190614f2d565b9050801561306b5761010782905561306b7f0000000000000000000000000000000000000000000000000000000000000000826133d2565b5050600182555050565b6036546001600160a01b031633146130cf5760405162461bcd60e51b815260206004820152601960248201527f43616c6c6572206973206e6f7420746865204d6f6e69746f72000000000000006044820152606401610431565b600060388190556040517fe765a88a37047c5d793dce22b9ceb5a0f5039d276da139b4c7d29613f341f1109190a1565b606060a480548060200260200160405190810160405280929190818152602001828054801561315757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613139575b5050505050905090565b6001600160a01b038281166000908152609f602052604090205416156131be5760405162461bcd60e51b81526020600482015260126024820152711c151bdad95b88185b1c9958591e481cd95d60721b6044820152606401610431565b6001600160a01b038216158015906131de57506001600160a01b03811615155b61321e5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642061646472657373657360781b6044820152606401610431565b6001600160a01b038281166000818152609f6020908152604080832080549587166001600160a01b0319968716811790915560a0805460018101825594527f78fdc8d422c49ced035a9edf18d00d3c6a8d81df210f3e5e448e045e77b41e8890930180549095168417909455925190815290917fef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765910160405180910390a25050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613312908490613e72565b505050565b825161332a9060a49060208601906140e2565b508151815181146133745760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420696e7075742061727261797360601b6044820152606401610431565b60005b818110156133cb576133bb84828151811061339457613394614fcd565b60200260200101518483815181106133ae576133ae614fcd565b6020026020010151613161565b6133c481614f70565b9050613377565b5050505050565b6000811161341b5760405162461bcd60e51b81526020600482015260166024820152754d757374206465706f73697420736f6d657468696e6760501b6044820152606401610431565b6040805160008152602081018390526001600160a01b038416917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a25050565b60335460ff16156134875760405162461bcd60e51b815260040161043190614d24565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e52253816040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156134e457600080fd5b505af11580156134f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061351c9190614789565b905060006068548261352e9190614ed4565b9050804710156135805760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e74206574682062616c616e636500000000000000006044820152606401610431565b8015610c4c5760006068819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156135e957600080fd5b505af11580156135fd573d6000803e3d6000fd5b505060a35461363d93506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169350169050836132c0565b60a354604080516001600160a01b0392831681527f0000000000000000000000000000000000000000000000000000000000000000909216602083015281018290527ff6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c7235390606001612a39565b6001600160a01b0381166136ff5760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610431565b806001600160a01b031661371f60008051602061503d8339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3612b088160008051602061503d83398151915255565b60006137798261010754613f44565b905080610107600082825461378e9190614f2d565b90915550505050565b60335460ff16156137ba5760405162461bcd60e51b815260040161043190614d24565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586137ef3390565b6040516001600160a01b03909116815260200160405180910390a1565b6000811161385c5760405162461bcd60e51b815260206004820152601760248201527f4d75737420776974686472617720736f6d657468696e670000000000000000006044820152606401610431565b6001600160a01b0383166138ab5760405162461bcd60e51b8152602060048201526016602482015275135d5cdd081cdc1958da599e481c9958da5c1a595b9d60521b6044820152606401610431565b6138b48161376a565b6138c86001600160a01b03831684836132c0565b6040805160008152602081018390526001600160a01b038416917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398910161271e565b6040805160008152602081018390526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398910160405180910390a250565b60006068544710156139875761156982613f5c565b6000606854476139979190614f2d565b9050600191506801bc16d674ec8000008110613b7b5760006139c26801bc16d674ec80000083614eec565b905080603460008282546139d69190614f2d565b90915550600090506139f1826801bc16d674ec800000614f0e565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613a4e57600080fd5b505af1158015613a62573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018690527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb92506044019050602060405180830381600087803b158015613af257600080fd5b505af1158015613b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b2a919061463b565b50613b348161390a565b60345460408051848152602081019290925281018290527fbe7040030ff7b347853214bf49820c6d455fedf58f3815f85c7bc5216993682b9060600160405180910390a150505b600060685447613b8b9190614f2d565b90506801bc16d674ec8000008110613bdd5760405162461bcd60e51b8152602060048201526015602482015274556e6578706563746564206163636f756e74696e6760581b6044820152606401610431565b80613be9575050919050565b606954811015613c43578060686000828254613c059190614ed4565b90915550506040518181527f7a745a2c63a535068f52ceca27debd5297bbad5f7f37ec53d044a59d0362445d906020015b60405180910390a1613df1565b606a54811115613de0577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613ca857600080fd5b505af1158015613cbc573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018690527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb92506044019050602060405180830381600087803b158015613d4c57600080fd5b505af1158015613d60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d84919061463b565b50600160346000828254613d989190614f2d565b90915550613da790508161390a565b60345460408051918252602082018390527f6aa7e30787b26429ced603a7aba8b19c4b5d5bcf29a3257da953c8d53bcaa3a69101613c36565b613de984613f5c565b949350505050565b5050919050565b60335460ff16613e415760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610431565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336137ef565b6000613ec7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613f749092919063ffffffff16565b8051909150156133125780806020019051810190613ee5919061463b565b6133125760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610431565b6000818310613f535781613f55565b825b9392505050565b60008115613f6c57613f6c613797565b506000919050565b6060613de9848460008585843b613fcd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610431565b600080866001600160a01b03168587604051613fe99190614962565b60006040518083038185875af1925050503d8060008114614026576040519150601f19603f3d011682016040523d82523d6000602084013e61402b565b606091505b509150915061403b828286614046565b979650505050505050565b60608315614055575081613f55565b8251156140655782518084602001fd5b8160405162461bcd60e51b81526004016104319190614c78565b8280548282559060005260206000209081019282156140d2579160200282015b828111156140d25781546001600160a01b0319166001600160a01b0384351617825560209092019160019091019061409f565b506140de929150614137565b5090565b8280548282559060005260206000209081019282156140d2579160200282015b828111156140d257825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614102565b5b808211156140de5760008155600101614138565b60008083601f84011261415e57600080fd5b5081356001600160401b0381111561417557600080fd5b6020830191508360208260051b850101111561419057600080fd5b9250929050565b600082601f8301126141a857600080fd5b813560206141bd6141b883614e70565b614e40565b80838252828201915082860187848660051b89010111156141dd57600080fd5b60005b858110156142055781356141f381614ff9565b845292840192908401906001016141e0565b5090979650505050505050565b60008083601f84011261422457600080fd5b5081356001600160401b0381111561423b57600080fd5b60208301915083602082850101111561419057600080fd5b600060a0828403121561426557600080fd5b50919050565b600060a0828403121561427d57600080fd5b60405160a081018181106001600160401b038211171561429f5761429f614fe3565b6040529050806142ae836142f6565b81526142bc6020840161430f565b60208201526142cd6040840161430f565b604082015260608301356142e08161500e565b6060820152608092830135920191909152919050565b803563ffffffff8116811461430a57600080fd5b919050565b80356001600160401b038116811461430a57600080fd5b60006020828403121561433857600080fd5b8135613f5581614ff9565b60006020828403121561435557600080fd5b8151613f5581614ff9565b6000806040838503121561437357600080fd5b823561437e81614ff9565b9150602083013561438e81614ff9565b809150509250929050565b6000806000606084860312156143ae57600080fd5b83356143b981614ff9565b925060208401356143c981614ff9565b929592945050506040919091013590565b600080604083850312156143ed57600080fd5b82356143f881614ff9565b946020939093013593505050565b6000806020838503121561441957600080fd5b82356001600160401b0381111561442f57600080fd5b61443b8582860161414c565b90969095509350505050565b60008060006060848603121561445c57600080fd5b83356001600160401b038082111561447357600080fd5b61447f87838801614197565b9450602086013591508082111561449557600080fd5b6144a187838801614197565b935060408601359150808211156144b757600080fd5b506144c486828701614197565b9150509250925092565b600080600080600080600080610120898b0312156144eb57600080fd5b88356001600160401b038082111561450257600080fd5b61450e8c838d0161414c565b909a50985060208b013591508082111561452757600080fd5b6145338c838d0161414c565b909850965060408b013591508082111561454c57600080fd5b506145598b828c0161414c565b909550935050606089013591506145738a60808b01614253565b90509295985092959890939650565b600080600060e0848603121561459757600080fd5b83356001600160401b038111156145ad57600080fd5b8401601f810186136145be57600080fd5b803560206145ce6141b883614e70565b8083825282820191508285018a848660051b88010111156145ee57600080fd5b600095505b84861015614618576146048161430f565b8352600195909501949183019183016145f3565b50965050860135935061463291508690506040860161426b565b90509250925092565b60006020828403121561464d57600080fd5b8151613f558161500e565b60006020828403121561466a57600080fd5b5035919050565b6000806000806040858703121561468757600080fd5b84356001600160401b038082111561469e57600080fd5b6146aa88838901614212565b909650945060208701359150808211156146c357600080fd5b506146d08782880161414c565b95989497509550505050565b600080600080600060e086880312156146f457600080fd5b85356001600160401b038082111561470b57600080fd5b61471789838a01614212565b9097509550602088013591508082111561473057600080fd5b5061473d8882890161414c565b909450925061475190508760408801614253565b90509295509295909350565b60008060006060848603121561477257600080fd5b505081359360208301359350604090920135919050565b60006020828403121561479b57600080fd5b5051919050565b600080604083850312156147b557600080fd5b50508035926020909101359150565b81835260006020808501808196508560051b810191508460005b878110156148475782840389528135601e198836030181126147ff57600080fd5b870180356001600160401b0381111561481757600080fd5b80360389131561482657600080fd5b614833868289850161489b565b9a87019a95505050908401906001016147de565b5091979650505050505050565b8183526000602080850194508260005b85811015614890576001600160401b0361487d8361430f565b1687529582019590820190600101614864565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b600081518084526148dc816020860160208601614f44565b601f01601f19169290920160200192915050565b63ffffffff6148fe826142f6565b16825261490d6020820161430f565b6001600160401b0380821660208501528061492a6040850161430f565b166040850152505060608101356149408161500e565b15156060830152608090810135910152565b8183823760009101908152919050565b60008251614974818460208701614f44565b9190910192915050565b6001600160a01b03851681526101006020808301829052855191830182905260009161012084019187810191845b818110156149d15783516001600160401b0316855293820193928201926001016149ac565b505082935086604086015263ffffffff865116606086015280860151925050506001600160401b0380821660808501528060408601511660a085015250506060830151151560c0830152608083015160e083015295945050505050565b6020808252825182820181905260009190848201906040850190845b81811015614a6f5783516001600160a01b031683529284019291840191600101614a4a565b50909695505050505050565b6000604082016040835280865480835260608501915087600052602092508260002060005b82811015614ac55781546001600160a01b031684529284019260019182019101614aa0565b505050838103828501528481528590820160005b86811015614b07578235614aec81614ff9565b6001600160a01b031682529183019190830190600101614ad9565b50979650505050505050565b6000610120808352614b288184018b8d6147c4565b90508281036020840152614b3d81898b614854565b90508281036040840152614b528187896147c4565b915050836060830152614b6860808301846148f0565b9998505050505050505050565b604081526000614b8960408301868861489b565b828103602084015261403b818587614854565b60e081526000614bb060e08301878961489b565b8281036020840152614bc3818688614854565b915050614bd360408301846148f0565b9695505050505050565b608081526000614bf160808301888a61489b565b8281036020840152614c0381886148c4565b90508281036040840152614c1881868861489b565b915050826060830152979650505050505050565b604081526000614c4060408301858761489b565b9050826020830152949350505050565b6020810160058310614c7257634e487b7160e01b600052602160045260246000fd5b91905290565b602081526000613f5560208301846148c4565b60208082526017908201527f43616c6c6572206973206e6f7420746865205661756c74000000000000000000604082015260600190565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b602080825260119082015270155b9cdd5c1c1bdc9d195908185cdcd95d607a1b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601d908201527f43616c6c6572206973206e6f7420746865205265676973747261746f72000000604082015260600190565b6020808252600e908201526d1499595b9d1c985b9d0818d85b1b60921b604082015260600190565b6020808252601c908201527f43616c6c6572206973206e6f7420746865205374726174656769737400000000604082015260600190565b6000808335601e19843603018112614dfb57600080fd5b8301803591506001600160401b03821115614e1557600080fd5b60200191503681900382131561419057600080fd5b60008235605e1983360301811261497457600080fd5b604051601f8201601f191681016001600160401b0381118282101715614e6857614e68614fe3565b604052919050565b60006001600160401b03821115614e8957614e89614fe3565b5060051b60200190565b600080821280156001600160ff1b0384900385131615614eb557614eb5614f8b565b600160ff1b8390038412811615614ece57614ece614f8b565b50500190565b60008219821115614ee757614ee7614f8b565b500190565b600082614f0957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614f2857614f28614f8b565b500290565b600082821015614f3f57614f3f614f8b565b500390565b60005b83811015614f5f578181015183820152602001614f47565b83811115610f365750506000910152565b6000600019821415614f8457614f84614f8b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612b0857600080fd5b8015158114612b0857600080fdfe53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac45357bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa264697066735822122090185a734b1de8826eb108de1e4c3e6d39974867eef4808c4768d017495ca8a464736f6c634300080700337bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000009d65ff81a3c488d585bbfb0bfe3c7707c7917f54000000000000000000000000dd9bc35ae942ef0cfa76930954a156b3ff30a4e100000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000fee31c09fa5e9cdbc1f80c90b42b58640be91ddf00000000000000000000000000000000219ab540356cbb839cbe05303d7705fa
6080604052600436106103855760003560e01c8063853828b6116101d1578063b16b7d0b11610102578063d9f00ec7116100a0578063de5f62681161006f578063de5f626814610b9f578063e752923914610bb4578063ee7afe2d14610bca578063f6ca71b014610bdf57600080fd5b8063d9f00ec714610b01578063dbe55e5614610b21578063dd505df614610b55578063de34d71314610b8957600080fd5b8063cceab750116100dc578063cceab75014610a76578063d059f6ef14610aaa578063d38bfff414610ac1578063d9caed1214610ae157600080fd5b8063b16b7d0b14610a24578063c2e1e3f414610a41578063c7af335214610a6157600080fd5b80639da0e4621161016f578063aa388af611610149578063aa388af61461096e578063ab12edf5146109bb578063ad1728cb146109db578063ad5c4648146109f057600080fd5b80639da0e462146108fc578063a3b81e7314610939578063a4f98af41461095957600080fd5b80639092c31c116101ab5780639092c31c146108545780639136616a1461088857806391649751146108a857806396d538bb146108dc57600080fd5b8063853828b6146107fa57806387bae8671461080f5780638d7c0e461461083457600080fd5b80635c975abb116102b65780636ef38795116102545780637b2d9b2c116102235780637b2d9b2c146107995780637b8962f7146107b9578063842f5c46146107cf5780638456cb59146107e557600080fd5b80636ef3879514610705578063714897df1461072557806371a735f3146107595780637260f8261461077957600080fd5b80636309238311610290578063630923831461069957806366e3667e146106af57806367c7066c146106c55780636e811d38146106e557600080fd5b80635c975abb146106405780635d36b190146106645780635f5152261461067957600080fd5b8063430bf08a11610323578063484be812116102fd578063484be812146105d55780635205c380146105eb57806359b80c0a1461060b5780635a063f631461062b57600080fd5b8063430bf08a14610561578063435356d11461059557806347e7ef24146105b557600080fd5b80630fc3b4c41161035f5780630fc3b4c4146104c75780631072cbea146104fd57806322495dc81461051d5780633c8649591461053d57600080fd5b80630c340a24146104415780630df1ecfd146104735780630ed57b3a146104a757600080fd5b3661043c57336001600160a01b037f000000000000000000000000fee31c09fa5e9cdbc1f80c90b42b58640be91ddf1614806103e95750336001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216145b61043a5760405162461bcd60e51b815260206004820152601e60248201527f457468206e6f742066726f6d20616c6c6f77656420636f6e747261637473000060448201526064015b60405180910390fd5b005b600080fd5b34801561044d57600080fd5b50610456610c01565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561047f57600080fd5b506104567f0000000000000000000000009d65ff81a3c488d585bbfb0bfe3c7707c7917f5481565b3480156104b357600080fd5b5061043a6104c2366004614360565b610c1e565b3480156104d357600080fd5b506104566104e2366004614326565b609f602052600090815260409020546001600160a01b031681565b34801561050957600080fd5b5061043a6105183660046143da565b610c50565b34801561052957600080fd5b5061043a610538366004614582565b610d0d565b34801561054957600080fd5b5061055360695481565b60405190815260200161046a565b34801561056d57600080fd5b506104567f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab81565b3480156105a157600080fd5b5061043a6105b0366004614447565b610e57565b3480156105c157600080fd5b5061043a6105d03660046143da565b610f3c565b3480156105e157600080fd5b50610553606a5481565b3480156105f757600080fd5b5061043a610606366004614658565b611037565b34801561061757600080fd5b5061043a6106263660046144ce565b611096565b34801561063757600080fd5b5061043a611319565b34801561064c57600080fd5b5060335460ff165b604051901515815260200161046a565b34801561067057600080fd5b5061043a6113b8565b34801561068557600080fd5b50610553610694366004614326565b61145e565b3480156106a557600080fd5b50610553611c2081565b3480156106bb57600080fd5b5061055360345481565b3480156106d157600080fd5b5060a354610456906001600160a01b031681565b3480156106f157600080fd5b5061043a610700366004614326565b61156f565b34801561071157600080fd5b5061043a610720366004614406565b6115e5565b34801561073157600080fd5b506105537f00000000000000000000000000000000000000000000000000000000000001f481565b34801561076557600080fd5b5061043a6107743660046146dc565b611baf565b34801561078557600080fd5b50603654610456906001600160a01b031681565b3480156107a557600080fd5b506104566107b4366004614658565b611d98565b3480156107c557600080fd5b5061055360375481565b3480156107db57600080fd5b5061055360685481565b3480156107f157600080fd5b5061043a611dc2565b34801561080657600080fd5b5061043a611e8b565b34801561081b57600080fd5b506033546104569061010090046001600160a01b031681565b34801561084057600080fd5b5061043a61084f36600461475d565b61205d565b34801561086057600080fd5b506104567f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab81565b34801561089457600080fd5b5061043a6108a3366004614658565b61255f565b3480156108b457600080fd5b506104567f000000000000000000000000dd9bc35ae942ef0cfa76930954a156b3ff30a4e181565b3480156108e857600080fd5b5061043a6108f7366004614406565b61272b565b34801561090857600080fd5b5061092c610917366004614658565b60356020526000908152604090205460ff1681565b60405161046a9190614c50565b34801561094557600080fd5b5061043a610954366004614326565b61284b565b34801561096557600080fd5b506106546128b9565b34801561097a57600080fd5b50610654610989366004614326565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0390811691161490565b3480156109c757600080fd5b5061043a6109d63660046147a2565b612959565b3480156109e757600080fd5b5061043a612a45565b3480156109fc57600080fd5b506104567f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b348015610a3057600080fd5b506105536801bc16d674ec80000081565b348015610a4d57600080fd5b5061043a610a5c366004614326565b612b0b565b348015610a6d57600080fd5b50610654612b98565b348015610a8257600080fd5b506104567f00000000000000000000000000000000219ab540356cbb839cbe05303d7705fa81565b348015610ab657600080fd5b506105536101075481565b348015610acd57600080fd5b5061043a610adc366004614326565b612bc9565b348015610aed57600080fd5b5061043a610afc366004614399565b612c6d565b348015610b0d57600080fd5b5061043a610b1c366004614671565b612d47565b348015610b2d57600080fd5b506104567f000000000000000000000000000000000000000000000000000000000000000081565b348015610b6157600080fd5b506104567f000000000000000000000000fee31c09fa5e9cdbc1f80c90b42b58640be91ddf81565b348015610b9557600080fd5b5061055360385481565b348015610bab57600080fd5b5061043a612f08565b348015610bc057600080fd5b50610553606b5481565b348015610bd657600080fd5b5061043a613075565b348015610beb57600080fd5b50610bf46130ff565b60405161046a9190614a2e565b6000610c1960008051602061503d8339815191525490565b905090565b610c26612b98565b610c425760405162461bcd60e51b815260040161043190614cc2565b610c4c8282613161565b5050565b610c58612b98565b610c745760405162461bcd60e51b815260040161043190614cc2565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b039081169083161415610cf15760405162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74207472616e7366657220737570706f72746564206173736574006044820152606401610431565b610c4c610cfc610c01565b6001600160a01b03841690836132c0565b7f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab6001600160a01b031663570d8e1d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6657600080fd5b505afa158015610d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9e9190614343565b6001600160a01b0316336001600160a01b031614610dce5760405162461bcd60e51b815260040161043190614dad565b60405163bc26e7e560e01b81526001600160a01b037f000000000000000000000000dd9bc35ae942ef0cfa76930954a156b3ff30a4e1169063bc26e7e590610e2090309087908790879060040161497e565b600060405180830381600087803b158015610e3a57600080fd5b505af1158015610e4e573d6000803e3d6000fd5b50505050505050565b610e5f612b98565b610e7b5760405162461bcd60e51b815260040161043190614cc2565b600054610100900460ff1680610e94575060005460ff16155b610ef75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610431565b600054610100900460ff16158015610f19576000805461ffff19166101011790555b610f24848484613317565b8015610f36576000805461ff00191690555b50505050565b336001600160a01b037f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab1614610f845760405162461bcd60e51b815260040161043190614c8b565b60008051602061501d83398151915280546002811415610fb65760405162461bcd60e51b815260040161043190614d85565b600282557f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316846001600160a01b03161461100b5760405162461bcd60e51b815260040161043190614cf9565b82610107600082825461101e9190614ed4565b9091555061102e905084846133d2565b50600190555050565b61103f612b98565b61105b5760405162461bcd60e51b815260040161043190614cc2565b60378190556040518181527fe26b067424903962f951f568e52ec9a3bbe1589526ea54a4e69ca6eaae1a4c779060200160405180910390a150565b60335461010090046001600160a01b031633146110c55760405162461bcd60e51b815260040161043190614d4e565b60335460ff16156110e85760405162461bcd60e51b815260040161043190614d24565b8683146111375760405162461bcd60e51b815260206004820152601a60248201527f5075626b65792073686172657344617461206d69736d617463680000000000006044820152606401610431565b60008060005b89811015611280578a8a8281811061115757611157614fcd565b90506020028101906111699190614de4565b604051611177929190614952565b6040805191829003909120600081815260356020529182205490945060ff1692508260048111156111aa576111aa614fa1565b146111f75760405162461bcd60e51b815260206004820152601c60248201527f56616c696461746f7220616c72656164792072656769737465726564000000006044820152606401610431565b6000838152603560205260409020805460ff19166001179055827facd38e900350661e325d592c959664c0000a306efb2004e7dc283f44e0ea04238c8c8481811061124457611244614fcd565b90506020028101906112569190614de4565b8c8c6040516112689493929190614b75565b60405180910390a261127981614f70565b905061113d565b506040516322f18bf560e01b81526001600160a01b037f000000000000000000000000dd9bc35ae942ef0cfa76930954a156b3ff30a4e116906322f18bf5906112db908d908d908d908d908d908d908d908d90600401614b13565b600060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b5050505050505050505050505050565b60a3546001600160a01b031633146113735760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f74207468652048617276657374657200000000006044820152606401610431565b60008051602061501d833981519152805460028114156113a55760405162461bcd60e51b815260040161043190614d85565b600282556113b1613464565b5060019055565b7f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db546001600160a01b0316336001600160a01b0316146114535760405162461bcd60e51b815260206004820152603060248201527f4f6e6c79207468652070656e64696e6720476f7665726e6f722063616e20636f60448201526f6d706c6574652074686520636c61696d60801b6064820152608401610431565b61145c336136a9565b565b60007f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316826001600160a01b0316146114b15760405162461bcd60e51b815260040161043190614cf9565b6040516370a0823160e01b81523060048201527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316906370a082319060240160206040518083038186803b15801561151057600080fd5b505afa158015611524573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115489190614789565b6801bc16d674ec80000060345461155f9190614f0e565b6115699190614ed4565b92915050565b611577612b98565b6115935760405162461bcd60e51b815260040161043190614cc2565b60338054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517f83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f90600090a250565b60335461010090046001600160a01b031633146116145760405162461bcd60e51b815260040161043190614d4e565b60335460ff16156116375760405162461bcd60e51b815260040161043190614d24565b60008051602061501d833981519152805460028114156116695760405162461bcd60e51b815260040161043190614d85565b6002825560006116826801bc16d674ec80000085614f0e565b6040516370a0823160e01b81523060048201529091507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316906370a082319060240160206040518083038186803b1580156116e457600080fd5b505afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c9190614789565b81111561175f5760405162461bcd60e51b8152602060048201526011602482015270092dce6eaccccd2c6d2cadce840ae8aa89607b1b6044820152606401610431565b6034547f00000000000000000000000000000000000000000000000000000000000001f49061178f908690614ed4565b11156117d65760405162461bcd60e51b815260206004820152601660248201527513585e081d985b1a59185d1bdc9cc81c995858da195960521b6044820152606401610431565b603754816038546117e79190614ed4565b11156118355760405162461bcd60e51b815260206004820152601a60248201527f5374616b696e6720455448206f766572207468726573686f6c640000000000006044820152606401610431565b80603860008282546118479190614ed4565b9091555050604051632e1a7d4d60e01b8152600481018290527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156118ae57600080fd5b505af11580156118c2573d6000803e3d6000fd5b505050506118cf8161376a565b60408051600160f81b60208201526000602182018190526bffffffffffffffffffffffff193060601b16602c8301529101604051602081830303815290604052905060005b85811015611b8857600087878381811061193057611930614fcd565b90506020028101906119429190614e2a565b61194c9080614de4565b60405161195a929190614952565b6040519081900390209050600160008281526035602052604090205460ff16600481111561198a5761198a614fa1565b146119d75760405162461bcd60e51b815260206004820152601860248201527f56616c696461746f72206e6f74207265676973746572656400000000000000006044820152606401610431565b7f00000000000000000000000000000000219ab540356cbb839cbe05303d7705fa6001600160a01b031663228951186801bc16d674ec8000008a8a86818110611a2257611a22614fcd565b9050602002810190611a349190614e2a565b611a3e9080614de4565b878d8d89818110611a5157611a51614fcd565b9050602002810190611a639190614e2a565b611a71906020810190614de4565b8f8f8b818110611a8357611a83614fcd565b9050602002810190611a959190614e2a565b604001356040518863ffffffff1660e01b8152600401611aba96959493929190614bdd565b6000604051808303818588803b158015611ad357600080fd5b505af1158015611ae7573d6000803e3d6000fd5b5050506000838152603560205260409020805460ff19166002179055508190507f958934bb53d6b4dc911b6173e586864efbc8076684a31f752c53d5778340b37f898985818110611b3a57611b3a614fcd565b9050602002810190611b4c9190614e2a565b611b569080614de4565b6801bc16d674ec800000604051611b6f93929190614c2c565b60405180910390a250611b8181614f70565b9050611914565b508585905060346000828254611b9e9190614ed4565b909155505060019093555050505050565b60335461010090046001600160a01b03163314611bde5760405162461bcd60e51b815260040161043190614d4e565b60335460ff1615611c015760405162461bcd60e51b815260040161043190614d24565b60008585604051611c13929190614952565b604080519182900390912060008181526035602052919091205490915060ff166003816004811115611c4757611c47614fa1565b1480611c6457506001816004811115611c6257611c62614fa1565b145b611cb05760405162461bcd60e51b815260206004820152601d60248201527f56616c696461746f72206e6f742072656764206f722065786974696e670000006044820152606401610431565b6040516312b3fc1960e01b81526001600160a01b037f000000000000000000000000dd9bc35ae942ef0cfa76930954a156b3ff30a4e116906312b3fc1990611d04908a908a908a908a908a90600401614b9c565b600060405180830381600087803b158015611d1e57600080fd5b505af1158015611d32573d6000803e3d6000fd5b50505060008381526035602052604090819020805460ff19166004179055518391507f6aecca20726a17c1b81989b2fd09dfdf636bae9e564d4066ca18df62dc1f3dc290611d87908a908a908a908a90614b75565b60405180910390a250505050505050565b60a48181548110611da857600080fd5b6000918252602090912001546001600160a01b0316905081565b7f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab6001600160a01b031663570d8e1d6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e1b57600080fd5b505afa158015611e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e539190614343565b6001600160a01b0316336001600160a01b031614611e835760405162461bcd60e51b815260040161043190614dad565b61145c613797565b336001600160a01b037f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab161480611eda5750611ec5610c01565b6001600160a01b0316336001600160a01b0316145b611f325760405162461bcd60e51b815260206004820152602360248201527f43616c6c6572206973206e6f7420746865205661756c74206f7220476f7665726044820152623737b960e91b6064820152608401610431565b60008051602061501d83398151915280546002811415611f645760405162461bcd60e51b815260040161043190614d85565b600282556040516370a0823160e01b81523060048201526000907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316906370a082319060240160206040518083038186803b158015611fca57600080fd5b505afa158015611fde573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120029190614789565b90508015612055576120557f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28361380c565b505060019055565b7f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab6001600160a01b031663570d8e1d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156120b657600080fd5b505afa1580156120ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ee9190614343565b6001600160a01b0316336001600160a01b03161461211e5760405162461bcd60e51b815260040161043190614dad565b60335460ff166121675760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610431565b60008051602061501d833981519152805460028114156121995760405162461bcd60e51b815260040161043190614d85565b6002825543611c20606b546121ae9190614ed4565b106121fb5760405162461bcd60e51b815260206004820152601e60248201527f466978206163636f756e74696e672063616c6c656420746f6f20736f6f6e00006044820152606401610431565b600219851215801561220e575060038513155b801561222857506000856034546122259190614e93565b12155b6122745760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642076616c696461746f727344656c74610000000000000000006044820152606401610431565b6811ff6cf0fd15afffff19841215801561229757506811ff6cf0fd15b000008413155b80156122b157506000846068546122ae9190614e93565b12155b6122fd5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c696420636f6e73656e7375735265776172647344656c74610000006044820152606401610431565b68053444835ec58000008311156123565760405162461bcd60e51b815260206004820152601960248201527f496e76616c69642077657468546f5661756c74416d6f756e74000000000000006044820152606401610431565b846034546123649190614e93565b603455606854612375908590614e93565b60685543606b5582156124c3577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b1580156123dd57600080fd5b505af11580156123f1573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab81166004830152602482018890527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216935063a9059cbb92506044019050602060405180830381600087803b15801561248157600080fd5b505af1158015612495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b9919061463b565b506124c38361390a565b60408051868152602081018690529081018490527f80d022717ea022455c5886b8dd8a29c037570aae58aeb4d7b136d7a10ec2e4319060600160405180910390a161250e6000613972565b61254d5760405162461bcd60e51b815260206004820152601060248201526f233ab9b29039ba34b63610313637bbb760811b6044820152606401610431565b612555613df8565b5060019055505050565b612567612b98565b6125835760405162461bcd60e51b815260040161043190614cc2565b60a05481106125c45760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610431565b600060a082815481106125d9576125d9614fcd565b60009182526020808320909101546001600160a01b03908116808452609f90925260409092205460a0549193509091169061261690600190614f2d565b8310156126985760a0805461262d90600190614f2d565b8154811061263d5761263d614fcd565b60009182526020909120015460a080546001600160a01b03909216918590811061266957612669614fcd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60a08054806126a9576126a9614fb7565b60008281526020808220600019908401810180546001600160a01b031990811690915593019093556001600160a01b03858116808352609f855260409283902080549094169093559051908416815290917f16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c91015b60405180910390a2505050565b612733612b98565b61274f5760405162461bcd60e51b815260040161043190614cc2565b8060005b8181101561280257600084848381811061276f5761276f614fcd565b90506020020160208101906127849190614326565b6001600160a01b031614156127f25760405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f742073657420616e20656d70747920616464726573732061732060448201526d30903932bbb0b932103a37b5b2b760911b6064820152608401610431565b6127fb81614f70565b9050612753565b507f04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc60a4848460405161283793929190614a7b565b60405180910390a1610f3660a4848461407f565b612853612b98565b61286f5760405162461bcd60e51b815260040161043190614cc2565b603680546001600160a01b0319166001600160a01b0383169081179091556040517f3329861a0008b3348767567d2405492b997abd79a088d0f2cef6b1a09a8e7ff790600090a250565b60335460009061010090046001600160a01b031633146128eb5760405162461bcd60e51b815260040161043190614d4e565b60335460ff161561290e5760405162461bcd60e51b815260040161043190614d24565b60008051602061501d833981519152805460028114156129405760405162461bcd60e51b815260040161043190614d85565b6002825561294e6001613972565b925060018255505090565b612961612b98565b61297d5760405162461bcd60e51b815260040161043190614cc2565b808210801561299457506801bc16d674ec80000081105b80156129b15750673782dace9d9000006129ae8383614f2d565b10155b6129fd5760405162461bcd60e51b815260206004820152601760248201527f496e636f7272656374206675736520696e74657276616c0000000000000000006044820152606401610431565b6069829055606a81905560408051838152602081018390527fcb8d24e46eb3c402bf344ee60a6576cba9ef2f59ea1af3b311520704924e901a91015b60405180910390a15050565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000dd9bc35ae942ef0cfa76930954a156b3ff30a4e18116600483015260001960248301527f0000000000000000000000009d65ff81a3c488d585bbfb0bfe3c7707c7917f54169063095ea7b390604401602060405180830381600087803b158015612ad057600080fd5b505af1158015612ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b08919061463b565b50565b612b13612b98565b612b2f5760405162461bcd60e51b815260040161043190614cc2565b60a354604080516001600160a01b03928316815291831660208301527fe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796910160405180910390a160a380546001600160a01b0319166001600160a01b0392909216919091179055565b6000612bb060008051602061503d8339815191525490565b6001600160a01b0316336001600160a01b031614905090565b612bd1612b98565b612bed5760405162461bcd60e51b815260040161043190614cc2565b612c15817f44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db55565b806001600160a01b0316612c3560008051602061503d8339815191525490565b6001600160a01b03167fa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d60405160405180910390a350565b336001600160a01b037f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab1614612cb55760405162461bcd60e51b815260040161043190614c8b565b60008051602061501d83398151915280546002811415612ce75760405162461bcd60e51b815260040161043190614d85565b600282557f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316846001600160a01b031614612d3c5760405162461bcd60e51b815260040161043190614cf9565b61255585858561380c565b60335461010090046001600160a01b03163314612d765760405162461bcd60e51b815260040161043190614d4e565b60335460ff1615612d995760405162461bcd60e51b815260040161043190614d24565b60008484604051612dab929190614952565b604080519182900390912060008181526035602052919091205490915060ff166002816004811115612ddf57612ddf614fa1565b14612e235760405162461bcd60e51b815260206004820152601460248201527315985b1a59185d1bdc881b9bdd081cdd185ad95960621b6044820152606401610431565b604051633877322b60e01b81526001600160a01b037f000000000000000000000000dd9bc35ae942ef0cfa76930954a156b3ff30a4e11690633877322b90612e75908990899089908990600401614b75565b600060405180830381600087803b158015612e8f57600080fd5b505af1158015612ea3573d6000803e3d6000fd5b50505060008381526035602052604090819020805460ff19166003179055518391507f8c2e15303eb94e531acc988c2a01d1193bdaaa15eda7f16dda85316ed463578d90612ef8908990899089908990614b75565b60405180910390a2505050505050565b336001600160a01b037f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab1614612f505760405162461bcd60e51b815260040161043190614c8b565b60008051602061501d83398151915280546002811415612f825760405162461bcd60e51b815260040161043190614d85565b600282556040516370a0823160e01b81523060048201526000907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316906370a082319060240160206040518083038186803b158015612fe857600080fd5b505afa158015612ffc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130209190614789565b9050600061010754826130339190614f2d565b9050801561306b5761010782905561306b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2826133d2565b5050600182555050565b6036546001600160a01b031633146130cf5760405162461bcd60e51b815260206004820152601960248201527f43616c6c6572206973206e6f7420746865204d6f6e69746f72000000000000006044820152606401610431565b600060388190556040517fe765a88a37047c5d793dce22b9ceb5a0f5039d276da139b4c7d29613f341f1109190a1565b606060a480548060200260200160405190810160405280929190818152602001828054801561315757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613139575b5050505050905090565b6001600160a01b038281166000908152609f602052604090205416156131be5760405162461bcd60e51b81526020600482015260126024820152711c151bdad95b88185b1c9958591e481cd95d60721b6044820152606401610431565b6001600160a01b038216158015906131de57506001600160a01b03811615155b61321e5760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642061646472657373657360781b6044820152606401610431565b6001600160a01b038281166000818152609f6020908152604080832080549587166001600160a01b0319968716811790915560a0805460018101825594527f78fdc8d422c49ced035a9edf18d00d3c6a8d81df210f3e5e448e045e77b41e8890930180549095168417909455925190815290917fef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765910160405180910390a25050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613312908490613e72565b505050565b825161332a9060a49060208601906140e2565b508151815181146133745760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420696e7075742061727261797360601b6044820152606401610431565b60005b818110156133cb576133bb84828151811061339457613394614fcd565b60200260200101518483815181106133ae576133ae614fcd565b6020026020010151613161565b6133c481614f70565b9050613377565b5050505050565b6000811161341b5760405162461bcd60e51b81526020600482015260166024820152754d757374206465706f73697420736f6d657468696e6760501b6044820152606401610431565b6040805160008152602081018390526001600160a01b038416917f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62910160405180910390a25050565b60335460ff16156134875760405162461bcd60e51b815260040161043190614d24565b60007f000000000000000000000000fee31c09fa5e9cdbc1f80c90b42b58640be91ddf6001600160a01b031663e52253816040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156134e457600080fd5b505af11580156134f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061351c9190614789565b905060006068548261352e9190614ed4565b9050804710156135805760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e74206574682062616c616e636500000000000000006044820152606401610431565b8015610c4c5760006068819055507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156135e957600080fd5b505af11580156135fd573d6000803e3d6000fd5b505060a35461363d93506001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281169350169050836132c0565b60a354604080516001600160a01b0392831681527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2909216602083015281018290527ff6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c7235390606001612a39565b6001600160a01b0381166136ff5760405162461bcd60e51b815260206004820152601a60248201527f4e657720476f7665726e6f7220697320616464726573732830290000000000006044820152606401610431565b806001600160a01b031661371f60008051602061503d8339815191525490565b6001600160a01b03167fc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a60405160405180910390a3612b088160008051602061503d83398151915255565b60006137798261010754613f44565b905080610107600082825461378e9190614f2d565b90915550505050565b60335460ff16156137ba5760405162461bcd60e51b815260040161043190614d24565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586137ef3390565b6040516001600160a01b03909116815260200160405180910390a1565b6000811161385c5760405162461bcd60e51b815260206004820152601760248201527f4d75737420776974686472617720736f6d657468696e670000000000000000006044820152606401610431565b6001600160a01b0383166138ab5760405162461bcd60e51b8152602060048201526016602482015275135d5cdd081cdc1958da599e481c9958da5c1a595b9d60521b6044820152606401610431565b6138b48161376a565b6138c86001600160a01b03831684836132c0565b6040805160008152602081018390526001600160a01b038416917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398910161271e565b6040805160008152602081018390526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216917f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398910160405180910390a250565b60006068544710156139875761156982613f5c565b6000606854476139979190614f2d565b9050600191506801bc16d674ec8000008110613b7b5760006139c26801bc16d674ec80000083614eec565b905080603460008282546139d69190614f2d565b90915550600090506139f1826801bc16d674ec800000614f0e565b90507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613a4e57600080fd5b505af1158015613a62573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab81166004830152602482018690527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216935063a9059cbb92506044019050602060405180830381600087803b158015613af257600080fd5b505af1158015613b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b2a919061463b565b50613b348161390a565b60345460408051848152602081019290925281018290527fbe7040030ff7b347853214bf49820c6d455fedf58f3815f85c7bc5216993682b9060600160405180910390a150505b600060685447613b8b9190614f2d565b90506801bc16d674ec8000008110613bdd5760405162461bcd60e51b8152602060048201526015602482015274556e6578706563746564206163636f756e74696e6760581b6044820152606401610431565b80613be9575050919050565b606954811015613c43578060686000828254613c059190614ed4565b90915550506040518181527f7a745a2c63a535068f52ceca27debd5297bbad5f7f37ec53d044a59d0362445d906020015b60405180910390a1613df1565b606a54811115613de0577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613ca857600080fd5b505af1158015613cbc573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f00000000000000000000000039254033945aa2e4809cc2977e7087bee48bd7ab81166004830152602482018690527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216935063a9059cbb92506044019050602060405180830381600087803b158015613d4c57600080fd5b505af1158015613d60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d84919061463b565b50600160346000828254613d989190614f2d565b90915550613da790508161390a565b60345460408051918252602082018390527f6aa7e30787b26429ced603a7aba8b19c4b5d5bcf29a3257da953c8d53bcaa3a69101613c36565b613de984613f5c565b949350505050565b5050919050565b60335460ff16613e415760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610431565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336137ef565b6000613ec7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613f749092919063ffffffff16565b8051909150156133125780806020019051810190613ee5919061463b565b6133125760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610431565b6000818310613f535781613f55565b825b9392505050565b60008115613f6c57613f6c613797565b506000919050565b6060613de9848460008585843b613fcd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610431565b600080866001600160a01b03168587604051613fe99190614962565b60006040518083038185875af1925050503d8060008114614026576040519150601f19603f3d011682016040523d82523d6000602084013e61402b565b606091505b509150915061403b828286614046565b979650505050505050565b60608315614055575081613f55565b8251156140655782518084602001fd5b8160405162461bcd60e51b81526004016104319190614c78565b8280548282559060005260206000209081019282156140d2579160200282015b828111156140d25781546001600160a01b0319166001600160a01b0384351617825560209092019160019091019061409f565b506140de929150614137565b5090565b8280548282559060005260206000209081019282156140d2579160200282015b828111156140d257825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614102565b5b808211156140de5760008155600101614138565b60008083601f84011261415e57600080fd5b5081356001600160401b0381111561417557600080fd5b6020830191508360208260051b850101111561419057600080fd5b9250929050565b600082601f8301126141a857600080fd5b813560206141bd6141b883614e70565b614e40565b80838252828201915082860187848660051b89010111156141dd57600080fd5b60005b858110156142055781356141f381614ff9565b845292840192908401906001016141e0565b5090979650505050505050565b60008083601f84011261422457600080fd5b5081356001600160401b0381111561423b57600080fd5b60208301915083602082850101111561419057600080fd5b600060a0828403121561426557600080fd5b50919050565b600060a0828403121561427d57600080fd5b60405160a081018181106001600160401b038211171561429f5761429f614fe3565b6040529050806142ae836142f6565b81526142bc6020840161430f565b60208201526142cd6040840161430f565b604082015260608301356142e08161500e565b6060820152608092830135920191909152919050565b803563ffffffff8116811461430a57600080fd5b919050565b80356001600160401b038116811461430a57600080fd5b60006020828403121561433857600080fd5b8135613f5581614ff9565b60006020828403121561435557600080fd5b8151613f5581614ff9565b6000806040838503121561437357600080fd5b823561437e81614ff9565b9150602083013561438e81614ff9565b809150509250929050565b6000806000606084860312156143ae57600080fd5b83356143b981614ff9565b925060208401356143c981614ff9565b929592945050506040919091013590565b600080604083850312156143ed57600080fd5b82356143f881614ff9565b946020939093013593505050565b6000806020838503121561441957600080fd5b82356001600160401b0381111561442f57600080fd5b61443b8582860161414c565b90969095509350505050565b60008060006060848603121561445c57600080fd5b83356001600160401b038082111561447357600080fd5b61447f87838801614197565b9450602086013591508082111561449557600080fd5b6144a187838801614197565b935060408601359150808211156144b757600080fd5b506144c486828701614197565b9150509250925092565b600080600080600080600080610120898b0312156144eb57600080fd5b88356001600160401b038082111561450257600080fd5b61450e8c838d0161414c565b909a50985060208b013591508082111561452757600080fd5b6145338c838d0161414c565b909850965060408b013591508082111561454c57600080fd5b506145598b828c0161414c565b909550935050606089013591506145738a60808b01614253565b90509295985092959890939650565b600080600060e0848603121561459757600080fd5b83356001600160401b038111156145ad57600080fd5b8401601f810186136145be57600080fd5b803560206145ce6141b883614e70565b8083825282820191508285018a848660051b88010111156145ee57600080fd5b600095505b84861015614618576146048161430f565b8352600195909501949183019183016145f3565b50965050860135935061463291508690506040860161426b565b90509250925092565b60006020828403121561464d57600080fd5b8151613f558161500e565b60006020828403121561466a57600080fd5b5035919050565b6000806000806040858703121561468757600080fd5b84356001600160401b038082111561469e57600080fd5b6146aa88838901614212565b909650945060208701359150808211156146c357600080fd5b506146d08782880161414c565b95989497509550505050565b600080600080600060e086880312156146f457600080fd5b85356001600160401b038082111561470b57600080fd5b61471789838a01614212565b9097509550602088013591508082111561473057600080fd5b5061473d8882890161414c565b909450925061475190508760408801614253565b90509295509295909350565b60008060006060848603121561477257600080fd5b505081359360208301359350604090920135919050565b60006020828403121561479b57600080fd5b5051919050565b600080604083850312156147b557600080fd5b50508035926020909101359150565b81835260006020808501808196508560051b810191508460005b878110156148475782840389528135601e198836030181126147ff57600080fd5b870180356001600160401b0381111561481757600080fd5b80360389131561482657600080fd5b614833868289850161489b565b9a87019a95505050908401906001016147de565b5091979650505050505050565b8183526000602080850194508260005b85811015614890576001600160401b0361487d8361430f565b1687529582019590820190600101614864565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b600081518084526148dc816020860160208601614f44565b601f01601f19169290920160200192915050565b63ffffffff6148fe826142f6565b16825261490d6020820161430f565b6001600160401b0380821660208501528061492a6040850161430f565b166040850152505060608101356149408161500e565b15156060830152608090810135910152565b8183823760009101908152919050565b60008251614974818460208701614f44565b9190910192915050565b6001600160a01b03851681526101006020808301829052855191830182905260009161012084019187810191845b818110156149d15783516001600160401b0316855293820193928201926001016149ac565b505082935086604086015263ffffffff865116606086015280860151925050506001600160401b0380821660808501528060408601511660a085015250506060830151151560c0830152608083015160e083015295945050505050565b6020808252825182820181905260009190848201906040850190845b81811015614a6f5783516001600160a01b031683529284019291840191600101614a4a565b50909695505050505050565b6000604082016040835280865480835260608501915087600052602092508260002060005b82811015614ac55781546001600160a01b031684529284019260019182019101614aa0565b505050838103828501528481528590820160005b86811015614b07578235614aec81614ff9565b6001600160a01b031682529183019190830190600101614ad9565b50979650505050505050565b6000610120808352614b288184018b8d6147c4565b90508281036020840152614b3d81898b614854565b90508281036040840152614b528187896147c4565b915050836060830152614b6860808301846148f0565b9998505050505050505050565b604081526000614b8960408301868861489b565b828103602084015261403b818587614854565b60e081526000614bb060e08301878961489b565b8281036020840152614bc3818688614854565b915050614bd360408301846148f0565b9695505050505050565b608081526000614bf160808301888a61489b565b8281036020840152614c0381886148c4565b90508281036040840152614c1881868861489b565b915050826060830152979650505050505050565b604081526000614c4060408301858761489b565b9050826020830152949350505050565b6020810160058310614c7257634e487b7160e01b600052602160045260246000fd5b91905290565b602081526000613f5560208301846148c4565b60208082526017908201527f43616c6c6572206973206e6f7420746865205661756c74000000000000000000604082015260600190565b6020808252601a908201527f43616c6c6572206973206e6f742074686520476f7665726e6f72000000000000604082015260600190565b602080825260119082015270155b9cdd5c1c1bdc9d195908185cdcd95d607a1b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601d908201527f43616c6c6572206973206e6f7420746865205265676973747261746f72000000604082015260600190565b6020808252600e908201526d1499595b9d1c985b9d0818d85b1b60921b604082015260600190565b6020808252601c908201527f43616c6c6572206973206e6f7420746865205374726174656769737400000000604082015260600190565b6000808335601e19843603018112614dfb57600080fd5b8301803591506001600160401b03821115614e1557600080fd5b60200191503681900382131561419057600080fd5b60008235605e1983360301811261497457600080fd5b604051601f8201601f191681016001600160401b0381118282101715614e6857614e68614fe3565b604052919050565b60006001600160401b03821115614e8957614e89614fe3565b5060051b60200190565b600080821280156001600160ff1b0384900385131615614eb557614eb5614f8b565b600160ff1b8390038412811615614ece57614ece614f8b565b50500190565b60008219821115614ee757614ee7614f8b565b500190565b600082614f0957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614f2857614f28614f8b565b500290565b600082821015614f3f57614f3f614f8b565b500390565b60005b83811015614f5f578181015183820152602001614f47565b83811115610f365750506000910152565b6000600019821415614f8457614f84614f8b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612b0857600080fd5b8015158114612b0857600080fdfe53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac45357bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4aa264697066735822122090185a734b1de8826eb108de1e4c3e6d39974867eef4808c4768d017495ca8a464736f6c63430008070033
{{ "language": "Solidity", "settings": { "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }, "sources": { "@openzeppelin/contracts/security/Pausable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" }, "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Context.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" }, "@openzeppelin/contracts/utils/math/Math.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" }, "@openzeppelin/contracts/utils/math/SafeMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" }, "contracts/governance/Governable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Base for contracts that are managed by the Origin Protocol's Governor.\n * @dev Copy of the openzeppelin Ownable.sol contract with nomenclature change\n * from owner to governor and renounce methods removed. Does not use\n * Context.sol like Ownable.sol does for simplification.\n * @author Origin Protocol Inc\n */\ncontract Governable {\n // Storage position of the owner and pendingOwner of the contract\n // keccak256(\"OUSD.governor\");\n bytes32 private constant governorPosition =\n 0x7bea13895fa79d2831e0a9e28edede30099005a50d652d8957cf8a607ee6ca4a;\n\n // keccak256(\"OUSD.pending.governor\");\n bytes32 private constant pendingGovernorPosition =\n 0x44c4d30b2eaad5130ad70c3ba6972730566f3e6359ab83e800d905c61b1c51db;\n\n // keccak256(\"OUSD.reentry.status\");\n bytes32 private constant reentryStatusPosition =\n 0x53bf423e48ed90e97d02ab0ebab13b2a235a6bfbe9c321847d5c175333ac4535;\n\n // See OpenZeppelin ReentrancyGuard implementation\n uint256 constant _NOT_ENTERED = 1;\n uint256 constant _ENTERED = 2;\n\n event PendingGovernorshipTransfer(\n address indexed previousGovernor,\n address indexed newGovernor\n );\n\n event GovernorshipTransferred(\n address indexed previousGovernor,\n address indexed newGovernor\n );\n\n /**\n * @dev Initializes the contract setting the deployer as the initial Governor.\n */\n constructor() {\n _setGovernor(msg.sender);\n emit GovernorshipTransferred(address(0), _governor());\n }\n\n /**\n * @notice Returns the address of the current Governor.\n */\n function governor() public view returns (address) {\n return _governor();\n }\n\n /**\n * @dev Returns the address of the current Governor.\n */\n function _governor() internal view returns (address governorOut) {\n bytes32 position = governorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n governorOut := sload(position)\n }\n }\n\n /**\n * @dev Returns the address of the pending Governor.\n */\n function _pendingGovernor()\n internal\n view\n returns (address pendingGovernor)\n {\n bytes32 position = pendingGovernorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n pendingGovernor := sload(position)\n }\n }\n\n /**\n * @dev Throws if called by any account other than the Governor.\n */\n modifier onlyGovernor() {\n require(isGovernor(), \"Caller is not the Governor\");\n _;\n }\n\n /**\n * @notice Returns true if the caller is the current Governor.\n */\n function isGovernor() public view returns (bool) {\n return msg.sender == _governor();\n }\n\n function _setGovernor(address newGovernor) internal {\n bytes32 position = governorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newGovernor)\n }\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n bytes32 position = reentryStatusPosition;\n uint256 _reentry_status;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n _reentry_status := sload(position)\n }\n\n // On the first call to nonReentrant, _notEntered will be true\n require(_reentry_status != _ENTERED, \"Reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, _ENTERED)\n }\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, _NOT_ENTERED)\n }\n }\n\n function _setPendingGovernor(address newGovernor) internal {\n bytes32 position = pendingGovernorPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newGovernor)\n }\n }\n\n /**\n * @notice Transfers Governance of the contract to a new account (`newGovernor`).\n * Can only be called by the current Governor. Must be claimed for this to complete\n * @param _newGovernor Address of the new Governor\n */\n function transferGovernance(address _newGovernor) external onlyGovernor {\n _setPendingGovernor(_newGovernor);\n emit PendingGovernorshipTransfer(_governor(), _newGovernor);\n }\n\n /**\n * @notice Claim Governance of the contract to a new account (`newGovernor`).\n * Can only be called by the new Governor.\n */\n function claimGovernance() external {\n require(\n msg.sender == _pendingGovernor(),\n \"Only the pending Governor can complete the claim\"\n );\n _changeGovernor(msg.sender);\n }\n\n /**\n * @dev Change Governance of the contract to a new account (`newGovernor`).\n * @param _newGovernor Address of the new Governor\n */\n function _changeGovernor(address _newGovernor) internal {\n require(_newGovernor != address(0), \"New Governor is address(0)\");\n emit GovernorshipTransferred(_governor(), _newGovernor);\n _setGovernor(_newGovernor);\n }\n}\n" }, "contracts/interfaces/IBasicToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBasicToken {\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}\n" }, "contracts/interfaces/IDepositContract.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IDepositContract {\n /// @notice A processed deposit event.\n event DepositEvent(\n bytes pubkey,\n bytes withdrawal_credentials,\n bytes amount,\n bytes signature,\n bytes index\n );\n\n /// @notice Submit a Phase 0 DepositData object.\n /// @param pubkey A BLS12-381 public key.\n /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n /// @param signature A BLS12-381 signature.\n /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n /// Used as a protection against malformed input.\n function deposit(\n bytes calldata pubkey,\n bytes calldata withdrawal_credentials,\n bytes calldata signature,\n bytes32 deposit_data_root\n ) external payable;\n\n /// @notice Query the current deposit root hash.\n /// @return The deposit root hash.\n function get_deposit_root() external view returns (bytes32);\n\n /// @notice Query the current deposit count.\n /// @return The deposit count encoded as a little endian 64-bit number.\n function get_deposit_count() external view returns (bytes memory);\n}\n" }, "contracts/interfaces/ISSVNetwork.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nstruct Cluster {\n uint32 validatorCount;\n uint64 networkFeeIndex;\n uint64 index;\n bool active;\n uint256 balance;\n}\n\ninterface ISSVNetwork {\n /**********/\n /* Errors */\n /**********/\n\n error CallerNotOwner(); // 0x5cd83192\n error CallerNotWhitelisted(); // 0x8c6e5d71\n error FeeTooLow(); // 0x732f9413\n error FeeExceedsIncreaseLimit(); // 0x958065d9\n error NoFeeDeclared(); // 0x1d226c30\n error ApprovalNotWithinTimeframe(); // 0x97e4b518\n error OperatorDoesNotExist(); // 0x961e3e8c\n error InsufficientBalance(); // 0xf4d678b8\n error ValidatorDoesNotExist(); // 0xe51315d2\n error ClusterNotLiquidatable(); // 0x60300a8d\n error InvalidPublicKeyLength(); // 0x637297a4\n error InvalidOperatorIdsLength(); // 0x38186224\n error ClusterAlreadyEnabled(); // 0x3babafd2\n error ClusterIsLiquidated(); // 0x95a0cf33\n error ClusterDoesNotExists(); // 0x185e2b16\n error IncorrectClusterState(); // 0x12e04c87\n error UnsortedOperatorsList(); // 0xdd020e25\n error NewBlockPeriodIsBelowMinimum(); // 0x6e6c9cac\n error ExceedValidatorLimit(); // 0x6df5ab76\n error TokenTransferFailed(); // 0x045c4b02\n error SameFeeChangeNotAllowed(); // 0xc81272f8\n error FeeIncreaseNotAllowed(); // 0x410a2b6c\n error NotAuthorized(); // 0xea8e4eb5\n error OperatorsListNotUnique(); // 0xa5a1ff5d\n error OperatorAlreadyExists(); // 0x289c9494\n error TargetModuleDoesNotExist(); // 0x8f9195fb\n error MaxValueExceeded(); // 0x91aa3017\n error FeeTooHigh(); // 0xcd4e6167\n error PublicKeysSharesLengthMismatch(); // 0x9ad467b8\n error IncorrectValidatorStateWithData(bytes publicKey); // 0x89307938\n error ValidatorAlreadyExistsWithData(bytes publicKey); // 0x388e7999\n error EmptyPublicKeysList(); // df83e679\n\n // legacy errors\n error ValidatorAlreadyExists(); // 0x8d09a73e\n error IncorrectValidatorState(); // 0x2feda3c1\n\n event AdminChanged(address previousAdmin, address newAdmin);\n event BeaconUpgraded(address indexed beacon);\n event ClusterDeposited(\n address indexed owner,\n uint64[] operatorIds,\n uint256 value,\n Cluster cluster\n );\n event ClusterLiquidated(\n address indexed owner,\n uint64[] operatorIds,\n Cluster cluster\n );\n event ClusterReactivated(\n address indexed owner,\n uint64[] operatorIds,\n Cluster cluster\n );\n event ClusterWithdrawn(\n address indexed owner,\n uint64[] operatorIds,\n uint256 value,\n Cluster cluster\n );\n event DeclareOperatorFeePeriodUpdated(uint64 value);\n event ExecuteOperatorFeePeriodUpdated(uint64 value);\n event FeeRecipientAddressUpdated(\n address indexed owner,\n address recipientAddress\n );\n event Initialized(uint8 version);\n event LiquidationThresholdPeriodUpdated(uint64 value);\n event MinimumLiquidationCollateralUpdated(uint256 value);\n event NetworkEarningsWithdrawn(uint256 value, address recipient);\n event NetworkFeeUpdated(uint256 oldFee, uint256 newFee);\n event OperatorAdded(\n uint64 indexed operatorId,\n address indexed owner,\n bytes publicKey,\n uint256 fee\n );\n event OperatorFeeDeclarationCancelled(\n address indexed owner,\n uint64 indexed operatorId\n );\n event OperatorFeeDeclared(\n address indexed owner,\n uint64 indexed operatorId,\n uint256 blockNumber,\n uint256 fee\n );\n event OperatorFeeExecuted(\n address indexed owner,\n uint64 indexed operatorId,\n uint256 blockNumber,\n uint256 fee\n );\n event OperatorFeeIncreaseLimitUpdated(uint64 value);\n event OperatorMaximumFeeUpdated(uint64 maxFee);\n event OperatorRemoved(uint64 indexed operatorId);\n event OperatorWhitelistUpdated(\n uint64 indexed operatorId,\n address whitelisted\n );\n event OperatorWithdrawn(\n address indexed owner,\n uint64 indexed operatorId,\n uint256 value\n );\n event OwnershipTransferStarted(\n address indexed previousOwner,\n address indexed newOwner\n );\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n event Upgraded(address indexed implementation);\n event ValidatorAdded(\n address indexed owner,\n uint64[] operatorIds,\n bytes publicKey,\n bytes shares,\n Cluster cluster\n );\n event ValidatorExited(\n address indexed owner,\n uint64[] operatorIds,\n bytes publicKey\n );\n event ValidatorRemoved(\n address indexed owner,\n uint64[] operatorIds,\n bytes publicKey,\n Cluster cluster\n );\n\n fallback() external;\n\n function acceptOwnership() external;\n\n function cancelDeclaredOperatorFee(uint64 operatorId) external;\n\n function declareOperatorFee(uint64 operatorId, uint256 fee) external;\n\n function deposit(\n address clusterOwner,\n uint64[] memory operatorIds,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function executeOperatorFee(uint64 operatorId) external;\n\n function exitValidator(bytes memory publicKey, uint64[] memory operatorIds)\n external;\n\n function bulkExitValidator(\n bytes[] calldata publicKeys,\n uint64[] calldata operatorIds\n ) external;\n\n function getVersion() external pure returns (string memory version);\n\n function initialize(\n address token_,\n address ssvOperators_,\n address ssvClusters_,\n address ssvDAO_,\n address ssvViews_,\n uint64 minimumBlocksBeforeLiquidation_,\n uint256 minimumLiquidationCollateral_,\n uint32 validatorsPerOperatorLimit_,\n uint64 declareOperatorFeePeriod_,\n uint64 executeOperatorFeePeriod_,\n uint64 operatorMaxFeeIncrease_\n ) external;\n\n function liquidate(\n address clusterOwner,\n uint64[] memory operatorIds,\n Cluster memory cluster\n ) external;\n\n function owner() external view returns (address);\n\n function pendingOwner() external view returns (address);\n\n function proxiableUUID() external view returns (bytes32);\n\n function reactivate(\n uint64[] memory operatorIds,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function reduceOperatorFee(uint64 operatorId, uint256 fee) external;\n\n function registerOperator(bytes memory publicKey, uint256 fee)\n external\n returns (uint64 id);\n\n function registerValidator(\n bytes memory publicKey,\n uint64[] memory operatorIds,\n bytes memory sharesData,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function bulkRegisterValidator(\n bytes[] calldata publicKeys,\n uint64[] calldata operatorIds,\n bytes[] calldata sharesData,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function removeOperator(uint64 operatorId) external;\n\n function removeValidator(\n bytes memory publicKey,\n uint64[] memory operatorIds,\n Cluster memory cluster\n ) external;\n\n function bulkRemoveValidator(\n bytes[] calldata publicKeys,\n uint64[] calldata operatorIds,\n Cluster memory cluster\n ) external;\n\n function renounceOwnership() external;\n\n function setFeeRecipientAddress(address recipientAddress) external;\n\n function setOperatorWhitelist(uint64 operatorId, address whitelisted)\n external;\n\n function transferOwnership(address newOwner) external;\n\n function updateDeclareOperatorFeePeriod(uint64 timeInSeconds) external;\n\n function updateExecuteOperatorFeePeriod(uint64 timeInSeconds) external;\n\n function updateLiquidationThresholdPeriod(uint64 blocks) external;\n\n function updateMaximumOperatorFee(uint64 maxFee) external;\n\n function updateMinimumLiquidationCollateral(uint256 amount) external;\n\n function updateModule(uint8 moduleId, address moduleAddress) external;\n\n function updateNetworkFee(uint256 fee) external;\n\n function updateOperatorFeeIncreaseLimit(uint64 percentage) external;\n\n function upgradeTo(address newImplementation) external;\n\n function upgradeToAndCall(address newImplementation, bytes memory data)\n external\n payable;\n\n function withdraw(\n uint64[] memory operatorIds,\n uint256 amount,\n Cluster memory cluster\n ) external;\n\n function withdrawAllOperatorEarnings(uint64 operatorId) external;\n\n function withdrawNetworkEarnings(uint256 amount) external;\n\n function withdrawOperatorEarnings(uint64 operatorId, uint256 amount)\n external;\n}\n" }, "contracts/interfaces/IStrategy.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Platform interface to integrate with lending platform like Compound, AAVE etc.\n */\ninterface IStrategy {\n /**\n * @dev Deposit the given asset to platform\n * @param _asset asset address\n * @param _amount Amount to deposit\n */\n function deposit(address _asset, uint256 _amount) external;\n\n /**\n * @dev Deposit the entire balance of all supported assets in the Strategy\n * to the platform\n */\n function depositAll() external;\n\n /**\n * @dev Withdraw given asset from Lending platform\n */\n function withdraw(\n address _recipient,\n address _asset,\n uint256 _amount\n ) external;\n\n /**\n * @dev Liquidate all assets in strategy and return them to Vault.\n */\n function withdrawAll() external;\n\n /**\n * @dev Returns the current balance of the given asset.\n */\n function checkBalance(address _asset)\n external\n view\n returns (uint256 balance);\n\n /**\n * @dev Returns bool indicating whether strategy supports asset.\n */\n function supportsAsset(address _asset) external view returns (bool);\n\n /**\n * @dev Collect reward tokens from the Strategy.\n */\n function collectRewardTokens() external;\n\n /**\n * @dev The address array of the reward tokens for the Strategy.\n */\n function getRewardTokenAddresses() external view returns (address[] memory);\n}\n" }, "contracts/interfaces/IVault.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { VaultStorage } from \"../vault/VaultStorage.sol\";\n\ninterface IVault {\n event AssetSupported(address _asset);\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\n event StrategyApproved(address _addr);\n event StrategyRemoved(address _addr);\n event Mint(address _addr, uint256 _value);\n event Redeem(address _addr, uint256 _value);\n event CapitalPaused();\n event CapitalUnpaused();\n event RebasePaused();\n event RebaseUnpaused();\n event VaultBufferUpdated(uint256 _vaultBuffer);\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\n event PriceProviderUpdated(address _priceProvider);\n event AllocateThresholdUpdated(uint256 _threshold);\n event RebaseThresholdUpdated(uint256 _threshold);\n event StrategistUpdated(address _address);\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\n event TrusteeFeeBpsChanged(uint256 _basis);\n event TrusteeAddressChanged(address _address);\n event SwapperChanged(address _address);\n event SwapAllowedUndervalueChanged(uint256 _basis);\n event SwapSlippageChanged(address _asset, uint256 _basis);\n event Swapped(\n address indexed _fromAsset,\n address indexed _toAsset,\n uint256 _fromAssetAmount,\n uint256 _toAssetAmount\n );\n\n // Governable.sol\n function transferGovernance(address _newGovernor) external;\n\n function claimGovernance() external;\n\n function governor() external view returns (address);\n\n // VaultAdmin.sol\n function setPriceProvider(address _priceProvider) external;\n\n function priceProvider() external view returns (address);\n\n function setRedeemFeeBps(uint256 _redeemFeeBps) external;\n\n function redeemFeeBps() external view returns (uint256);\n\n function setVaultBuffer(uint256 _vaultBuffer) external;\n\n function vaultBuffer() external view returns (uint256);\n\n function setAutoAllocateThreshold(uint256 _threshold) external;\n\n function autoAllocateThreshold() external view returns (uint256);\n\n function setRebaseThreshold(uint256 _threshold) external;\n\n function rebaseThreshold() external view returns (uint256);\n\n function setStrategistAddr(address _address) external;\n\n function strategistAddr() external view returns (address);\n\n function setMaxSupplyDiff(uint256 _maxSupplyDiff) external;\n\n function maxSupplyDiff() external view returns (uint256);\n\n function setTrusteeAddress(address _address) external;\n\n function trusteeAddress() external view returns (address);\n\n function setTrusteeFeeBps(uint256 _basis) external;\n\n function trusteeFeeBps() external view returns (uint256);\n\n function ousdMetaStrategy() external view returns (address);\n\n function setSwapper(address _swapperAddr) external;\n\n function setSwapAllowedUndervalue(uint16 _percentageBps) external;\n\n function setOracleSlippage(address _asset, uint16 _allowedOracleSlippageBps)\n external;\n\n function supportAsset(address _asset, uint8 _supportsAsset) external;\n\n function approveStrategy(address _addr) external;\n\n function removeStrategy(address _addr) external;\n\n function setAssetDefaultStrategy(address _asset, address _strategy)\n external;\n\n function assetDefaultStrategies(address _asset)\n external\n view\n returns (address);\n\n function pauseRebase() external;\n\n function unpauseRebase() external;\n\n function rebasePaused() external view returns (bool);\n\n function pauseCapital() external;\n\n function unpauseCapital() external;\n\n function capitalPaused() external view returns (bool);\n\n function transferToken(address _asset, uint256 _amount) external;\n\n function priceUnitMint(address asset) external view returns (uint256);\n\n function priceUnitRedeem(address asset) external view returns (uint256);\n\n function withdrawAllFromStrategy(address _strategyAddr) external;\n\n function withdrawAllFromStrategies() external;\n\n function withdrawFromStrategy(\n address _strategyFromAddress,\n address[] calldata _assets,\n uint256[] calldata _amounts\n ) external;\n\n function depositToStrategy(\n address _strategyToAddress,\n address[] calldata _assets,\n uint256[] calldata _amounts\n ) external;\n\n // VaultCore.sol\n function mint(\n address _asset,\n uint256 _amount,\n uint256 _minimumOusdAmount\n ) external;\n\n function mintForStrategy(uint256 _amount) external;\n\n function redeem(uint256 _amount, uint256 _minimumUnitAmount) external;\n\n function burnForStrategy(uint256 _amount) external;\n\n function redeemAll(uint256 _minimumUnitAmount) external;\n\n function allocate() external;\n\n function rebase() external;\n\n function swapCollateral(\n address fromAsset,\n address toAsset,\n uint256 fromAssetAmount,\n uint256 minToAssetAmount,\n bytes calldata data\n ) external returns (uint256 toAssetAmount);\n\n function totalValue() external view returns (uint256 value);\n\n function checkBalance(address _asset) external view returns (uint256);\n\n function calculateRedeemOutputs(uint256 _amount)\n external\n view\n returns (uint256[] memory);\n\n function getAssetCount() external view returns (uint256);\n\n function getAssetConfig(address _asset)\n external\n view\n returns (VaultStorage.Asset memory config);\n\n function getAllAssets() external view returns (address[] memory);\n\n function getStrategyCount() external view returns (uint256);\n\n function swapper() external view returns (address);\n\n function allowedSwapUndervalue() external view returns (uint256);\n\n function getAllStrategies() external view returns (address[] memory);\n\n function isSupportedAsset(address _asset) external view returns (bool);\n\n function netOusdMintForStrategyThreshold() external view returns (uint256);\n\n function setOusdMetaStrategy(address _ousdMetaStrategy) external;\n\n function setNetOusdMintForStrategyThreshold(uint256 _threshold) external;\n\n function netOusdMintedForStrategy() external view returns (int256);\n\n function weth() external view returns (address);\n\n function cacheWETHAssetIndex() external;\n\n function wethAssetIndex() external view returns (uint256);\n\n function initialize(address, address) external;\n\n function setAdminImpl(address) external;\n\n function removeAsset(address _asset) external;\n}\n" }, "contracts/interfaces/IWETH9.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH9 {\n event Approval(address indexed src, address indexed guy, uint256 wad);\n event Deposit(address indexed dst, uint256 wad);\n event Transfer(address indexed src, address indexed dst, uint256 wad);\n event Withdrawal(address indexed src, uint256 wad);\n\n function allowance(address, address) external view returns (uint256);\n\n function approve(address guy, uint256 wad) external returns (bool);\n\n function balanceOf(address) external view returns (uint256);\n\n function decimals() external view returns (uint8);\n\n function deposit() external payable;\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function totalSupply() external view returns (uint256);\n\n function transfer(address dst, uint256 wad) external returns (bool);\n\n function transferFrom(\n address src,\n address dst,\n uint256 wad\n ) external returns (bool);\n\n function withdraw(uint256 wad) external;\n}\n" }, "contracts/strategies/NativeStaking/FeeAccumulator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @title Fee Accumulator for Native Staking SSV Strategy\n * @notice Receives execution rewards which includes tx fees and\n * MEV rewards like tx priority and tx ordering.\n * It does NOT include swept ETH from beacon chain consensus rewards or full validator withdrawals.\n * @author Origin Protocol Inc\n */\ncontract FeeAccumulator {\n /// @notice The address of the Native Staking Strategy\n address public immutable STRATEGY;\n\n event ExecutionRewardsCollected(address indexed strategy, uint256 amount);\n\n /**\n * @param _strategy Address of the Native Staking Strategy\n */\n constructor(address _strategy) {\n STRATEGY = _strategy;\n }\n\n /**\n * @notice sends all ETH in this FeeAccumulator contract to the Native Staking Strategy.\n * @return eth The amount of execution rewards that were sent to the Native Staking Strategy\n */\n function collect() external returns (uint256 eth) {\n require(msg.sender == STRATEGY, \"Caller is not the Strategy\");\n\n eth = address(this).balance;\n if (eth > 0) {\n // Send the ETH to the Native Staking Strategy\n Address.sendValue(payable(STRATEGY), eth);\n\n emit ExecutionRewardsCollected(STRATEGY, eth);\n }\n }\n\n /**\n * @dev Accept ETH\n */\n receive() external payable {}\n}\n" }, "contracts/strategies/NativeStaking/NativeStakingSSVStrategy.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nimport { InitializableAbstractStrategy } from \"../../utils/InitializableAbstractStrategy.sol\";\nimport { IWETH9 } from \"../../interfaces/IWETH9.sol\";\nimport { FeeAccumulator } from \"./FeeAccumulator.sol\";\nimport { ValidatorAccountant } from \"./ValidatorAccountant.sol\";\n\nstruct ValidatorStakeData {\n bytes pubkey;\n bytes signature;\n bytes32 depositDataRoot;\n}\n\n/// @title Native Staking SSV Strategy\n/// @notice Strategy to deploy funds into DVT validators powered by the SSV Network\n/// @author Origin Protocol Inc\n/// @dev This contract handles WETH and ETH and in some operations interchanges between the two. Any WETH that\n/// is on the contract across multiple blocks (and not just transitory within a transaction) is considered an\n/// asset. Meaning deposits increase the balance of the asset and withdrawal decrease it. As opposed to all\n/// our other strategies the WETH doesn't immediately get deposited into an underlying strategy and can be present\n/// across multiple blocks waiting to be unwrapped to ETH and staked to validators. This separation of WETH and ETH is\n/// required since the rewards (reward token) is also in ETH.\n///\n/// To simplify the accounting of WETH there is another difference in behavior compared to the other strategies.\n/// To withdraw WETH asset - exit message is posted to validators and the ETH hits this contract with multiple days\n/// delay. In order to simplify the WETH accounting upon detection of such an event the ValidatorAccountant\n/// immediately wraps ETH to WETH and sends it to the Vault.\n///\n/// On the other hand any ETH on the contract (across multiple blocks) is there either:\n/// - as a result of already accounted for consensus rewards\n/// - as a result of not yet accounted for consensus rewards\n/// - as a results of not yet accounted for full validator withdrawals (or validator slashes)\n///\n/// Even though the strategy assets and rewards are a very similar asset the consensus layer rewards and the\n/// execution layer rewards are considered rewards and those are dripped to the Vault over a configurable time\n/// interval and not immediately.\ncontract NativeStakingSSVStrategy is\n ValidatorAccountant,\n InitializableAbstractStrategy\n{\n using SafeERC20 for IERC20;\n\n /// @notice SSV ERC20 token that serves as a payment for operating SSV validators\n address public immutable SSV_TOKEN;\n /// @notice Fee collector address\n /// @dev this address will receive Execution layer rewards - These are rewards earned for\n /// executing transactions on the Ethereum network as part of block proposals. They include\n /// priority fees (fees paid by users for their transactions to be included) and MEV rewards\n /// (rewards for arranging transactions in a way that benefits the validator).\n address payable public immutable FEE_ACCUMULATOR_ADDRESS;\n\n /// @dev This contract receives WETH as the deposit asset, but unlike other strategies doesn't immediately\n /// deposit it to an underlying platform. Rather a special privilege account stakes it to the validators.\n /// For that reason calling WETH.balanceOf(this) in a deposit function can contain WETH that has just been\n /// deposited and also WETH that has previously been deposited. To keep a correct count we need to keep track\n /// of WETH that has already been accounted for.\n /// This value represents the amount of WETH balance of this contract that has already been accounted for by the\n /// deposit events.\n /// It is important to note that this variable is not concerned with WETH that is a result of full/partial\n /// withdrawal of the validators. It is strictly concerned with WETH that has been deposited and is waiting to\n /// be staked.\n uint256 public depositedWethAccountedFor;\n\n // For future use\n uint256[49] private __gap;\n\n /// @param _baseConfig Base strategy config with platformAddress (ERC-4626 Vault contract), eg sfrxETH or sDAI,\n /// and vaultAddress (OToken Vault contract), eg VaultProxy or OETHVaultProxy\n /// @param _wethAddress Address of the Erc20 WETH Token contract\n /// @param _ssvToken Address of the Erc20 SSV Token contract\n /// @param _ssvNetwork Address of the SSV Network contract\n /// @param _maxValidators Maximum number of validators that can be registered in the strategy\n /// @param _feeAccumulator Address of the fee accumulator receiving execution layer validator rewards\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\n constructor(\n BaseStrategyConfig memory _baseConfig,\n address _wethAddress,\n address _ssvToken,\n address _ssvNetwork,\n uint256 _maxValidators,\n address _feeAccumulator,\n address _beaconChainDepositContract\n )\n InitializableAbstractStrategy(_baseConfig)\n ValidatorAccountant(\n _wethAddress,\n _baseConfig.vaultAddress,\n _beaconChainDepositContract,\n _ssvNetwork,\n _maxValidators\n )\n {\n SSV_TOKEN = _ssvToken;\n FEE_ACCUMULATOR_ADDRESS = payable(_feeAccumulator);\n }\n\n /// @notice initialize function, to set up initial internal state\n /// @param _rewardTokenAddresses Address of reward token for platform\n /// @param _assets Addresses of initial supported assets\n /// @param _pTokens Platform Token corresponding addresses\n function initialize(\n address[] memory _rewardTokenAddresses,\n address[] memory _assets,\n address[] memory _pTokens\n ) external onlyGovernor initializer {\n InitializableAbstractStrategy._initialize(\n _rewardTokenAddresses,\n _assets,\n _pTokens\n );\n }\n\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\n /// It just checks the asset is WETH and emits the Deposit event.\n /// To deposit WETH into validators `registerSsvValidator` and `stakeEth` must be used.\n /// Will NOT revert if the strategy is paused from an accounting failure.\n /// @param _asset Address of asset to deposit. Has to be WETH.\n /// @param _amount Amount of assets that were transferred to the strategy by the vault.\n function deposit(address _asset, uint256 _amount)\n external\n override\n onlyVault\n nonReentrant\n {\n require(_asset == WETH, \"Unsupported asset\");\n depositedWethAccountedFor += _amount;\n _deposit(_asset, _amount);\n }\n\n /// @dev Deposit WETH to this strategy so it can later be staked into a validator.\n /// @param _asset Address of WETH\n /// @param _amount Amount of WETH to deposit\n function _deposit(address _asset, uint256 _amount) internal {\n require(_amount > 0, \"Must deposit something\");\n /*\n * We could do a check here that would revert when \"_amount % 32 ether != 0\". With the idea of\n * not allowing deposits that will result in WETH sitting on the strategy after all the possible batches\n * of 32ETH have been staked.\n * But someone could mess with our strategy by sending some WETH to it. And we might want to deposit just\n * enough WETH to add it up to 32 so it can be staked. For that reason the check is left out.\n *\n * WETH sitting on the strategy won't interfere with the accounting since accounting only operates on ETH.\n */\n emit Deposit(_asset, address(0), _amount);\n }\n\n /// @notice Unlike other strategies, this does not deposit assets into the underlying platform.\n /// It just emits the Deposit event.\n /// To deposit WETH into validators `registerSsvValidator` and `stakeEth` must be used.\n /// Will NOT revert if the strategy is paused from an accounting failure.\n function depositAll() external override onlyVault nonReentrant {\n uint256 wethBalance = IERC20(WETH).balanceOf(address(this));\n uint256 newWeth = wethBalance - depositedWethAccountedFor;\n\n if (newWeth > 0) {\n depositedWethAccountedFor = wethBalance;\n\n _deposit(WETH, newWeth);\n }\n }\n\n /// @notice Withdraw WETH from this contract. Used only if some WETH for is lingering on the contract.\n /// That can happen when:\n /// - after mints if the strategy is the default\n /// - time between depositToStrategy and stakeEth\n /// - the deposit was not a multiple of 32 WETH\n /// - someone sent WETH directly to this contract\n /// Will NOT revert if the strategy is paused from an accounting failure.\n /// @param _recipient Address to receive withdrawn assets\n /// @param _asset WETH to withdraw\n /// @param _amount Amount of WETH to withdraw\n function withdraw(\n address _recipient,\n address _asset,\n uint256 _amount\n ) external override onlyVault nonReentrant {\n require(_asset == WETH, \"Unsupported asset\");\n _withdraw(_recipient, _asset, _amount);\n }\n\n function _withdraw(\n address _recipient,\n address _asset,\n uint256 _amount\n ) internal {\n require(_amount > 0, \"Must withdraw something\");\n require(_recipient != address(0), \"Must specify recipient\");\n\n _wethWithdrawn(_amount);\n\n IERC20(_asset).safeTransfer(_recipient, _amount);\n emit Withdrawal(_asset, address(0), _amount);\n }\n\n /// @notice transfer all WETH deposits back to the vault.\n /// This does not withdraw from the validators. That has to be done separately with the\n /// `exitSsvValidator` and `removeSsvValidator` operations.\n /// This does not withdraw any execution rewards from the FeeAccumulator or\n /// consensus rewards in this strategy.\n /// Any ETH in this strategy that was swept from a full validator withdrawal will not be withdrawn.\n /// ETH from full validator withdrawals is sent to the Vault using `doAccounting`.\n /// Will NOT revert if the strategy is paused from an accounting failure.\n function withdrawAll() external override onlyVaultOrGovernor nonReentrant {\n uint256 wethBalance = IERC20(WETH).balanceOf(address(this));\n if (wethBalance > 0) {\n _withdraw(vaultAddress, WETH, wethBalance);\n }\n }\n\n /// @notice Returns the total value of (W)ETH that is staked to the validators\n /// and WETH deposits that are still to be staked.\n /// This does not include ETH from consensus rewards sitting in this strategy\n /// or ETH from MEV rewards in the FeeAccumulator. These rewards are harvested\n /// and sent to the Dripper so will eventually be sent to the Vault as WETH.\n /// @param _asset Address of weth asset\n /// @return balance Total value of (W)ETH\n function checkBalance(address _asset)\n external\n view\n override\n returns (uint256 balance)\n {\n require(_asset == WETH, \"Unsupported asset\");\n\n balance =\n // add the ETH that has been staked in validators\n activeDepositedValidators *\n FULL_STAKE +\n // add the WETH in the strategy from deposits that are still to be staked\n IERC20(WETH).balanceOf(address(this));\n }\n\n function pause() external onlyStrategist {\n _pause();\n }\n\n /// @notice Returns bool indicating whether asset is supported by strategy.\n /// @param _asset The address of the asset token.\n function supportsAsset(address _asset) public view override returns (bool) {\n return _asset == WETH;\n }\n\n /// @notice Approves the SSV Network contract to transfer SSV tokens for deposits\n function safeApproveAllTokens() external override {\n /// @dev Approves the SSV Network contract to transfer SSV tokens for deposits\n IERC20(SSV_TOKEN).approve(SSV_NETWORK, type(uint256).max);\n }\n\n /**\n * @notice Only accept ETH from the FeeAccumulator and the WETH contract - required when\n * unwrapping WETH just before staking it to the validator\n * @dev don't want to receive donations from anyone else as this will\n * mess with the accounting of the consensus rewards and validator full withdrawals\n */\n receive() external payable {\n require(\n msg.sender == FEE_ACCUMULATOR_ADDRESS || msg.sender == WETH,\n \"Eth not from allowed contracts\"\n );\n }\n\n /***************************************\n Internal functions\n ****************************************/\n\n function _abstractSetPToken(address _asset, address) internal override {}\n\n /// @dev Convert accumulated ETH to WETH and send to the Harvester.\n /// Will revert if the strategy is paused for accounting.\n function _collectRewardTokens() internal override whenNotPaused {\n // collect ETH from execution rewards from the fee accumulator\n uint256 executionRewards = FeeAccumulator(FEE_ACCUMULATOR_ADDRESS)\n .collect();\n\n // total ETH rewards to be harvested = execution rewards + consensus rewards\n uint256 ethRewards = executionRewards + consensusRewards;\n\n require(\n address(this).balance >= ethRewards,\n \"Insufficient eth balance\"\n );\n\n if (ethRewards > 0) {\n // reset the counter keeping track of beacon chain consensus rewards\n consensusRewards = 0;\n\n // Convert ETH rewards to WETH\n IWETH9(WETH).deposit{ value: ethRewards }();\n\n IERC20(WETH).safeTransfer(harvesterAddress, ethRewards);\n emit RewardTokenCollected(harvesterAddress, WETH, ethRewards);\n }\n }\n\n /// @dev emits Withdrawal event from NativeStakingSSVStrategy\n function _wethWithdrawnToVault(uint256 _amount) internal override {\n emit Withdrawal(WETH, address(0), _amount);\n }\n\n /// @dev Called when WETH is withdrawn from the strategy or staked to a validator so\n /// the strategy knows how much WETH it has on deposit.\n /// This is so it can emit the correct amount in the Deposit event in depositAll().\n function _wethWithdrawn(uint256 _amount) internal override {\n /* In an ideal world we wouldn't need to reduce the deduction amount when the\n * depositedWethAccountedFor is smaller than the _amount.\n *\n * The reason this is required is that a malicious actor could sent WETH directly\n * to this contract and that would circumvent the increase of depositedWethAccountedFor\n * property. When the ETH would be staked the depositedWethAccountedFor amount could\n * be deducted so much that it would be negative.\n */\n uint256 deductAmount = Math.min(_amount, depositedWethAccountedFor);\n depositedWethAccountedFor -= deductAmount;\n }\n}\n" }, "contracts/strategies/NativeStaking/ValidatorAccountant.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { ValidatorRegistrator } from \"./ValidatorRegistrator.sol\";\nimport { IWETH9 } from \"../../interfaces/IWETH9.sol\";\n\n/// @title Validator Accountant\n/// @notice Attributes the ETH swept from beacon chain validators to this strategy contract\n/// as either full or partial withdrawals. Partial withdrawals being consensus rewards.\n/// Full withdrawals are from exited validators.\n/// @author Origin Protocol Inc\nabstract contract ValidatorAccountant is ValidatorRegistrator {\n /// @notice The minimum amount of blocks that need to pass between two calls to manuallyFixAccounting\n uint256 public constant MIN_FIX_ACCOUNTING_CADENCE = 7200; // 1 day\n\n /// @notice Keeps track of the total consensus rewards swept from the beacon chain\n uint256 public consensusRewards;\n\n /// @notice start of fuse interval\n uint256 public fuseIntervalStart;\n /// @notice end of fuse interval\n uint256 public fuseIntervalEnd;\n /// @notice last block number manuallyFixAccounting has been called\n uint256 public lastFixAccountingBlockNumber;\n\n uint256[49] private __gap;\n\n event FuseIntervalUpdated(uint256 start, uint256 end);\n event AccountingFullyWithdrawnValidator(\n uint256 noOfValidators,\n uint256 remainingValidators,\n uint256 wethSentToVault\n );\n event AccountingValidatorSlashed(\n uint256 remainingValidators,\n uint256 wethSentToVault\n );\n event AccountingConsensusRewards(uint256 amount);\n\n event AccountingManuallyFixed(\n int256 validatorsDelta,\n int256 consensusRewardsDelta,\n uint256 wethToVault\n );\n\n /// @param _wethAddress Address of the Erc20 WETH Token contract\n /// @param _vaultAddress Address of the Vault\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\n /// @param _ssvNetwork Address of the SSV Network contract\n /// @param _maxValidators Maximum number of validators that can be registered in the strategy\n constructor(\n address _wethAddress,\n address _vaultAddress,\n address _beaconChainDepositContract,\n address _ssvNetwork,\n uint256 _maxValidators\n )\n ValidatorRegistrator(\n _wethAddress,\n _vaultAddress,\n _beaconChainDepositContract,\n _ssvNetwork,\n _maxValidators\n )\n {}\n\n /// @notice set fuse interval values\n function setFuseInterval(\n uint256 _fuseIntervalStart,\n uint256 _fuseIntervalEnd\n ) external onlyGovernor {\n require(\n _fuseIntervalStart < _fuseIntervalEnd &&\n _fuseIntervalEnd < 32 ether &&\n _fuseIntervalEnd - _fuseIntervalStart >= 4 ether,\n \"Incorrect fuse interval\"\n );\n\n fuseIntervalStart = _fuseIntervalStart;\n fuseIntervalEnd = _fuseIntervalEnd;\n\n emit FuseIntervalUpdated(_fuseIntervalStart, _fuseIntervalEnd);\n }\n\n /* solhint-disable max-line-length */\n /// This notion page offers a good explanation of how the accounting functions\n /// https://www.notion.so/originprotocol/Limited-simplified-native-staking-accounting-67a217c8420d40678eb943b9da0ee77d\n /// In short, after dividing by 32, if the ETH remaining on the contract falls between 0 and fuseIntervalStart,\n /// the accounting function will treat that ETH as Beacon chain consensus rewards.\n /// On the contrary, if after dividing by 32, the ETH remaining on the contract falls between fuseIntervalEnd and 32,\n /// the accounting function will treat that as a validator slashing.\n /// @notice Perform the accounting attributing beacon chain ETH to either full or partial withdrawals. Returns true when\n /// accounting is valid and fuse isn't \"blown\". Returns false when fuse is blown.\n /// @dev This function could in theory be permission-less but lets allow only the Registrator (Defender Action) to call it\n /// for now.\n /// @return accountingValid true if accounting was successful, false if fuse is blown\n /* solhint-enable max-line-length */\n function doAccounting()\n external\n onlyRegistrator\n whenNotPaused\n nonReentrant\n returns (bool accountingValid)\n {\n // pause the accounting on failure\n accountingValid = _doAccounting(true);\n }\n\n // slither-disable-start reentrancy-eth\n function _doAccounting(bool pauseOnFail)\n internal\n returns (bool accountingValid)\n {\n if (address(this).balance < consensusRewards) {\n return _failAccounting(pauseOnFail);\n }\n\n // Calculate all the new ETH that has been swept to the contract since the last accounting\n uint256 newSweptETH = address(this).balance - consensusRewards;\n accountingValid = true;\n\n // send the ETH that is from fully withdrawn validators to the Vault\n if (newSweptETH >= FULL_STAKE) {\n uint256 fullyWithdrawnValidators;\n // explicitly cast to uint256 as we want to round to a whole number of validators\n fullyWithdrawnValidators = uint256(newSweptETH / FULL_STAKE);\n activeDepositedValidators -= fullyWithdrawnValidators;\n\n uint256 wethToVault = FULL_STAKE * fullyWithdrawnValidators;\n IWETH9(WETH).deposit{ value: wethToVault }();\n // slither-disable-next-line unchecked-transfer\n IWETH9(WETH).transfer(VAULT_ADDRESS, wethToVault);\n _wethWithdrawnToVault(wethToVault);\n\n emit AccountingFullyWithdrawnValidator(\n fullyWithdrawnValidators,\n activeDepositedValidators,\n wethToVault\n );\n }\n\n uint256 ethRemaining = address(this).balance - consensusRewards;\n // should be less than a whole validator stake\n require(ethRemaining < FULL_STAKE, \"Unexpected accounting\");\n\n // If no Beacon chain consensus rewards swept\n if (ethRemaining == 0) {\n // do nothing\n return accountingValid;\n } else if (ethRemaining < fuseIntervalStart) {\n // Beacon chain consensus rewards swept (partial validator withdrawals)\n // solhint-disable-next-line reentrancy\n consensusRewards += ethRemaining;\n emit AccountingConsensusRewards(ethRemaining);\n } else if (ethRemaining > fuseIntervalEnd) {\n // Beacon chain consensus rewards swept but also a slashed validator fully exited\n IWETH9(WETH).deposit{ value: ethRemaining }();\n // slither-disable-next-line unchecked-transfer\n IWETH9(WETH).transfer(VAULT_ADDRESS, ethRemaining);\n activeDepositedValidators -= 1;\n\n _wethWithdrawnToVault(ethRemaining);\n\n emit AccountingValidatorSlashed(\n activeDepositedValidators,\n ethRemaining\n );\n }\n // Oh no... Fuse is blown. The Strategist needs to adjust the accounting values.\n else {\n return _failAccounting(pauseOnFail);\n }\n }\n\n // slither-disable-end reentrancy-eth\n\n /// @dev pause any further accounting if required and return false\n function _failAccounting(bool pauseOnFail)\n internal\n returns (bool accountingValid)\n {\n // pause if not already\n if (pauseOnFail) {\n _pause();\n }\n // fail the accounting\n accountingValid = false;\n }\n\n /// @notice Allow the Strategist to fix the accounting of this strategy and unpause.\n /// @param _validatorsDelta adjust the active validators by up to plus three or minus three\n /// @param _consensusRewardsDelta adjust the accounted for consensus rewards up or down\n /// @param _ethToVaultAmount the amount of ETH that gets wrapped into WETH and sent to the Vault\n /// @dev There is a case when a validator(s) gets slashed so much that the eth swept from\n /// the beacon chain enters the fuse area and there are no consensus rewards on the contract\n /// to \"dip into\"/use. To increase the amount of unaccounted ETH over the fuse end interval\n /// we need to reduce the amount of active deposited validators and immediately send WETH\n /// to the vault, so it doesn't interfere with further accounting.\n function manuallyFixAccounting(\n int256 _validatorsDelta,\n int256 _consensusRewardsDelta,\n uint256 _ethToVaultAmount\n ) external onlyStrategist whenPaused nonReentrant {\n require(\n lastFixAccountingBlockNumber + MIN_FIX_ACCOUNTING_CADENCE <\n block.number,\n \"Fix accounting called too soon\"\n );\n require(\n _validatorsDelta >= -3 &&\n _validatorsDelta <= 3 &&\n // new value must be positive\n int256(activeDepositedValidators) + _validatorsDelta >= 0,\n \"Invalid validatorsDelta\"\n );\n require(\n _consensusRewardsDelta >= -332 ether &&\n _consensusRewardsDelta <= 332 ether &&\n // new value must be positive\n int256(consensusRewards) + _consensusRewardsDelta >= 0,\n \"Invalid consensusRewardsDelta\"\n );\n require(_ethToVaultAmount <= 32 ether * 3, \"Invalid wethToVaultAmount\");\n\n activeDepositedValidators = uint256(\n int256(activeDepositedValidators) + _validatorsDelta\n );\n consensusRewards = uint256(\n int256(consensusRewards) + _consensusRewardsDelta\n );\n lastFixAccountingBlockNumber = block.number;\n if (_ethToVaultAmount > 0) {\n IWETH9(WETH).deposit{ value: _ethToVaultAmount }();\n // slither-disable-next-line unchecked-transfer\n IWETH9(WETH).transfer(VAULT_ADDRESS, _ethToVaultAmount);\n _wethWithdrawnToVault(_ethToVaultAmount);\n }\n\n emit AccountingManuallyFixed(\n _validatorsDelta,\n _consensusRewardsDelta,\n _ethToVaultAmount\n );\n\n // rerun the accounting to see if it has now been fixed.\n // Do not pause the accounting on failure as it is already paused\n require(_doAccounting(false), \"Fuse still blown\");\n\n // unpause since doAccounting was successful\n _unpause();\n }\n\n /***************************************\n Abstract\n ****************************************/\n\n /// @dev allows for NativeStakingSSVStrategy contract to emit the Withdrawal event\n function _wethWithdrawnToVault(uint256 _amount) internal virtual;\n}\n" }, "contracts/strategies/NativeStaking/ValidatorRegistrator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Pausable } from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport { Governable } from \"../../governance/Governable.sol\";\nimport { IDepositContract } from \"../../interfaces/IDepositContract.sol\";\nimport { IVault } from \"../../interfaces/IVault.sol\";\nimport { IWETH9 } from \"../../interfaces/IWETH9.sol\";\nimport { ISSVNetwork, Cluster } from \"../../interfaces/ISSVNetwork.sol\";\n\nstruct ValidatorStakeData {\n bytes pubkey;\n bytes signature;\n bytes32 depositDataRoot;\n}\n\n/**\n * @title Registrator of the validators\n * @notice This contract implements all the required functionality to register, exit and remove validators.\n * @author Origin Protocol Inc\n */\nabstract contract ValidatorRegistrator is Governable, Pausable {\n /// @notice The maximum amount of ETH that can be staked by a validator\n /// @dev this can change in the future with EIP-7251, Increase the MAX_EFFECTIVE_BALANCE\n uint256 public constant FULL_STAKE = 32 ether;\n\n /// @notice The address of the Wrapped ETH (WETH) token contract\n address public immutable WETH;\n /// @notice The address of the beacon chain deposit contract\n address public immutable BEACON_CHAIN_DEPOSIT_CONTRACT;\n /// @notice The address of the SSV Network contract used to interface with\n address public immutable SSV_NETWORK;\n /// @notice Address of the OETH Vault proxy contract\n address public immutable VAULT_ADDRESS;\n /// @notice Maximum number of validators that can be registered in this strategy\n uint256 public immutable MAX_VALIDATORS;\n\n /// @notice Address of the registrator - allowed to register, exit and remove validators\n address public validatorRegistrator;\n /// @notice The number of validators that have 32 (!) ETH actively deposited. When a new deposit\n /// to a validator happens this number increases, when a validator exit is detected this number\n /// decreases.\n uint256 public activeDepositedValidators;\n /// @notice State of the validators keccak256(pubKey) => state\n mapping(bytes32 => VALIDATOR_STATE) public validatorsStates;\n /// @notice The account that is allowed to modify stakeETHThreshold and reset stakeETHTally\n address public stakingMonitor;\n /// @notice Amount of ETH that can be staked before staking on the contract is suspended\n /// and the `stakingMonitor` needs to approve further staking by calling `resetStakeETHTally`\n uint256 public stakeETHThreshold;\n /// @notice Amount of ETH that has been staked since the `stakingMonitor` last called `resetStakeETHTally`.\n /// This can not go above `stakeETHThreshold`.\n uint256 public stakeETHTally;\n // For future use\n uint256[47] private __gap;\n\n enum VALIDATOR_STATE {\n NON_REGISTERED, // validator is not registered on the SSV network\n REGISTERED, // validator is registered on the SSV network\n STAKED, // validator has funds staked\n EXITING, // exit message has been posted and validator is in the process of exiting\n EXIT_COMPLETE // validator has funds withdrawn to the EigenPod and is removed from the SSV\n }\n\n event RegistratorChanged(address indexed newAddress);\n event StakingMonitorChanged(address indexed newAddress);\n event ETHStaked(bytes32 indexed pubKeyHash, bytes pubKey, uint256 amount);\n event SSVValidatorRegistered(\n bytes32 indexed pubKeyHash,\n bytes pubKey,\n uint64[] operatorIds\n );\n event SSVValidatorExitInitiated(\n bytes32 indexed pubKeyHash,\n bytes pubKey,\n uint64[] operatorIds\n );\n event SSVValidatorExitCompleted(\n bytes32 indexed pubKeyHash,\n bytes pubKey,\n uint64[] operatorIds\n );\n event StakeETHThresholdChanged(uint256 amount);\n event StakeETHTallyReset();\n\n /// @dev Throws if called by any account other than the Registrator\n modifier onlyRegistrator() {\n require(\n msg.sender == validatorRegistrator,\n \"Caller is not the Registrator\"\n );\n _;\n }\n\n /// @dev Throws if called by any account other than the Staking monitor\n modifier onlyStakingMonitor() {\n require(msg.sender == stakingMonitor, \"Caller is not the Monitor\");\n _;\n }\n\n /// @dev Throws if called by any account other than the Strategist\n modifier onlyStrategist() {\n require(\n msg.sender == IVault(VAULT_ADDRESS).strategistAddr(),\n \"Caller is not the Strategist\"\n );\n _;\n }\n\n /// @param _wethAddress Address of the Erc20 WETH Token contract\n /// @param _vaultAddress Address of the Vault\n /// @param _beaconChainDepositContract Address of the beacon chain deposit contract\n /// @param _ssvNetwork Address of the SSV Network contract\n /// @param _maxValidators Maximum number of validators that can be registered in the strategy\n constructor(\n address _wethAddress,\n address _vaultAddress,\n address _beaconChainDepositContract,\n address _ssvNetwork,\n uint256 _maxValidators\n ) {\n WETH = _wethAddress;\n BEACON_CHAIN_DEPOSIT_CONTRACT = _beaconChainDepositContract;\n SSV_NETWORK = _ssvNetwork;\n VAULT_ADDRESS = _vaultAddress;\n MAX_VALIDATORS = _maxValidators;\n }\n\n /// @notice Set the address of the registrator which can register, exit and remove validators\n function setRegistrator(address _address) external onlyGovernor {\n validatorRegistrator = _address;\n emit RegistratorChanged(_address);\n }\n\n /// @notice Set the address of the staking monitor that is allowed to reset stakeETHTally\n function setStakingMonitor(address _address) external onlyGovernor {\n stakingMonitor = _address;\n emit StakingMonitorChanged(_address);\n }\n\n /// @notice Set the amount of ETH that can be staked before staking monitor\n // needs to a approve further staking by resetting the stake ETH tally\n function setStakeETHThreshold(uint256 _amount) external onlyGovernor {\n stakeETHThreshold = _amount;\n emit StakeETHThresholdChanged(_amount);\n }\n\n /// @notice Reset the stakeETHTally\n function resetStakeETHTally() external onlyStakingMonitor {\n stakeETHTally = 0;\n emit StakeETHTallyReset();\n }\n\n /// @notice Stakes WETH to the node validators\n /// @param validators A list of validator data needed to stake.\n /// The `ValidatorStakeData` struct contains the pubkey, signature and depositDataRoot.\n /// Only the registrator can call this function.\n // slither-disable-start reentrancy-eth\n function stakeEth(ValidatorStakeData[] calldata validators)\n external\n onlyRegistrator\n whenNotPaused\n nonReentrant\n {\n uint256 requiredETH = validators.length * FULL_STAKE;\n\n // Check there is enough WETH from the deposits sitting in this strategy contract\n require(\n requiredETH <= IWETH9(WETH).balanceOf(address(this)),\n \"Insufficient WETH\"\n );\n require(\n activeDepositedValidators + validators.length <= MAX_VALIDATORS,\n \"Max validators reached\"\n );\n\n require(\n stakeETHTally + requiredETH <= stakeETHThreshold,\n \"Staking ETH over threshold\"\n );\n stakeETHTally += requiredETH;\n\n // Convert required ETH from WETH\n IWETH9(WETH).withdraw(requiredETH);\n _wethWithdrawn(requiredETH);\n\n /* 0x01 to indicate that withdrawal credentials will contain an EOA address that the sweeping function\n * can sweep funds to.\n * bytes11(0) to fill up the required zeros\n * remaining bytes20 are for the address\n */\n bytes memory withdrawalCredentials = abi.encodePacked(\n bytes1(0x01),\n bytes11(0),\n address(this)\n );\n\n // For each validator\n for (uint256 i = 0; i < validators.length; ++i) {\n bytes32 pubKeyHash = keccak256(validators[i].pubkey);\n\n require(\n validatorsStates[pubKeyHash] == VALIDATOR_STATE.REGISTERED,\n \"Validator not registered\"\n );\n\n IDepositContract(BEACON_CHAIN_DEPOSIT_CONTRACT).deposit{\n value: FULL_STAKE\n }(\n validators[i].pubkey,\n withdrawalCredentials,\n validators[i].signature,\n validators[i].depositDataRoot\n );\n\n validatorsStates[pubKeyHash] = VALIDATOR_STATE.STAKED;\n\n emit ETHStaked(pubKeyHash, validators[i].pubkey, FULL_STAKE);\n }\n // save gas by changing this storage variable only once rather each time in the loop.\n activeDepositedValidators += validators.length;\n }\n\n // slither-disable-end reentrancy-eth\n\n /// @notice Registers a new validator in the SSV Cluster.\n /// Only the registrator can call this function.\n /// @param publicKeys The public keys of the validators\n /// @param operatorIds The operator IDs of the SSV Cluster\n /// @param sharesData The shares data for each validator\n /// @param ssvAmount The amount of SSV tokens to be deposited to the SSV cluster\n /// @param cluster The SSV cluster details including the validator count and SSV balance\n // slither-disable-start reentrancy-no-eth\n function registerSsvValidators(\n bytes[] calldata publicKeys,\n uint64[] calldata operatorIds,\n bytes[] calldata sharesData,\n uint256 ssvAmount,\n Cluster calldata cluster\n ) external onlyRegistrator whenNotPaused {\n require(\n publicKeys.length == sharesData.length,\n \"Pubkey sharesData mismatch\"\n );\n // Check each public key has not already been used\n bytes32 pubKeyHash;\n VALIDATOR_STATE currentState;\n for (uint256 i = 0; i < publicKeys.length; ++i) {\n pubKeyHash = keccak256(publicKeys[i]);\n currentState = validatorsStates[pubKeyHash];\n require(\n currentState == VALIDATOR_STATE.NON_REGISTERED,\n \"Validator already registered\"\n );\n\n validatorsStates[pubKeyHash] = VALIDATOR_STATE.REGISTERED;\n\n emit SSVValidatorRegistered(pubKeyHash, publicKeys[i], operatorIds);\n }\n\n ISSVNetwork(SSV_NETWORK).bulkRegisterValidator(\n publicKeys,\n operatorIds,\n sharesData,\n ssvAmount,\n cluster\n );\n }\n\n // slither-disable-end reentrancy-no-eth\n\n /// @notice Exit a validator from the Beacon chain.\n /// The staked ETH will eventually swept to this native staking strategy.\n /// Only the registrator can call this function.\n /// @param publicKey The public key of the validator\n /// @param operatorIds The operator IDs of the SSV Cluster\n // slither-disable-start reentrancy-no-eth\n function exitSsvValidator(\n bytes calldata publicKey,\n uint64[] calldata operatorIds\n ) external onlyRegistrator whenNotPaused {\n bytes32 pubKeyHash = keccak256(publicKey);\n VALIDATOR_STATE currentState = validatorsStates[pubKeyHash];\n require(currentState == VALIDATOR_STATE.STAKED, \"Validator not staked\");\n\n ISSVNetwork(SSV_NETWORK).exitValidator(publicKey, operatorIds);\n\n validatorsStates[pubKeyHash] = VALIDATOR_STATE.EXITING;\n\n emit SSVValidatorExitInitiated(pubKeyHash, publicKey, operatorIds);\n }\n\n // slither-disable-end reentrancy-no-eth\n\n /// @notice Remove a validator from the SSV Cluster.\n /// Make sure `exitSsvValidator` is called before and the validate has exited the Beacon chain.\n /// If removed before the validator has exited the beacon chain will result in the validator being slashed.\n /// Only the registrator can call this function.\n /// @param publicKey The public key of the validator\n /// @param operatorIds The operator IDs of the SSV Cluster\n /// @param cluster The SSV cluster details including the validator count and SSV balance\n // slither-disable-start reentrancy-no-eth\n function removeSsvValidator(\n bytes calldata publicKey,\n uint64[] calldata operatorIds,\n Cluster calldata cluster\n ) external onlyRegistrator whenNotPaused {\n bytes32 pubKeyHash = keccak256(publicKey);\n VALIDATOR_STATE currentState = validatorsStates[pubKeyHash];\n // Can remove SSV validators that were incorrectly registered and can not be deposited to.\n require(\n currentState == VALIDATOR_STATE.EXITING ||\n currentState == VALIDATOR_STATE.REGISTERED,\n \"Validator not regd or exiting\"\n );\n\n ISSVNetwork(SSV_NETWORK).removeValidator(\n publicKey,\n operatorIds,\n cluster\n );\n\n validatorsStates[pubKeyHash] = VALIDATOR_STATE.EXIT_COMPLETE;\n\n emit SSVValidatorExitCompleted(pubKeyHash, publicKey, operatorIds);\n }\n\n // slither-disable-end reentrancy-no-eth\n\n /// @notice Deposits more SSV Tokens to the SSV Network contract which is used to pay the SSV Operators.\n /// @dev A SSV cluster is defined by the SSVOwnerAddress and the set of operatorIds.\n /// uses \"onlyStrategist\" modifier so continuous front-running can't DOS our maintenance service\n /// that tries to top up SSV tokens.\n /// @param operatorIds The operator IDs of the SSV Cluster\n /// @param ssvAmount The amount of SSV tokens to be deposited to the SSV cluster\n /// @param cluster The SSV cluster details including the validator count and SSV balance\n function depositSSV(\n uint64[] memory operatorIds,\n uint256 ssvAmount,\n Cluster memory cluster\n ) external onlyStrategist {\n ISSVNetwork(SSV_NETWORK).deposit(\n address(this),\n operatorIds,\n ssvAmount,\n cluster\n );\n }\n\n /***************************************\n Abstract\n ****************************************/\n\n /// @dev Called when WETH is withdrawn from the strategy or staked to a validator so\n /// the strategy knows how much WETH it has on deposit.\n /// This is so it can emit the correct amount in the Deposit event in depositAll().\n function _wethWithdrawn(uint256 _amount) internal virtual;\n}\n" }, "contracts/token/OUSD.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title OUSD Token Contract\n * @dev ERC20 compatible contract for OUSD\n * @dev Implements an elastic supply\n * @author Origin Protocol Inc\n */\nimport { SafeMath } from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport { Initializable } from \"../utils/Initializable.sol\";\nimport { InitializableERC20Detailed } from \"../utils/InitializableERC20Detailed.sol\";\nimport { StableMath } from \"../utils/StableMath.sol\";\nimport { Governable } from \"../governance/Governable.sol\";\n\n/**\n * NOTE that this is an ERC20 token but the invariant that the sum of\n * balanceOf(x) for all x is not >= totalSupply(). This is a consequence of the\n * rebasing design. Any integrations with OUSD should be aware.\n */\n\ncontract OUSD is Initializable, InitializableERC20Detailed, Governable {\n using SafeMath for uint256;\n using StableMath for uint256;\n\n event TotalSupplyUpdatedHighres(\n uint256 totalSupply,\n uint256 rebasingCredits,\n uint256 rebasingCreditsPerToken\n );\n event AccountRebasingEnabled(address account);\n event AccountRebasingDisabled(address account);\n\n enum RebaseOptions {\n NotSet,\n OptOut,\n OptIn\n }\n\n uint256 private constant MAX_SUPPLY = ~uint128(0); // (2^128) - 1\n uint256 public _totalSupply;\n mapping(address => mapping(address => uint256)) private _allowances;\n address public vaultAddress = address(0);\n mapping(address => uint256) private _creditBalances;\n uint256 private _rebasingCredits;\n uint256 private _rebasingCreditsPerToken;\n // Frozen address/credits are non rebasing (value is held in contracts which\n // do not receive yield unless they explicitly opt in)\n uint256 public nonRebasingSupply;\n mapping(address => uint256) public nonRebasingCreditsPerToken;\n mapping(address => RebaseOptions) public rebaseState;\n mapping(address => uint256) public isUpgraded;\n\n uint256 private constant RESOLUTION_INCREASE = 1e9;\n\n function initialize(\n string calldata _nameArg,\n string calldata _symbolArg,\n address _vaultAddress,\n uint256 _initialCreditsPerToken\n ) external onlyGovernor initializer {\n InitializableERC20Detailed._initialize(_nameArg, _symbolArg, 18);\n _rebasingCreditsPerToken = _initialCreditsPerToken;\n vaultAddress = _vaultAddress;\n }\n\n /**\n * @dev Verifies that the caller is the Vault contract\n */\n modifier onlyVault() {\n require(vaultAddress == msg.sender, \"Caller is not the Vault\");\n _;\n }\n\n /**\n * @return The total supply of OUSD.\n */\n function totalSupply() public view override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @return Low resolution rebasingCreditsPerToken\n */\n function rebasingCreditsPerToken() public view returns (uint256) {\n return _rebasingCreditsPerToken / RESOLUTION_INCREASE;\n }\n\n /**\n * @return Low resolution total number of rebasing credits\n */\n function rebasingCredits() public view returns (uint256) {\n return _rebasingCredits / RESOLUTION_INCREASE;\n }\n\n /**\n * @return High resolution rebasingCreditsPerToken\n */\n function rebasingCreditsPerTokenHighres() public view returns (uint256) {\n return _rebasingCreditsPerToken;\n }\n\n /**\n * @return High resolution total number of rebasing credits\n */\n function rebasingCreditsHighres() public view returns (uint256) {\n return _rebasingCredits;\n }\n\n /**\n * @dev Gets the balance of the specified address.\n * @param _account Address to query the balance of.\n * @return A uint256 representing the amount of base units owned by the\n * specified address.\n */\n function balanceOf(address _account)\n public\n view\n override\n returns (uint256)\n {\n if (_creditBalances[_account] == 0) return 0;\n return\n _creditBalances[_account].divPrecisely(_creditsPerToken(_account));\n }\n\n /**\n * @dev Gets the credits balance of the specified address.\n * @dev Backwards compatible with old low res credits per token.\n * @param _account The address to query the balance of.\n * @return (uint256, uint256) Credit balance and credits per token of the\n * address\n */\n function creditsBalanceOf(address _account)\n public\n view\n returns (uint256, uint256)\n {\n uint256 cpt = _creditsPerToken(_account);\n if (cpt == 1e27) {\n // For a period before the resolution upgrade, we created all new\n // contract accounts at high resolution. Since they are not changing\n // as a result of this upgrade, we will return their true values\n return (_creditBalances[_account], cpt);\n } else {\n return (\n _creditBalances[_account] / RESOLUTION_INCREASE,\n cpt / RESOLUTION_INCREASE\n );\n }\n }\n\n /**\n * @dev Gets the credits balance of the specified address.\n * @param _account The address to query the balance of.\n * @return (uint256, uint256, bool) Credit balance, credits per token of the\n * address, and isUpgraded\n */\n function creditsBalanceOfHighres(address _account)\n public\n view\n returns (\n uint256,\n uint256,\n bool\n )\n {\n return (\n _creditBalances[_account],\n _creditsPerToken(_account),\n isUpgraded[_account] == 1\n );\n }\n\n /**\n * @dev Transfer tokens to a specified address.\n * @param _to the address to transfer to.\n * @param _value the amount to be transferred.\n * @return true on success.\n */\n function transfer(address _to, uint256 _value)\n public\n override\n returns (bool)\n {\n require(_to != address(0), \"Transfer to zero address\");\n require(\n _value <= balanceOf(msg.sender),\n \"Transfer greater than balance\"\n );\n\n _executeTransfer(msg.sender, _to, _value);\n\n emit Transfer(msg.sender, _to, _value);\n\n return true;\n }\n\n /**\n * @dev Transfer tokens from one address to another.\n * @param _from The address you want to send tokens from.\n * @param _to The address you want to transfer to.\n * @param _value The amount of tokens to be transferred.\n */\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n ) public override returns (bool) {\n require(_to != address(0), \"Transfer to zero address\");\n require(_value <= balanceOf(_from), \"Transfer greater than balance\");\n\n _allowances[_from][msg.sender] = _allowances[_from][msg.sender].sub(\n _value\n );\n\n _executeTransfer(_from, _to, _value);\n\n emit Transfer(_from, _to, _value);\n\n return true;\n }\n\n /**\n * @dev Update the count of non rebasing credits in response to a transfer\n * @param _from The address you want to send tokens from.\n * @param _to The address you want to transfer to.\n * @param _value Amount of OUSD to transfer\n */\n function _executeTransfer(\n address _from,\n address _to,\n uint256 _value\n ) internal {\n bool isNonRebasingTo = _isNonRebasingAccount(_to);\n bool isNonRebasingFrom = _isNonRebasingAccount(_from);\n\n // Credits deducted and credited might be different due to the\n // differing creditsPerToken used by each account\n uint256 creditsCredited = _value.mulTruncate(_creditsPerToken(_to));\n uint256 creditsDeducted = _value.mulTruncate(_creditsPerToken(_from));\n\n _creditBalances[_from] = _creditBalances[_from].sub(\n creditsDeducted,\n \"Transfer amount exceeds balance\"\n );\n _creditBalances[_to] = _creditBalances[_to].add(creditsCredited);\n\n if (isNonRebasingTo && !isNonRebasingFrom) {\n // Transfer to non-rebasing account from rebasing account, credits\n // are removed from the non rebasing tally\n nonRebasingSupply = nonRebasingSupply.add(_value);\n // Update rebasingCredits by subtracting the deducted amount\n _rebasingCredits = _rebasingCredits.sub(creditsDeducted);\n } else if (!isNonRebasingTo && isNonRebasingFrom) {\n // Transfer to rebasing account from non-rebasing account\n // Decreasing non-rebasing credits by the amount that was sent\n nonRebasingSupply = nonRebasingSupply.sub(_value);\n // Update rebasingCredits by adding the credited amount\n _rebasingCredits = _rebasingCredits.add(creditsCredited);\n }\n }\n\n /**\n * @dev Function to check the amount of tokens that _owner has allowed to\n * `_spender`.\n * @param _owner The address which owns the funds.\n * @param _spender The address which will spend the funds.\n * @return The number of tokens still available for the _spender.\n */\n function allowance(address _owner, address _spender)\n public\n view\n override\n returns (uint256)\n {\n return _allowances[_owner][_spender];\n }\n\n /**\n * @dev Approve the passed address to spend the specified amount of tokens\n * on behalf of msg.sender. This method is included for ERC20\n * compatibility. `increaseAllowance` and `decreaseAllowance` should be\n * used instead.\n *\n * Changing an allowance with this method brings the risk that someone\n * may transfer both the old and the new allowance - if they are both\n * greater than zero - if a transfer transaction is mined before the\n * later approve() call is mined.\n * @param _spender The address which will spend the funds.\n * @param _value The amount of tokens to be spent.\n */\n function approve(address _spender, uint256 _value)\n public\n override\n returns (bool)\n {\n _allowances[msg.sender][_spender] = _value;\n emit Approval(msg.sender, _spender, _value);\n return true;\n }\n\n /**\n * @dev Increase the amount of tokens that an owner has allowed to\n * `_spender`.\n * This method should be used instead of approve() to avoid the double\n * approval vulnerability described above.\n * @param _spender The address which will spend the funds.\n * @param _addedValue The amount of tokens to increase the allowance by.\n */\n function increaseAllowance(address _spender, uint256 _addedValue)\n public\n returns (bool)\n {\n _allowances[msg.sender][_spender] = _allowances[msg.sender][_spender]\n .add(_addedValue);\n emit Approval(msg.sender, _spender, _allowances[msg.sender][_spender]);\n return true;\n }\n\n /**\n * @dev Decrease the amount of tokens that an owner has allowed to\n `_spender`.\n * @param _spender The address which will spend the funds.\n * @param _subtractedValue The amount of tokens to decrease the allowance\n * by.\n */\n function decreaseAllowance(address _spender, uint256 _subtractedValue)\n public\n returns (bool)\n {\n uint256 oldValue = _allowances[msg.sender][_spender];\n if (_subtractedValue >= oldValue) {\n _allowances[msg.sender][_spender] = 0;\n } else {\n _allowances[msg.sender][_spender] = oldValue.sub(_subtractedValue);\n }\n emit Approval(msg.sender, _spender, _allowances[msg.sender][_spender]);\n return true;\n }\n\n /**\n * @dev Mints new tokens, increasing totalSupply.\n */\n function mint(address _account, uint256 _amount) external onlyVault {\n _mint(_account, _amount);\n }\n\n /**\n * @dev Creates `_amount` tokens and assigns them to `_account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements\n *\n * - `to` cannot be the zero address.\n */\n function _mint(address _account, uint256 _amount) internal nonReentrant {\n require(_account != address(0), \"Mint to the zero address\");\n\n bool isNonRebasingAccount = _isNonRebasingAccount(_account);\n\n uint256 creditAmount = _amount.mulTruncate(_creditsPerToken(_account));\n _creditBalances[_account] = _creditBalances[_account].add(creditAmount);\n\n // If the account is non rebasing and doesn't have a set creditsPerToken\n // then set it i.e. this is a mint from a fresh contract\n if (isNonRebasingAccount) {\n nonRebasingSupply = nonRebasingSupply.add(_amount);\n } else {\n _rebasingCredits = _rebasingCredits.add(creditAmount);\n }\n\n _totalSupply = _totalSupply.add(_amount);\n\n require(_totalSupply < MAX_SUPPLY, \"Max supply\");\n\n emit Transfer(address(0), _account, _amount);\n }\n\n /**\n * @dev Burns tokens, decreasing totalSupply.\n */\n function burn(address account, uint256 amount) external onlyVault {\n _burn(account, amount);\n }\n\n /**\n * @dev Destroys `_amount` tokens from `_account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements\n *\n * - `_account` cannot be the zero address.\n * - `_account` must have at least `_amount` tokens.\n */\n function _burn(address _account, uint256 _amount) internal nonReentrant {\n require(_account != address(0), \"Burn from the zero address\");\n if (_amount == 0) {\n return;\n }\n\n bool isNonRebasingAccount = _isNonRebasingAccount(_account);\n uint256 creditAmount = _amount.mulTruncate(_creditsPerToken(_account));\n uint256 currentCredits = _creditBalances[_account];\n\n // Remove the credits, burning rounding errors\n if (\n currentCredits == creditAmount || currentCredits - 1 == creditAmount\n ) {\n // Handle dust from rounding\n _creditBalances[_account] = 0;\n } else if (currentCredits > creditAmount) {\n _creditBalances[_account] = _creditBalances[_account].sub(\n creditAmount\n );\n } else {\n revert(\"Remove exceeds balance\");\n }\n\n // Remove from the credit tallies and non-rebasing supply\n if (isNonRebasingAccount) {\n nonRebasingSupply = nonRebasingSupply.sub(_amount);\n } else {\n _rebasingCredits = _rebasingCredits.sub(creditAmount);\n }\n\n _totalSupply = _totalSupply.sub(_amount);\n\n emit Transfer(_account, address(0), _amount);\n }\n\n /**\n * @dev Get the credits per token for an account. Returns a fixed amount\n * if the account is non-rebasing.\n * @param _account Address of the account.\n */\n function _creditsPerToken(address _account)\n internal\n view\n returns (uint256)\n {\n if (nonRebasingCreditsPerToken[_account] != 0) {\n return nonRebasingCreditsPerToken[_account];\n } else {\n return _rebasingCreditsPerToken;\n }\n }\n\n /**\n * @dev Is an account using rebasing accounting or non-rebasing accounting?\n * Also, ensure contracts are non-rebasing if they have not opted in.\n * @param _account Address of the account.\n */\n function _isNonRebasingAccount(address _account) internal returns (bool) {\n bool isContract = Address.isContract(_account);\n if (isContract && rebaseState[_account] == RebaseOptions.NotSet) {\n _ensureRebasingMigration(_account);\n }\n return nonRebasingCreditsPerToken[_account] > 0;\n }\n\n /**\n * @dev Ensures internal account for rebasing and non-rebasing credits and\n * supply is updated following deployment of frozen yield change.\n */\n function _ensureRebasingMigration(address _account) internal {\n if (nonRebasingCreditsPerToken[_account] == 0) {\n emit AccountRebasingDisabled(_account);\n if (_creditBalances[_account] == 0) {\n // Since there is no existing balance, we can directly set to\n // high resolution, and do not have to do any other bookkeeping\n nonRebasingCreditsPerToken[_account] = 1e27;\n } else {\n // Migrate an existing account:\n\n // Set fixed credits per token for this account\n nonRebasingCreditsPerToken[_account] = _rebasingCreditsPerToken;\n // Update non rebasing supply\n nonRebasingSupply = nonRebasingSupply.add(balanceOf(_account));\n // Update credit tallies\n _rebasingCredits = _rebasingCredits.sub(\n _creditBalances[_account]\n );\n }\n }\n }\n\n /**\n * @notice Enable rebasing for an account.\n * @dev Add a contract address to the non-rebasing exception list. The\n * address's balance will be part of rebases and the account will be exposed\n * to upside and downside.\n * @param _account Address of the account.\n */\n function governanceRebaseOptIn(address _account)\n public\n nonReentrant\n onlyGovernor\n {\n _rebaseOptIn(_account);\n }\n\n /**\n * @dev Add a contract address to the non-rebasing exception list. The\n * address's balance will be part of rebases and the account will be exposed\n * to upside and downside.\n */\n function rebaseOptIn() public nonReentrant {\n _rebaseOptIn(msg.sender);\n }\n\n function _rebaseOptIn(address _account) internal {\n require(_isNonRebasingAccount(_account), \"Account has not opted out\");\n\n // Convert balance into the same amount at the current exchange rate\n uint256 newCreditBalance = _creditBalances[_account]\n .mul(_rebasingCreditsPerToken)\n .div(_creditsPerToken(_account));\n\n // Decreasing non rebasing supply\n nonRebasingSupply = nonRebasingSupply.sub(balanceOf(_account));\n\n _creditBalances[_account] = newCreditBalance;\n\n // Increase rebasing credits, totalSupply remains unchanged so no\n // adjustment necessary\n _rebasingCredits = _rebasingCredits.add(_creditBalances[_account]);\n\n rebaseState[_account] = RebaseOptions.OptIn;\n\n // Delete any fixed credits per token\n delete nonRebasingCreditsPerToken[_account];\n emit AccountRebasingEnabled(_account);\n }\n\n /**\n * @dev Explicitly mark that an address is non-rebasing.\n */\n function rebaseOptOut() public nonReentrant {\n require(!_isNonRebasingAccount(msg.sender), \"Account has not opted in\");\n\n // Increase non rebasing supply\n nonRebasingSupply = nonRebasingSupply.add(balanceOf(msg.sender));\n // Set fixed credits per token\n nonRebasingCreditsPerToken[msg.sender] = _rebasingCreditsPerToken;\n\n // Decrease rebasing credits, total supply remains unchanged so no\n // adjustment necessary\n _rebasingCredits = _rebasingCredits.sub(_creditBalances[msg.sender]);\n\n // Mark explicitly opted out of rebasing\n rebaseState[msg.sender] = RebaseOptions.OptOut;\n emit AccountRebasingDisabled(msg.sender);\n }\n\n /**\n * @dev Modify the supply without minting new tokens. This uses a change in\n * the exchange rate between \"credits\" and OUSD tokens to change balances.\n * @param _newTotalSupply New total supply of OUSD.\n */\n function changeSupply(uint256 _newTotalSupply)\n external\n onlyVault\n nonReentrant\n {\n require(_totalSupply > 0, \"Cannot increase 0 supply\");\n\n if (_totalSupply == _newTotalSupply) {\n emit TotalSupplyUpdatedHighres(\n _totalSupply,\n _rebasingCredits,\n _rebasingCreditsPerToken\n );\n return;\n }\n\n _totalSupply = _newTotalSupply > MAX_SUPPLY\n ? MAX_SUPPLY\n : _newTotalSupply;\n\n _rebasingCreditsPerToken = _rebasingCredits.divPrecisely(\n _totalSupply.sub(nonRebasingSupply)\n );\n\n require(_rebasingCreditsPerToken > 0, \"Invalid change in supply\");\n\n _totalSupply = _rebasingCredits\n .divPrecisely(_rebasingCreditsPerToken)\n .add(nonRebasingSupply);\n\n emit TotalSupplyUpdatedHighres(\n _totalSupply,\n _rebasingCredits,\n _rebasingCreditsPerToken\n );\n }\n}\n" }, "contracts/utils/Helpers.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IBasicToken } from \"../interfaces/IBasicToken.sol\";\n\nlibrary Helpers {\n /**\n * @notice Fetch the `symbol()` from an ERC20 token\n * @dev Grabs the `symbol()` from a contract\n * @param _token Address of the ERC20 token\n * @return string Symbol of the ERC20 token\n */\n function getSymbol(address _token) internal view returns (string memory) {\n string memory symbol = IBasicToken(_token).symbol();\n return symbol;\n }\n\n /**\n * @notice Fetch the `decimals()` from an ERC20 token\n * @dev Grabs the `decimals()` from a contract and fails if\n * the decimal value does not live within a certain range\n * @param _token Address of the ERC20 token\n * @return uint256 Decimals of the ERC20 token\n */\n function getDecimals(address _token) internal view returns (uint256) {\n uint256 decimals = IBasicToken(_token).decimals();\n require(\n decimals >= 4 && decimals <= 18,\n \"Token must have sufficient decimal places\"\n );\n\n return decimals;\n }\n}\n" }, "contracts/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Base contract any contracts that need to initialize state after deployment.\n * @author Origin Protocol Inc\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(\n initializing || !initialized,\n \"Initializable: contract is already initialized\"\n );\n\n bool isTopLevelCall = !initializing;\n if (isTopLevelCall) {\n initializing = true;\n initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n initializing = false;\n }\n }\n\n uint256[50] private ______gap;\n}\n" }, "contracts/utils/InitializableAbstractStrategy.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title Base contract for vault strategies.\n * @author Origin Protocol Inc\n */\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport { Initializable } from \"../utils/Initializable.sol\";\nimport { Governable } from \"../governance/Governable.sol\";\nimport { IVault } from \"../interfaces/IVault.sol\";\n\nabstract contract InitializableAbstractStrategy is Initializable, Governable {\n using SafeERC20 for IERC20;\n\n event PTokenAdded(address indexed _asset, address _pToken);\n event PTokenRemoved(address indexed _asset, address _pToken);\n event Deposit(address indexed _asset, address _pToken, uint256 _amount);\n event Withdrawal(address indexed _asset, address _pToken, uint256 _amount);\n event RewardTokenCollected(\n address recipient,\n address rewardToken,\n uint256 amount\n );\n event RewardTokenAddressesUpdated(\n address[] _oldAddresses,\n address[] _newAddresses\n );\n event HarvesterAddressesUpdated(\n address _oldHarvesterAddress,\n address _newHarvesterAddress\n );\n\n /// @notice Address of the underlying platform\n address public immutable platformAddress;\n /// @notice Address of the OToken vault\n address public immutable vaultAddress;\n\n /// @dev Replaced with an immutable variable\n // slither-disable-next-line constable-states\n address private _deprecated_platformAddress;\n\n /// @dev Replaced with an immutable\n // slither-disable-next-line constable-states\n address private _deprecated_vaultAddress;\n\n /// @notice asset => pToken (Platform Specific Token Address)\n mapping(address => address) public assetToPToken;\n\n /// @notice Full list of all assets supported by the strategy\n address[] internal assetsMapped;\n\n // Deprecated: Reward token address\n // slither-disable-next-line constable-states\n address private _deprecated_rewardTokenAddress;\n\n // Deprecated: now resides in Harvester's rewardTokenConfigs\n // slither-disable-next-line constable-states\n uint256 private _deprecated_rewardLiquidationThreshold;\n\n /// @notice Address of the Harvester contract allowed to collect reward tokens\n address public harvesterAddress;\n\n /// @notice Address of the reward tokens. eg CRV, BAL, CVX, AURA\n address[] public rewardTokenAddresses;\n\n /* Reserved for future expansion. Used to be 100 storage slots\n * and has decreased to accommodate:\n * - harvesterAddress\n * - rewardTokenAddresses\n */\n int256[98] private _reserved;\n\n struct BaseStrategyConfig {\n address platformAddress; // Address of the underlying platform\n address vaultAddress; // Address of the OToken's Vault\n }\n\n /**\n * @param _config The platform and OToken vault addresses\n */\n constructor(BaseStrategyConfig memory _config) {\n platformAddress = _config.platformAddress;\n vaultAddress = _config.vaultAddress;\n }\n\n /**\n * @dev Internal initialize function, to set up initial internal state\n * @param _rewardTokenAddresses Address of reward token for platform\n * @param _assets Addresses of initial supported assets\n * @param _pTokens Platform Token corresponding addresses\n */\n function _initialize(\n address[] memory _rewardTokenAddresses,\n address[] memory _assets,\n address[] memory _pTokens\n ) internal {\n rewardTokenAddresses = _rewardTokenAddresses;\n\n uint256 assetCount = _assets.length;\n require(assetCount == _pTokens.length, \"Invalid input arrays\");\n for (uint256 i = 0; i < assetCount; ++i) {\n _setPTokenAddress(_assets[i], _pTokens[i]);\n }\n }\n\n /**\n * @notice Collect accumulated reward token and send to Vault.\n */\n function collectRewardTokens() external virtual onlyHarvester nonReentrant {\n _collectRewardTokens();\n }\n\n /**\n * @dev Default implementation that transfers reward tokens to the Harvester\n * Implementing strategies need to add custom logic to collect the rewards.\n */\n function _collectRewardTokens() internal virtual {\n uint256 rewardTokenCount = rewardTokenAddresses.length;\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\n IERC20 rewardToken = IERC20(rewardTokenAddresses[i]);\n uint256 balance = rewardToken.balanceOf(address(this));\n if (balance > 0) {\n emit RewardTokenCollected(\n harvesterAddress,\n address(rewardToken),\n balance\n );\n rewardToken.safeTransfer(harvesterAddress, balance);\n }\n }\n }\n\n /**\n * @dev Verifies that the caller is the Vault.\n */\n modifier onlyVault() {\n require(msg.sender == vaultAddress, \"Caller is not the Vault\");\n _;\n }\n\n /**\n * @dev Verifies that the caller is the Harvester.\n */\n modifier onlyHarvester() {\n require(msg.sender == harvesterAddress, \"Caller is not the Harvester\");\n _;\n }\n\n /**\n * @dev Verifies that the caller is the Vault or Governor.\n */\n modifier onlyVaultOrGovernor() {\n require(\n msg.sender == vaultAddress || msg.sender == governor(),\n \"Caller is not the Vault or Governor\"\n );\n _;\n }\n\n /**\n * @dev Verifies that the caller is the Vault, Governor, or Strategist.\n */\n modifier onlyVaultOrGovernorOrStrategist() {\n require(\n msg.sender == vaultAddress ||\n msg.sender == governor() ||\n msg.sender == IVault(vaultAddress).strategistAddr(),\n \"Caller is not the Vault, Governor, or Strategist\"\n );\n _;\n }\n\n /**\n * @notice Set the reward token addresses. Any old addresses will be overwritten.\n * @param _rewardTokenAddresses Array of reward token addresses\n */\n function setRewardTokenAddresses(address[] calldata _rewardTokenAddresses)\n external\n onlyGovernor\n {\n uint256 rewardTokenCount = _rewardTokenAddresses.length;\n for (uint256 i = 0; i < rewardTokenCount; ++i) {\n require(\n _rewardTokenAddresses[i] != address(0),\n \"Can not set an empty address as a reward token\"\n );\n }\n\n emit RewardTokenAddressesUpdated(\n rewardTokenAddresses,\n _rewardTokenAddresses\n );\n rewardTokenAddresses = _rewardTokenAddresses;\n }\n\n /**\n * @notice Get the reward token addresses.\n * @return address[] the reward token addresses.\n */\n function getRewardTokenAddresses()\n external\n view\n returns (address[] memory)\n {\n return rewardTokenAddresses;\n }\n\n /**\n * @notice Provide support for asset by passing its pToken address.\n * This method can only be called by the system Governor\n * @param _asset Address for the asset\n * @param _pToken Address for the corresponding platform token\n */\n function setPTokenAddress(address _asset, address _pToken)\n external\n virtual\n onlyGovernor\n {\n _setPTokenAddress(_asset, _pToken);\n }\n\n /**\n * @notice Remove a supported asset by passing its index.\n * This method can only be called by the system Governor\n * @param _assetIndex Index of the asset to be removed\n */\n function removePToken(uint256 _assetIndex) external virtual onlyGovernor {\n require(_assetIndex < assetsMapped.length, \"Invalid index\");\n address asset = assetsMapped[_assetIndex];\n address pToken = assetToPToken[asset];\n\n if (_assetIndex < assetsMapped.length - 1) {\n assetsMapped[_assetIndex] = assetsMapped[assetsMapped.length - 1];\n }\n assetsMapped.pop();\n assetToPToken[asset] = address(0);\n\n emit PTokenRemoved(asset, pToken);\n }\n\n /**\n * @notice Provide support for asset by passing its pToken address.\n * Add to internal mappings and execute the platform specific,\n * abstract method `_abstractSetPToken`\n * @param _asset Address for the asset\n * @param _pToken Address for the corresponding platform token\n */\n function _setPTokenAddress(address _asset, address _pToken) internal {\n require(assetToPToken[_asset] == address(0), \"pToken already set\");\n require(\n _asset != address(0) && _pToken != address(0),\n \"Invalid addresses\"\n );\n\n assetToPToken[_asset] = _pToken;\n assetsMapped.push(_asset);\n\n emit PTokenAdded(_asset, _pToken);\n\n _abstractSetPToken(_asset, _pToken);\n }\n\n /**\n * @notice Transfer token to governor. Intended for recovering tokens stuck in\n * strategy contracts, i.e. mistaken sends.\n * @param _asset Address for the asset\n * @param _amount Amount of the asset to transfer\n */\n function transferToken(address _asset, uint256 _amount)\n public\n onlyGovernor\n {\n require(!supportsAsset(_asset), \"Cannot transfer supported asset\");\n IERC20(_asset).safeTransfer(governor(), _amount);\n }\n\n /**\n * @notice Set the Harvester contract that can collect rewards.\n * @param _harvesterAddress Address of the harvester contract.\n */\n function setHarvesterAddress(address _harvesterAddress)\n external\n onlyGovernor\n {\n emit HarvesterAddressesUpdated(harvesterAddress, _harvesterAddress);\n harvesterAddress = _harvesterAddress;\n }\n\n /***************************************\n Abstract\n ****************************************/\n\n function _abstractSetPToken(address _asset, address _pToken)\n internal\n virtual;\n\n function safeApproveAllTokens() external virtual;\n\n /**\n * @notice Deposit an amount of assets into the platform\n * @param _asset Address for the asset\n * @param _amount Units of asset to deposit\n */\n function deposit(address _asset, uint256 _amount) external virtual;\n\n /**\n * @notice Deposit all supported assets in this strategy contract to the platform\n */\n function depositAll() external virtual;\n\n /**\n * @notice Withdraw an `amount` of assets from the platform and\n * send to the `_recipient`.\n * @param _recipient Address to which the asset should be sent\n * @param _asset Address of the asset\n * @param _amount Units of asset to withdraw\n */\n function withdraw(\n address _recipient,\n address _asset,\n uint256 _amount\n ) external virtual;\n\n /**\n * @notice Withdraw all supported assets from platform and\n * sends to the OToken's Vault.\n */\n function withdrawAll() external virtual;\n\n /**\n * @notice Get the total asset value held in the platform.\n * This includes any interest that was generated since depositing.\n * @param _asset Address of the asset\n * @return balance Total value of the asset in the platform\n */\n function checkBalance(address _asset)\n external\n view\n virtual\n returns (uint256 balance);\n\n /**\n * @notice Check if an asset is supported.\n * @param _asset Address of the asset\n * @return bool Whether asset is supported\n */\n function supportsAsset(address _asset) public view virtual returns (bool);\n}\n" }, "contracts/utils/InitializableERC20Detailed.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @dev Optional functions from the ERC20 standard.\n * Converted from openzeppelin/contracts/token/ERC20/ERC20Detailed.sol\n * @author Origin Protocol Inc\n */\nabstract contract InitializableERC20Detailed is IERC20 {\n // Storage gap to skip storage from prior to OUSD reset\n uint256[100] private _____gap;\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n\n /**\n * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of\n * these values are immutable: they can only be set once during\n * construction.\n * @notice To avoid variable shadowing appended `Arg` after arguments name.\n */\n function _initialize(\n string memory nameArg,\n string memory symbolArg,\n uint8 decimalsArg\n ) internal {\n _name = nameArg;\n _symbol = symbolArg;\n _decimals = decimalsArg;\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() public view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n}\n" }, "contracts/utils/StableMath.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { SafeMath } from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\n\n// Based on StableMath from Stability Labs Pty. Ltd.\n// https://github.com/mstable/mStable-contracts/blob/master/contracts/shared/StableMath.sol\n\nlibrary StableMath {\n using SafeMath for uint256;\n\n /**\n * @dev Scaling unit for use in specific calculations,\n * where 1 * 10**18, or 1e18 represents a unit '1'\n */\n uint256 private constant FULL_SCALE = 1e18;\n\n /***************************************\n Helpers\n ****************************************/\n\n /**\n * @dev Adjust the scale of an integer\n * @param to Decimals to scale to\n * @param from Decimals to scale from\n */\n function scaleBy(\n uint256 x,\n uint256 to,\n uint256 from\n ) internal pure returns (uint256) {\n if (to > from) {\n x = x.mul(10**(to - from));\n } else if (to < from) {\n // slither-disable-next-line divide-before-multiply\n x = x.div(10**(from - to));\n }\n return x;\n }\n\n /***************************************\n Precise Arithmetic\n ****************************************/\n\n /**\n * @dev Multiplies two precise units, and then truncates by the full scale\n * @param x Left hand input to multiplication\n * @param y Right hand input to multiplication\n * @return Result after multiplying the two inputs and then dividing by the shared\n * scale unit\n */\n function mulTruncate(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulTruncateScale(x, y, FULL_SCALE);\n }\n\n /**\n * @dev Multiplies two precise units, and then truncates by the given scale. For example,\n * when calculating 90% of 10e18, (10e18 * 9e17) / 1e18 = (9e36) / 1e18 = 9e18\n * @param x Left hand input to multiplication\n * @param y Right hand input to multiplication\n * @param scale Scale unit\n * @return Result after multiplying the two inputs and then dividing by the shared\n * scale unit\n */\n function mulTruncateScale(\n uint256 x,\n uint256 y,\n uint256 scale\n ) internal pure returns (uint256) {\n // e.g. assume scale = fullScale\n // z = 10e18 * 9e17 = 9e36\n uint256 z = x.mul(y);\n // return 9e36 / 1e18 = 9e18\n return z.div(scale);\n }\n\n /**\n * @dev Multiplies two precise units, and then truncates by the full scale, rounding up the result\n * @param x Left hand input to multiplication\n * @param y Right hand input to multiplication\n * @return Result after multiplying the two inputs and then dividing by the shared\n * scale unit, rounded up to the closest base unit.\n */\n function mulTruncateCeil(uint256 x, uint256 y)\n internal\n pure\n returns (uint256)\n {\n // e.g. 8e17 * 17268172638 = 138145381104e17\n uint256 scaled = x.mul(y);\n // e.g. 138145381104e17 + 9.99...e17 = 138145381113.99...e17\n uint256 ceil = scaled.add(FULL_SCALE.sub(1));\n // e.g. 13814538111.399...e18 / 1e18 = 13814538111\n return ceil.div(FULL_SCALE);\n }\n\n /**\n * @dev Precisely divides two units, by first scaling the left hand operand. Useful\n * for finding percentage weightings, i.e. 8e18/10e18 = 80% (or 8e17)\n * @param x Left hand input to division\n * @param y Right hand input to division\n * @return Result after multiplying the left operand by the scale, and\n * executing the division on the right hand input.\n */\n function divPrecisely(uint256 x, uint256 y)\n internal\n pure\n returns (uint256)\n {\n // e.g. 8e18 * 1e18 = 8e36\n uint256 z = x.mul(FULL_SCALE);\n // e.g. 8e36 / 10e18 = 8e17\n return z.div(y);\n }\n}\n" }, "contracts/vault/VaultStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title OToken VaultStorage contract\n * @notice The VaultStorage contract defines the storage for the Vault contracts\n * @author Origin Protocol Inc\n */\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport { IStrategy } from \"../interfaces/IStrategy.sol\";\nimport { Governable } from \"../governance/Governable.sol\";\nimport { OUSD } from \"../token/OUSD.sol\";\nimport { Initializable } from \"../utils/Initializable.sol\";\nimport \"../utils/Helpers.sol\";\n\ncontract VaultStorage is Initializable, Governable {\n using SafeERC20 for IERC20;\n\n event AssetSupported(address _asset);\n event AssetRemoved(address _asset);\n event AssetDefaultStrategyUpdated(address _asset, address _strategy);\n event AssetAllocated(address _asset, address _strategy, uint256 _amount);\n event StrategyApproved(address _addr);\n event StrategyRemoved(address _addr);\n event Mint(address _addr, uint256 _value);\n event Redeem(address _addr, uint256 _value);\n event CapitalPaused();\n event CapitalUnpaused();\n event RebasePaused();\n event RebaseUnpaused();\n event VaultBufferUpdated(uint256 _vaultBuffer);\n event OusdMetaStrategyUpdated(address _ousdMetaStrategy);\n event RedeemFeeUpdated(uint256 _redeemFeeBps);\n event PriceProviderUpdated(address _priceProvider);\n event AllocateThresholdUpdated(uint256 _threshold);\n event RebaseThresholdUpdated(uint256 _threshold);\n event StrategistUpdated(address _address);\n event MaxSupplyDiffChanged(uint256 maxSupplyDiff);\n event YieldDistribution(address _to, uint256 _yield, uint256 _fee);\n event TrusteeFeeBpsChanged(uint256 _basis);\n event TrusteeAddressChanged(address _address);\n event NetOusdMintForStrategyThresholdChanged(uint256 _threshold);\n event SwapperChanged(address _address);\n event SwapAllowedUndervalueChanged(uint256 _basis);\n event SwapSlippageChanged(address _asset, uint256 _basis);\n event Swapped(\n address indexed _fromAsset,\n address indexed _toAsset,\n uint256 _fromAssetAmount,\n uint256 _toAssetAmount\n );\n\n // Assets supported by the Vault, i.e. Stablecoins\n enum UnitConversion {\n DECIMALS,\n GETEXCHANGERATE\n }\n // Changed to fit into a single storage slot so the decimals needs to be recached\n struct Asset {\n // Note: OETHVaultCore doesn't use `isSupported` when minting,\n // redeeming or checking balance of assets.\n bool isSupported;\n UnitConversion unitConversion;\n uint8 decimals;\n // Max allowed slippage from the Oracle price when swapping collateral assets in basis points.\n // For example 40 == 0.4% slippage\n uint16 allowedOracleSlippageBps;\n }\n\n /// @dev mapping of supported vault assets to their configuration\n // slither-disable-next-line uninitialized-state\n mapping(address => Asset) internal assets;\n /// @dev list of all assets supported by the vault.\n // slither-disable-next-line uninitialized-state\n address[] internal allAssets;\n\n // Strategies approved for use by the Vault\n struct Strategy {\n bool isSupported;\n uint256 _deprecated; // Deprecated storage slot\n }\n /// @dev mapping of strategy contracts to their configiration\n mapping(address => Strategy) internal strategies;\n /// @dev list of all vault strategies\n address[] internal allStrategies;\n\n /// @notice Address of the Oracle price provider contract\n // slither-disable-next-line uninitialized-state\n address public priceProvider;\n /// @notice pause rebasing if true\n bool public rebasePaused = false;\n /// @notice pause operations that change the OToken supply.\n /// eg mint, redeem, allocate, mint/burn for strategy\n bool public capitalPaused = true;\n /// @notice Redemption fee in basis points. eg 50 = 0.5%\n uint256 public redeemFeeBps;\n /// @notice Percentage of assets to keep in Vault to handle (most) withdrawals. 100% = 1e18.\n uint256 public vaultBuffer;\n /// @notice OToken mints over this amount automatically allocate funds. 18 decimals.\n uint256 public autoAllocateThreshold;\n /// @notice OToken mints over this amount automatically rebase. 18 decimals.\n uint256 public rebaseThreshold;\n\n /// @dev Address of the OToken token. eg OUSD or OETH.\n // slither-disable-next-line uninitialized-state\n OUSD internal oUSD;\n\n //keccak256(\"OUSD.vault.governor.admin.impl\");\n bytes32 constant adminImplPosition =\n 0xa2bd3d3cf188a41358c8b401076eb59066b09dec5775650c0de4c55187d17bd9;\n\n // Address of the contract responsible for post rebase syncs with AMMs\n address private _deprecated_rebaseHooksAddr = address(0);\n\n // Deprecated: Address of Uniswap\n // slither-disable-next-line constable-states\n address private _deprecated_uniswapAddr = address(0);\n\n /// @notice Address of the Strategist\n address public strategistAddr = address(0);\n\n /// @notice Mapping of asset address to the Strategy that they should automatically\n // be allocated to\n // slither-disable-next-line uninitialized-state\n mapping(address => address) public assetDefaultStrategies;\n\n /// @notice Max difference between total supply and total value of assets. 18 decimals.\n // slither-disable-next-line uninitialized-state\n uint256 public maxSupplyDiff;\n\n /// @notice Trustee contract that can collect a percentage of yield\n address public trusteeAddress;\n\n /// @notice Amount of yield collected in basis points. eg 2000 = 20%\n uint256 public trusteeFeeBps;\n\n /// @dev Deprecated: Tokens that should be swapped for stablecoins\n address[] private _deprecated_swapTokens;\n\n uint256 constant MINT_MINIMUM_UNIT_PRICE = 0.998e18;\n\n /// @notice Metapool strategy that is allowed to mint/burn OTokens without changing collateral\n address public ousdMetaStrategy = address(0);\n\n /// @notice How much OTokens are currently minted by the strategy\n int256 public netOusdMintedForStrategy = 0;\n\n /// @notice How much net total OTokens are allowed to be minted by all strategies\n uint256 public netOusdMintForStrategyThreshold = 0;\n\n uint256 constant MIN_UNIT_PRICE_DRIFT = 0.7e18;\n uint256 constant MAX_UNIT_PRICE_DRIFT = 1.3e18;\n\n /// @notice Collateral swap configuration.\n /// @dev is packed into a single storage slot to save gas.\n struct SwapConfig {\n // Contract that swaps the vault's collateral assets\n address swapper;\n // Max allowed percentage the total value can drop below the total supply in basis points.\n // For example 100 == 1%\n uint16 allowedUndervalueBps;\n }\n SwapConfig internal swapConfig = SwapConfig(address(0), 0);\n\n // For future use\n uint256[50] private __gap;\n\n /**\n * @notice set the implementation for the admin, this needs to be in a base class else we cannot set it\n * @param newImpl address of the implementation\n */\n function setAdminImpl(address newImpl) external onlyGovernor {\n require(\n Address.isContract(newImpl),\n \"new implementation is not a contract\"\n );\n bytes32 position = adminImplPosition;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(position, newImpl)\n }\n }\n}\n" } } }}
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
e03153a2406bc7470c829fc14f3e6dde70d409f5
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
413c72361d5ec3d1b0c40e45c5c6754b3e85f497
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
6f0571161b05bfba718609ea78d7b8fef877adf3
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
1b4c7d0015965cb8dab96c5198cef4cc55216e4e
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
cb8ad23bf8e5f788d8650a59338f4a2fec913c73
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
025e9ce7bfeb14b3cc42a8038bd4a2b24e5005b0
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
326f3cb0a66268fd7cbddf90fb9fd97617f02453
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
4beb82667a10c3cd2b5545df98f702b53f38970e
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
c03328a157468c8f9be64f0196a83f8aeb535dc4
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
1fa9d2d3816d5628f84c8fa20e4418fc42e1b9d8
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
f493edc808ea724c4e268183e3681a113034c717
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
7e9cd41092db2547712bbe25d8bb383e1b063d81
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
34c2327be203528fd247e77d06213fc161b0165c
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
f7f0212142e75da47af8828185d9a1def3b7e359
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
e6a5e1fc4bba0e7eaff23704c4fe6ac7d84b7d36
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
937fffa10599c12e0180f4e6e456f951c932f631
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
ce9cafb4e81217f358be7d90a63a588f7645c603
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
4e063deb70a09d2311ec09b0614db229f76bd987
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
bf43773ee3ff70b52979322a044ffad48c706c47
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
997beda9bf6b699af4a6405147dfe077fbb7d4ec
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
824e5e1393c5362df26be44980c64c117be5aeac
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
d380d05f5ca5aed485ba63b4c3850a8ff91e6b53
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
8148d42d27d9a9a8d975014047277ab640ee4088
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
da545aae1807a79af420fe60aeefe123c8389daa
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
2ce05578f7c611bc789364e194da5421cfaf0d41
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,333
c493c612244669c9092fe71fb078d388a1e89de8ba1abac622264717a30407fb
cf6b5701c7e1b68381d21c4060a5e1b0689ff4cf5befbea35d522477b6a322e9
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
1980d1c8e92906c5f75a962139f272f0e9417a52
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,335
04d1890876ad36b9e281d0bd8ac39aa268846d22e3d6f975493deecf0c617e58
8f0a5003f7445b81093273880ec1fac619c7d76199edec5fbd5e418df4418bcb
613ead35f3cba266bc6916c6209b588586c9bf26
c22834581ebc8527d974f8a1c97e1bea4ef910bc
fa0a0997ad7054b98a32a4c9d6c749f722a6c483
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000fb1bffc9d739b8d520daf37df666da4c687191ea
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
cb0cd57cdd7cfd9832c527c8b7a5b4f76930ddc00e5e746f2bdbb88edec16c17
d23b8d945b4e315374d3672dacc58e0a2fdad047
d23b8d945b4e315374d3672dacc58e0a2fdad047
1010e94da4ab0fbe6782bbdce02a238a86f5e93f
60806040523480156200001157600080fd5b50604051806040016040528060098152602001684272657474204c656560b81b81525060405180604001604052806004815260200163424c454560e01b8152508160039081620000629190620002fd565b506004620000718282620002fd565b505050600062000086620001b060201b60201c565b600580546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35069d3c21bcecceda1000000612710620000ef826001620003c9565b620000fb9190620003f5565b6006556001600a6000620001176005546001600160a01b031690565b6001600160a01b0316815260208082019290925260409081016000908120805494151560ff19958616179055308152600a909252812080548316600190811790915561dead9091527f20677881080440a9b3c87e826370bb5d9c2f74efd4dede686d52d77a6a09f8bb8054909216179055600780546001600160a01b03191633908117909155620001a99082620001b4565b5062000418565b3390565b6001600160a01b0382166200020f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b6040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200028457607f821691505b602082108103620002a557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200025457600081815260208120601f850160051c81016020861015620002d45750805b601f850160051c820191505b81811015620002f557828155600101620002e0565b505050505050565b81516001600160401b0381111562000319576200031962000259565b62000331816200032a84546200026f565b84620002ab565b602080601f831160018114620003695760008415620003505750858301515b600019600386901b1c1916600185901b178555620002f5565b600085815260208120601f198616915b828110156200039a5788860151825594840194600190910190840162000379565b5085821015620003b95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082028115828204841417620003ef57634e487b7160e01b600052601160045260246000fd5b92915050565b6000826200041357634e487b7160e01b600052601260045260246000fd5b500490565b610b4680620004286000396000f3fe6080604052600436106100ec5760003560e01c80638da5cb5b1161008a578063b62496f511610059578063b62496f51461026e578063dd62ed3e1461029e578063e2f45605146102e4578063f2fde38b146102fa57600080fd5b80638da5cb5b146101fb57806395d89b411461022357806399c8d55614610238578063a9059cbb1461024e57600080fd5b806323b872dd116100c657806323b872dd14610172578063313ce5671461019257806370a08231146101ae578063715018a6146101e457600080fd5b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461015357600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5061010d61031a565b60405161011a9190610929565b60405180910390f35b34801561012f57600080fd5b5061014361013e366004610993565b6103ac565b604051901515815260200161011a565b34801561015f57600080fd5b506002545b60405190815260200161011a565b34801561017e57600080fd5b5061014361018d3660046109bd565b6103c2565b34801561019e57600080fd5b506040516012815260200161011a565b3480156101ba57600080fd5b506101646101c93660046109f9565b6001600160a01b031660009081526020819052604090205490565b3480156101f057600080fd5b506101f96103d9565b005b34801561020757600080fd5b506005546040516001600160a01b03909116815260200161011a565b34801561022f57600080fd5b5061010d610482565b34801561024457600080fd5b5061016460095481565b34801561025a57600080fd5b50610143610269366004610993565b610491565b34801561027a57600080fd5b506101436102893660046109f9565b600b6020526000908152604090205460ff1681565b3480156102aa57600080fd5b506101646102b9366004610a1b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156102f057600080fd5b5061016460065481565b34801561030657600080fd5b506101f96103153660046109f9565b61049e565b60606003805461032990610a4e565b80601f016020809104026020016040519081016040528092919081815260200182805461035590610a4e565b80156103a25780601f10610377576101008083540402835291602001916103a2565b820191906000526020600020905b81548152906001019060200180831161038557829003601f168201915b5050505050905090565b60006103b93384846105b9565b50600192915050565b60006103cf8484846106de565b5060019392505050565b6005546001600160a01b031633146104385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b60606004805461032990610a4e565b60006103b93384846106de565b6005546001600160a01b031633146104f85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161042f565b6001600160a01b03811661055d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161042f565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661061b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042f565b6001600160a01b03821661067c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042f565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166107045760405162461bcd60e51b815260040161042f90610a88565b6001600160a01b03821661072a5760405162461bcd60e51b815260040161042f90610acd565b806000036107435761073e83836000610898565b505050565b30600090815260208190526040902054600654811080159081906107715750600554600160a01b900460ff16155b801561079657506001600160a01b0385166000908152600b602052604090205460ff16155b80156107bb57506001600160a01b0385166000908152600a602052604090205460ff16155b80156107e057506001600160a01b0384166000908152600a602052604090205460ff16155b156107f3576005805460ff60a01b191690555b600554600954600160a01b90910460ff16159015610853576001600160a01b0386166000908152600a602052604090205460ff168061084a57506001600160a01b0385166000908152600a602052604090205460ff165b15610853575060005b60085415801561087b57506001600160a01b0385166000908152600b602052604090205460ff165b1561088557426008555b610890868686610898565b505050505050565b6001600160a01b0383166108be5760405162461bcd60e51b815260040161042f90610a88565b6001600160a01b0382166108e45760405162461bcd60e51b815260040161042f90610acd565b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516106d191815260200190565b600060208083528351808285015260005b818110156109565785810183015185820160400152820161093a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461098e57600080fd5b919050565b600080604083850312156109a657600080fd5b6109af83610977565b946020939093013593505050565b6000806000606084860312156109d257600080fd5b6109db84610977565b92506109e960208501610977565b9150604084013590509250925092565b600060208284031215610a0b57600080fd5b610a1482610977565b9392505050565b60008060408385031215610a2e57600080fd5b610a3783610977565b9150610a4560208401610977565b90509250929050565b600181811c90821680610a6257607f821691505b602082108103610a8257634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b60608201526080019056fea26469706673582212202ffd75f3c8d318491c0211b1c05a869728055103820ee402a09519744cbbc84a64736f6c63430008130033
6080604052600436106100ec5760003560e01c80638da5cb5b1161008a578063b62496f511610059578063b62496f51461026e578063dd62ed3e1461029e578063e2f45605146102e4578063f2fde38b146102fa57600080fd5b80638da5cb5b146101fb57806395d89b411461022357806399c8d55614610238578063a9059cbb1461024e57600080fd5b806323b872dd116100c657806323b872dd14610172578063313ce5671461019257806370a08231146101ae578063715018a6146101e457600080fd5b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461015357600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5061010d61031a565b60405161011a9190610929565b60405180910390f35b34801561012f57600080fd5b5061014361013e366004610993565b6103ac565b604051901515815260200161011a565b34801561015f57600080fd5b506002545b60405190815260200161011a565b34801561017e57600080fd5b5061014361018d3660046109bd565b6103c2565b34801561019e57600080fd5b506040516012815260200161011a565b3480156101ba57600080fd5b506101646101c93660046109f9565b6001600160a01b031660009081526020819052604090205490565b3480156101f057600080fd5b506101f96103d9565b005b34801561020757600080fd5b506005546040516001600160a01b03909116815260200161011a565b34801561022f57600080fd5b5061010d610482565b34801561024457600080fd5b5061016460095481565b34801561025a57600080fd5b50610143610269366004610993565b610491565b34801561027a57600080fd5b506101436102893660046109f9565b600b6020526000908152604090205460ff1681565b3480156102aa57600080fd5b506101646102b9366004610a1b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156102f057600080fd5b5061016460065481565b34801561030657600080fd5b506101f96103153660046109f9565b61049e565b60606003805461032990610a4e565b80601f016020809104026020016040519081016040528092919081815260200182805461035590610a4e565b80156103a25780601f10610377576101008083540402835291602001916103a2565b820191906000526020600020905b81548152906001019060200180831161038557829003601f168201915b5050505050905090565b60006103b93384846105b9565b50600192915050565b60006103cf8484846106de565b5060019392505050565b6005546001600160a01b031633146104385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b60606004805461032990610a4e565b60006103b93384846106de565b6005546001600160a01b031633146104f85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161042f565b6001600160a01b03811661055d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161042f565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661061b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042f565b6001600160a01b03821661067c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042f565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166107045760405162461bcd60e51b815260040161042f90610a88565b6001600160a01b03821661072a5760405162461bcd60e51b815260040161042f90610acd565b806000036107435761073e83836000610898565b505050565b30600090815260208190526040902054600654811080159081906107715750600554600160a01b900460ff16155b801561079657506001600160a01b0385166000908152600b602052604090205460ff16155b80156107bb57506001600160a01b0385166000908152600a602052604090205460ff16155b80156107e057506001600160a01b0384166000908152600a602052604090205460ff16155b156107f3576005805460ff60a01b191690555b600554600954600160a01b90910460ff16159015610853576001600160a01b0386166000908152600a602052604090205460ff168061084a57506001600160a01b0385166000908152600a602052604090205460ff165b15610853575060005b60085415801561087b57506001600160a01b0385166000908152600b602052604090205460ff165b1561088557426008555b610890868686610898565b505050505050565b6001600160a01b0383166108be5760405162461bcd60e51b815260040161042f90610a88565b6001600160a01b0382166108e45760405162461bcd60e51b815260040161042f90610acd565b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516106d191815260200190565b600060208083528351808285015260005b818110156109565785810183015185820160400152820161093a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461098e57600080fd5b919050565b600080604083850312156109a657600080fd5b6109af83610977565b946020939093013593505050565b6000806000606084860312156109d257600080fd5b6109db84610977565b92506109e960208501610977565b9150604084013590509250925092565b600060208284031215610a0b57600080fd5b610a1482610977565b9392505050565b60008060408385031215610a2e57600080fd5b610a3783610977565b9150610a4560208401610977565b90509250929050565b600181811c90821680610a6257607f821691505b602082108103610a8257634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b60608201526080019056fea26469706673582212202ffd75f3c8d318491c0211b1c05a869728055103820ee402a09519744cbbc84a64736f6c63430008130033
/** https://brettlee.tech/ https://t.me/brettleeportal https://x.com/BrettLeeOnEth */ // SPDX-License-Identifier: NONE pragma solidity 0.8.19; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; return msg.data; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 18; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); return true; } function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); emit Transfer(account, address(0), amount); } function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; } function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing MIN_INT256 by -1 require(b != -1 || a != MIN_INT256); // Solidity already throws when dividing by 0. return a / b; } /** * @dev Subtracts two int256 variables and fails on overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; } /** * @dev Adds two int256 variables and fails on overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a)); return c; } /** * @dev Converts to absolute value, and fails on overflow. */ function abs(int256 a) internal pure returns (int256) { require(a != MIN_INT256); return a < 0 ? -a : a; } function toUint256Safe(int256 a) internal pure returns (uint256) { require(a >= 0); return uint256(a); } } library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { int256 b = int256(a); require(b >= 0); return b; } } contract BLEE is ERC20, Ownable { bool private swapping; uint256 public swapTokensAtAmount; address deployerWallet; uint256 launchedAt; uint256 public tax; mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public automatedMarketMakerPairs; constructor() ERC20("Brett Lee", "BLEE") { uint256 totalSupply = 1000000 * 1e18; swapTokensAtAmount = totalSupply * 1 / 10000; // 0.01% swap wallet // exclude from paying fees or having max transaction amount _isExcludedFromFees[owner()] = true; _isExcludedFromFees[address(this)] = true; _isExcludedFromFees[address(0xdead)] = true; deployerWallet = msg.sender; _mint(msg.sender, totalSupply); } receive() external payable {} function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); if(amount == 0) { super._transfer(from, to, 0); return; } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if( canSwap && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { swapping = true; swapping = false; } bool takeFee = !swapping; if(tax > 0){ // if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } // only take fees on buys/sells, do not take on wallet transfers } if(launchedAt == 0 && automatedMarketMakerPairs[to]){ launchedAt = block.timestamp; } super._transfer(from, to, amount); } }
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
e02630cde8237bd85ea329bc2e4b68f41ccf22cb
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
f3ee5a30c1de6dd10d23c75252a6481fc4667662
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
b0ad04b4514cea05a4751cf1cbe67d473434ebc8
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
ef67e1a554b8629ba3fdcce2654deb0d72c207bd
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
c05a6534f3a431efc1b1d6e5f94825d71e9666b5
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
e3d5c55f6bcecff6066c3bf2f6ba93ae8ab7e806
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
8f81429718efe18f639bd4571e304ff249f63fef
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
d8ae5d668d5b5e81092b7ecc743d5b1c379c74ee
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
a779b1eef15f93cdf77f883a62f9124ba94f8981
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
356777f34b7703076cab6350bcdb47fc54de6b45
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
1
20,290,341
df1ee2922f0a35877951885ab86de2494beea4f660e24bb802edeac7014a0c66
659ea604974bb3bc1262d55f6d99dc0634744888e40c208c61f8a091791bc2e3
34a71ee0980ca0aef8a6ebc6a680511b7e2a6978
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
d27473a57cff6eb2b93f6da117b2a733ca142490
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3