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,236 |
3009c00b76863f97e22cf464e472450f86b08200441e41b4cb4e4e1c038192d6
|
aec65bfd9d0ca6acd329d7919f092da9e6c4f0b4ac6769a3f122c01ce777036b
|
5566f89cc82172105c671548f1d77c0da131bb14
|
daba83815404f5e1bc33f5885db7d96f51e127f5
|
f835245d72b529ad9d7fa42415f23a5e22acebb7
|
3d602d80600a3d3981f3363d3d373d3d3d363d736c420beaaec4c554800dceb7779b84d5a735ea5f5af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d736c420beaaec4c554800dceb7779b84d5a735ea5f5af43d82803e903d91602b57fd5bf3
|
{{
"language": "Solidity",
"sources": {
"src/moneymarkets/ImmutableBeaconProxy.sol": {
"content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.20;\n\nimport \"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\n\ncontract ImmutableBeaconProxy is Proxy {\n\n UpgradeableBeacon public immutable __beacon;\n\n constructor(UpgradeableBeacon beacon) {\n __beacon = beacon;\n }\n\n function _implementation() internal view override returns (address) {\n return __beacon.implementation();\n }\n\n}\n"
},
"lib/openzeppelin-contracts/contracts/proxy/beacon/UpgradeableBeacon.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../../access/Ownable.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"UpgradeableBeacon: implementation is not a contract\");\n _implementation = newImplementation;\n }\n}\n"
},
"lib/openzeppelin-contracts/contracts/proxy/Proxy.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\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 function\n * 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 _beforeFallback();\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 /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n"
},
"lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n"
},
"lib/openzeppelin-contracts/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\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 /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"lib/openzeppelin-contracts/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 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://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 isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"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"
},
"lib/openzeppelin-contracts/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"
}
},
"settings": {
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"forge-std/=lib/forge-std/src/",
"@aave/core-v3/=lib/aave-v3-core/",
"erc7399/=lib/erc7399/src/",
"erc7399-wrappers/=lib/erc7399-wrappers/src/",
"@prb/test/=lib/erc7399-wrappers/lib/prb-test/src/",
"aave-v3-core/=lib/aave-v3-core/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc3156/=lib/erc7399-wrappers/lib/erc3156/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
"prb-test/=lib/erc7399-wrappers/lib/prb-test/src/",
"registry/=lib/erc7399-wrappers/lib/registry/",
"solmate/=lib/erc7399-wrappers/lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": false
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "london",
"libraries": {}
}
}}
|
1 | 20,290,239 |
c899f0e8b1e24685f70a6b680a1fccb1ce33539e82af1a1239fd71679b63c42a
|
460f5a6232102b56b453eb998ce1c207a8bdf9d99a25277860ca69fb64bb8f76
|
1028e34f2c628e364084c99f37e6260cf9db18d2
|
7c24805454f7972d36bee9d139bd93423aa29f3f
|
d1eeb6810ae6e6ee0a1a4bdb49b6b886969c7857
|
3d602d80600a3d3981f3363d3d373d3d3d363d73d631b04e8fdbe152ee4c05273588f444efdedfaf5af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73d631b04e8fdbe152ee4c05273588f444efdedfaf5af43d82803e903d91602b57fd5bf3
|
{{
"language": "Solidity",
"sources": {
"src/erc-721/ERC721TL.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IERC4906} from \"openzeppelin/interfaces/IERC4906.sol\";\nimport {Strings} from \"openzeppelin/utils/Strings.sol\";\nimport {ERC721Upgradeable, IERC165, IERC721} from \"openzeppelin-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport {OwnableAccessControlUpgradeable} from \"tl-sol-tools/upgradeable/access/OwnableAccessControlUpgradeable.sol\";\nimport {EIP2981TLUpgradeable} from \"tl-sol-tools/upgradeable/royalties/EIP2981TLUpgradeable.sol\";\nimport {IBlockListRegistry} from \"../interfaces/IBlockListRegistry.sol\";\nimport {ICreatorBase} from \"../interfaces/ICreatorBase.sol\";\nimport {IStory} from \"../interfaces/IStory.sol\";\nimport {ISynergy} from \"../interfaces/ISynergy.sol\";\nimport {ITLNftDelegationRegistry} from \"../interfaces/ITLNftDelegationRegistry.sol\";\nimport {IERC721TL} from \"./IERC721TL.sol\";\n\n/// @title ERC721TL.sol\n/// @notice Sovereign ERC-721 Creator Contract with Synergy and Story Inscriptions\n/// @author transientlabs.xyz\n/// @custom:version 3.1.0\ncontract ERC721TL is\n ERC721Upgradeable,\n OwnableAccessControlUpgradeable,\n EIP2981TLUpgradeable,\n ICreatorBase,\n IERC721TL,\n ISynergy,\n IStory,\n IERC4906\n{\n /*//////////////////////////////////////////////////////////////////////////\n Custom Types\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev Struct defining a batch mint\n struct BatchMint {\n address creator;\n uint256 fromTokenId;\n uint256 toTokenId;\n string baseUri;\n }\n\n /// @dev String representation of uint256\n using Strings for uint256;\n\n /// @dev String representation for address\n using Strings for address;\n\n /*//////////////////////////////////////////////////////////////////////////\n State Variables\n //////////////////////////////////////////////////////////////////////////*/\n\n string public constant VERSION = \"3.1.0\";\n bytes32 public constant ADMIN_ROLE = keccak256(\"ADMIN_ROLE\");\n bytes32 public constant APPROVED_MINT_CONTRACT = keccak256(\"APPROVED_MINT_CONTRACT\");\n uint256 private _counter; // token ids\n bool public storyEnabled;\n ITLNftDelegationRegistry public tlNftDelegationRegistry;\n IBlockListRegistry public blocklistRegistry;\n mapping(uint256 => bool) private _burned; // flag to see if a token is burned or not - needed for burning batch mints\n mapping(uint256 => string) private _proposedTokenUris; // Synergy proposed token uri\n mapping(uint256 => string) private _tokenUris; // established token uris\n BatchMint[] private _batchMints; // dynamic array for batch mints\n\n /*//////////////////////////////////////////////////////////////////////////\n Custom Errors\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev Token uri is an empty string\n error EmptyTokenURI();\n\n /// @dev Mint to zero address\n error MintToZeroAddress();\n\n /// @dev Batch size too small\n error BatchSizeTooSmall();\n\n /// @dev Airdrop to too few addresses\n error AirdropTooFewAddresses();\n\n /// @dev Caller is not the owner or delegate of the owner of the specific token\n error CallerNotTokenOwnerOrDelegate();\n\n /// @dev Caller is not approved or owner\n error CallerNotApprovedOrOwner();\n\n /// @dev Token does not exist\n error TokenDoesntExist();\n\n /// @dev No proposed token uri to change to\n error NoTokenUriUpdateAvailable();\n\n /// @dev Operator for token approvals blocked\n error OperatorBlocked();\n\n /// @dev Story not enabled for collectors\n error StoryNotEnabled();\n\n /*//////////////////////////////////////////////////////////////////////////\n Constructor\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @param disable Boolean to disable initialization for the implementation contract\n constructor(bool disable) {\n if (disable) _disableInitializers();\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Initializer\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @param name The name of the 721 contract\n /// @param symbol The symbol of the 721 contract\n /// @param personalization A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract.\n /// @param defaultRoyaltyRecipient The default address for royalty payments\n /// @param defaultRoyaltyPercentage The default royalty percentage of basis points (out of 10,000)\n /// @param initOwner The owner of the contract\n /// @param admins Array of admin addresses to add to the contract\n /// @param enableStory A bool deciding whether to add story fuctionality or not\n /// @param initBlockListRegistry Address of the blocklist registry to use\n /// @param initNftDelegationRegistry Address of the TL nft delegation registry to use\n function initialize(\n string memory name,\n string memory symbol,\n string memory personalization,\n address defaultRoyaltyRecipient,\n uint256 defaultRoyaltyPercentage,\n address initOwner,\n address[] memory admins,\n bool enableStory,\n address initBlockListRegistry,\n address initNftDelegationRegistry\n ) external initializer {\n // initialize parent contracts\n __ERC721_init(name, symbol);\n __EIP2981TL_init(defaultRoyaltyRecipient, defaultRoyaltyPercentage);\n __OwnableAccessControl_init(initOwner);\n\n // add admins\n _setRole(ADMIN_ROLE, admins, true);\n\n // story\n storyEnabled = enableStory;\n emit StoryStatusUpdate(initOwner, enableStory);\n\n // blocklist and nft delegation registry\n blocklistRegistry = IBlockListRegistry(initBlockListRegistry);\n emit BlockListRegistryUpdate(initOwner, address(0), initBlockListRegistry);\n tlNftDelegationRegistry = ITLNftDelegationRegistry(initNftDelegationRegistry);\n emit NftDelegationRegistryUpdate(initOwner, address(0), initNftDelegationRegistry);\n\n // emit personalization as collection story\n if (bytes(personalization).length > 0) {\n emit CollectionStory(initOwner, initOwner.toHexString(), personalization);\n }\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n General Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ICreatorBase\n function totalSupply() external view returns (uint256) {\n return _counter;\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Access Control Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ICreatorBase\n function setApprovedMintContracts(address[] calldata minters, bool status) external onlyRoleOrOwner(ADMIN_ROLE) {\n _setRole(APPROVED_MINT_CONTRACT, minters, status);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Mint Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IERC721TL\n function mint(address recipient, string calldata uri) external onlyRoleOrOwner(ADMIN_ROLE) {\n if (bytes(uri).length == 0) revert EmptyTokenURI();\n _counter++;\n _tokenUris[_counter] = uri;\n _mint(recipient, _counter);\n }\n\n /// @inheritdoc IERC721TL\n function mint(address recipient, string calldata uri, address royaltyAddress, uint256 royaltyPercent)\n external\n onlyRoleOrOwner(ADMIN_ROLE)\n {\n if (bytes(uri).length == 0) revert EmptyTokenURI();\n _counter++;\n _tokenUris[_counter] = uri;\n _overrideTokenRoyaltyInfo(_counter, royaltyAddress, royaltyPercent);\n _mint(recipient, _counter);\n }\n\n /// @inheritdoc IERC721TL\n function batchMint(address recipient, uint128 numTokens, string calldata baseUri)\n external\n onlyRoleOrOwner(ADMIN_ROLE)\n {\n if (recipient == address(0)) revert MintToZeroAddress();\n if (bytes(baseUri).length == 0) revert EmptyTokenURI();\n if (numTokens < 2) revert BatchSizeTooSmall();\n uint256 start = _counter + 1;\n uint256 end = start + numTokens - 1;\n _counter += numTokens;\n _batchMints.push(BatchMint(recipient, start, end, baseUri));\n\n _increaseBalance(recipient, numTokens); // this function adds the number of tokens to the recipient address\n\n for (uint256 id = start; id < end + 1; ++id) {\n emit Transfer(address(0), recipient, id);\n }\n }\n\n /// @inheritdoc IERC721TL\n function airdrop(address[] calldata addresses, string calldata baseUri) external onlyRoleOrOwner(ADMIN_ROLE) {\n if (bytes(baseUri).length == 0) revert EmptyTokenURI();\n if (addresses.length < 2) revert AirdropTooFewAddresses();\n\n uint256 start = _counter + 1;\n uint256 end = start + addresses.length - 1;\n _counter += addresses.length;\n _batchMints.push(BatchMint(address(0), start, end, baseUri));\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], start + i);\n }\n }\n\n /// @inheritdoc IERC721TL\n function externalMint(address recipient, string calldata uri) external onlyRole(APPROVED_MINT_CONTRACT) {\n if (bytes(uri).length == 0) revert EmptyTokenURI();\n _counter++;\n _tokenUris[_counter] = uri;\n _mint(recipient, _counter);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Burn Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IERC721TL\n function burn(uint256 tokenId) external {\n address tokenOwner = ownerOf(tokenId);\n if (!_isAuthorized(tokenOwner, msg.sender, tokenId)) revert CallerNotApprovedOrOwner();\n _burn(tokenId);\n _burned[tokenId] = true;\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Royalty Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ICreatorBase\n function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE) {\n _setDefaultRoyaltyInfo(newRecipient, newPercentage);\n }\n\n /// @inheritdoc ICreatorBase\n function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)\n external\n onlyRoleOrOwner(ADMIN_ROLE)\n {\n _overrideTokenRoyaltyInfo(tokenId, newRecipient, newPercentage);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Synergy Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ISynergy\n function proposeNewTokenUri(uint256 tokenId, string calldata newUri) external onlyRoleOrOwner(ADMIN_ROLE) {\n if (!_exists(tokenId)) revert TokenDoesntExist();\n if (bytes(newUri).length == 0) revert EmptyTokenURI();\n if (_ownerOf(tokenId) == owner()) {\n // creator owns the token\n _tokenUris[tokenId] = newUri;\n emit MetadataUpdate(tokenId);\n } else {\n // creator does not own the token\n _proposedTokenUris[tokenId] = newUri;\n emit SynergyStatusChange(msg.sender, tokenId, SynergyAction.Created, newUri);\n }\n }\n\n /// @inheritdoc ISynergy\n function acceptTokenUriUpdate(uint256 tokenId) external {\n if (!_isTokenOwnerOrDelegate(tokenId)) revert CallerNotTokenOwnerOrDelegate();\n string memory uri = _proposedTokenUris[tokenId];\n if (bytes(uri).length == 0) revert NoTokenUriUpdateAvailable();\n _tokenUris[tokenId] = uri;\n delete _proposedTokenUris[tokenId];\n emit MetadataUpdate(tokenId);\n emit SynergyStatusChange(msg.sender, tokenId, SynergyAction.Accepted, uri);\n }\n\n /// @inheritdoc ISynergy\n function rejectTokenUriUpdate(uint256 tokenId) external {\n if (!_isTokenOwnerOrDelegate(tokenId)) revert CallerNotTokenOwnerOrDelegate();\n string memory uri = _proposedTokenUris[tokenId];\n if (bytes(uri).length == 0) revert NoTokenUriUpdateAvailable();\n delete _proposedTokenUris[tokenId];\n emit SynergyStatusChange(msg.sender, tokenId, SynergyAction.Rejected, \"\");\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Token Uri Override\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ERC721Upgradeable\n function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory) {\n if (!_exists(tokenId)) revert TokenDoesntExist();\n string memory uri = _tokenUris[tokenId];\n if (bytes(uri).length == 0) {\n (, uri) = _getBatchInfo(tokenId);\n }\n return uri;\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Story Inscriptions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IStory\n function addCollectionStory(string calldata, /*creatorName*/ string calldata story)\n external\n onlyRoleOrOwner(ADMIN_ROLE)\n {\n emit CollectionStory(msg.sender, msg.sender.toHexString(), story);\n }\n\n /// @inheritdoc IStory\n function addCreatorStory(uint256 tokenId, string calldata, /*creatorName*/ string calldata story)\n external\n onlyRoleOrOwner(ADMIN_ROLE)\n {\n if (!_exists(tokenId)) revert TokenDoesntExist();\n emit CreatorStory(tokenId, msg.sender, msg.sender.toHexString(), story);\n }\n\n /// @inheritdoc IStory\n function addStory(uint256 tokenId, string calldata, /*collectorName*/ string calldata story) external {\n if (!storyEnabled) revert StoryNotEnabled();\n if (!_isTokenOwnerOrDelegate(tokenId)) revert CallerNotTokenOwnerOrDelegate();\n emit Story(tokenId, msg.sender, msg.sender.toHexString(), story);\n }\n\n /// @inheritdoc ICreatorBase\n function setStoryStatus(bool status) external onlyRoleOrOwner(ADMIN_ROLE) {\n storyEnabled = status;\n emit StoryStatusUpdate(msg.sender, status);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n BlockList\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ICreatorBase\n function setBlockListRegistry(address newBlockListRegistry) external onlyRoleOrOwner(ADMIN_ROLE) {\n address oldBlockListRegistry = address(blocklistRegistry);\n blocklistRegistry = IBlockListRegistry(newBlockListRegistry);\n emit BlockListRegistryUpdate(msg.sender, oldBlockListRegistry, newBlockListRegistry);\n }\n\n /// @inheritdoc ERC721Upgradeable\n function approve(address to, uint256 tokenId) public override(ERC721Upgradeable, IERC721) {\n if (_isOperatorBlocked(to)) revert OperatorBlocked();\n ERC721Upgradeable.approve(to, tokenId);\n }\n\n /// @inheritdoc ERC721Upgradeable\n function setApprovalForAll(address operator, bool approved) public override(ERC721Upgradeable, IERC721) {\n if (approved) {\n if (_isOperatorBlocked(operator)) revert OperatorBlocked();\n }\n ERC721Upgradeable.setApprovalForAll(operator, approved);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n NFT Delegation Registry\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ICreatorBase\n function setNftDelegationRegistry(address newNftDelegationRegistry) external onlyRoleOrOwner(ADMIN_ROLE) {\n address oldNftDelegationRegistry = address(tlNftDelegationRegistry);\n tlNftDelegationRegistry = ITLNftDelegationRegistry(newNftDelegationRegistry);\n emit NftDelegationRegistryUpdate(msg.sender, oldNftDelegationRegistry, newNftDelegationRegistry);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n ERC-165 Support\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IERC165\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC721Upgradeable, EIP2981TLUpgradeable, IERC165)\n returns (bool)\n {\n return (\n ERC721Upgradeable.supportsInterface(interfaceId) || EIP2981TLUpgradeable.supportsInterface(interfaceId)\n || interfaceId == 0x49064906 // ERC-4906\n || interfaceId == type(ICreatorBase).interfaceId || interfaceId == type(ISynergy).interfaceId\n || interfaceId == type(IStory).interfaceId || interfaceId == 0x0d23ecb9 // previous story contract version that is still supported\n || interfaceId == type(IERC721TL).interfaceId\n );\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Internal Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to get batch mint info\n /// @param tokenId Token id to look up for batch mint info\n /// @return adress The token owner\n /// @return string The uri for the tokenId\n function _getBatchInfo(uint256 tokenId) internal view returns (address, string memory) {\n uint256 i = 0;\n for (i; i < _batchMints.length; i++) {\n if (tokenId >= _batchMints[i].fromTokenId && tokenId <= _batchMints[i].toTokenId) {\n break;\n }\n }\n if (i >= _batchMints.length) {\n return (address(0), \"\");\n }\n string memory tokenUri =\n string(abi.encodePacked(_batchMints[i].baseUri, \"/\", (tokenId - _batchMints[i].fromTokenId).toString()));\n return (_batchMints[i].creator, tokenUri);\n }\n\n /// @notice Function to override { ERC721Upgradeable._ownerOf } to allow for batch minting\n /// @inheritdoc ERC721Upgradeable\n function _ownerOf(uint256 tokenId) internal view override(ERC721Upgradeable) returns (address) {\n if (_burned[tokenId]) {\n return address(0);\n } else {\n if (tokenId > 0 && tokenId <= _counter) {\n address owner = ERC721Upgradeable._ownerOf(tokenId);\n if (owner == address(0)) {\n // see if can find token in a batch mint\n (owner,) = _getBatchInfo(tokenId);\n }\n return owner;\n } else {\n return address(0);\n }\n }\n }\n\n /// @notice Function to check if a token exists\n /// @param tokenId The token id to check\n function _exists(uint256 tokenId) internal view returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /// @notice Function to get if msg.sender is the token owner or delegated owner\n function _isTokenOwnerOrDelegate(uint256 tokenId) internal view returns (bool) {\n address tokenOwner = _ownerOf(tokenId);\n if (msg.sender == tokenOwner) {\n return true;\n } else if (address(tlNftDelegationRegistry) == address(0)) {\n return false;\n } else {\n return tlNftDelegationRegistry.checkDelegateForERC721(msg.sender, tokenOwner, address(this), tokenId);\n }\n }\n\n // @notice Function to get if an operator is blocked for token approvals\n function _isOperatorBlocked(address operator) internal view returns (bool) {\n if (address(blocklistRegistry) == address(0)) {\n return false;\n } else {\n return blocklistRegistry.getBlockListStatus(operator);\n }\n }\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/interfaces/IERC4906.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4906.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\nimport {IERC721} from \"./IERC721.sol\";\n\n/// @title EIP-721 Metadata Update Extension\ninterface IERC4906 is IERC165, IERC721 {\n /// @dev This event emits when the metadata of a token is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFT.\n event MetadataUpdate(uint256 _tokenId);\n\n /// @dev This event emits when the metadata of a range of tokens is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFTs.\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/utils/Strings.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n uint8 private constant ADDRESS_LENGTH = 20;\n\n /**\n * @dev The `value` string doesn't fit in the specified `length`.\n */\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toStringSigned(int256 value) internal pure returns (string memory) {\n return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n uint256 localValue = value;\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n localValue >>= 4;\n }\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n * representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {ContextUpgradeable} from \"../../utils/ContextUpgradeable.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {ERC165Upgradeable} from \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport {IERC721Errors} from \"@openzeppelin/contracts/interfaces/draft-IERC6093.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\nabstract contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721, IERC721Metadata, IERC721Errors {\n using Strings for uint256;\n\n /// @custom:storage-location erc7201:openzeppelin.storage.ERC721\n struct ERC721Storage {\n // Token name\n string _name;\n\n // Token symbol\n string _symbol;\n\n mapping(uint256 tokenId => address) _owners;\n\n mapping(address owner => uint256) _balances;\n\n mapping(uint256 tokenId => address) _tokenApprovals;\n\n mapping(address owner => mapping(address operator => bool)) _operatorApprovals;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ERC721\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant ERC721StorageLocation = 0x80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300;\n\n function _getERC721Storage() private pure returns (ERC721Storage storage $) {\n assembly {\n $.slot := ERC721StorageLocation\n }\n }\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n ERC721Storage storage $ = _getERC721Storage();\n $._name = name_;\n $._symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual returns (uint256) {\n ERC721Storage storage $ = _getERC721Storage();\n if (owner == address(0)) {\n revert ERC721InvalidOwner(address(0));\n }\n return $._balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual returns (address) {\n return _requireOwned(tokenId);\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual returns (string memory) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual returns (string memory) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual returns (string memory) {\n _requireOwned(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n _approve(to, tokenId, _msgSender());\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual returns (address) {\n _requireOwned(tokenId);\n\n return _getApproved(tokenId);\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n // Setting an \"auth\" arguments enables the `_isAuthorized` check which verifies that the token exists\n // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.\n address previousOwner = _update(to, tokenId, _msgSender());\n if (previousOwner != from) {\n revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n }\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {\n transferFrom(from, to, tokenId);\n _checkOnERC721Received(from, to, tokenId, data);\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n *\n * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the\n * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances\n * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by\n * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._owners[tokenId];\n }\n\n /**\n * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.\n */\n function _getApproved(uint256 tokenId) internal view virtual returns (address) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._tokenApprovals[tokenId];\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in\n * particular (ignoring whether it is owned by `owner`).\n *\n * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this\n * assumption.\n */\n function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {\n return\n spender != address(0) &&\n (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.\n * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets\n * the `spender` for the specific `tokenId`.\n *\n * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this\n * assumption.\n */\n function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {\n if (!_isAuthorized(owner, spender, tokenId)) {\n if (owner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n } else {\n revert ERC721InsufficientApproval(spender, tokenId);\n }\n }\n }\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that\n * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.\n *\n * WARNING: Increasing an account's balance using this function tends to be paired with an override of the\n * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership\n * remain consistent with one another.\n */\n function _increaseBalance(address account, uint128 value) internal virtual {\n ERC721Storage storage $ = _getERC721Storage();\n unchecked {\n $._balances[account] += value;\n }\n }\n\n /**\n * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner\n * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.\n *\n * The `auth` argument is optional. If the value passed is non 0, then this function will check that\n * `auth` is either the owner of the token, or approved to operate on the token (by the owner).\n *\n * Emits a {Transfer} event.\n *\n * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.\n */\n function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {\n ERC721Storage storage $ = _getERC721Storage();\n address from = _ownerOf(tokenId);\n\n // Perform (optional) operator check\n if (auth != address(0)) {\n _checkAuthorized(from, auth, tokenId);\n }\n\n // Execute the update\n if (from != address(0)) {\n // Clear approval. No need to re-authorize or emit the Approval event\n _approve(address(0), tokenId, address(0), false);\n\n unchecked {\n $._balances[from] -= 1;\n }\n }\n\n if (to != address(0)) {\n unchecked {\n $._balances[to] += 1;\n }\n }\n\n $._owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n return from;\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n address previousOwner = _update(to, tokenId, address(0));\n if (previousOwner != address(0)) {\n revert ERC721InvalidSender(address(0));\n }\n }\n\n /**\n * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\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 _safeMint(address to, uint256 tokenId) internal {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n _checkOnERC721Received(address(0), to, tokenId, data);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal {\n address previousOwner = _update(address(0), tokenId, address(0));\n if (previousOwner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n }\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n address previousOwner = _update(to, tokenId, address(0));\n if (previousOwner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n } else if (previousOwner != from) {\n revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n }\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients\n * are aware of the ERC721 standard to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is like {safeTransferFrom} in the sense that it invokes\n * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `tokenId` token must exist and be owned by `from`.\n * - `to` cannot be the zero address.\n * - `from` cannot be the zero address.\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 _safeTransfer(address from, address to, uint256 tokenId) internal {\n _safeTransfer(from, to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n _checkOnERC721Received(from, to, tokenId, data);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is\n * either the owner of the token, or approved to operate on all tokens held by this owner.\n *\n * Emits an {Approval} event.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address to, uint256 tokenId, address auth) internal {\n _approve(to, tokenId, auth, true);\n }\n\n /**\n * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not\n * emitted in the context of transfers.\n */\n function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {\n ERC721Storage storage $ = _getERC721Storage();\n // Avoid reading the owner unless necessary\n if (emitEvent || auth != address(0)) {\n address owner = _requireOwned(tokenId);\n\n // We do not use _isAuthorized because single-token approvals should not be able to call approve\n if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {\n revert ERC721InvalidApprover(auth);\n }\n\n if (emitEvent) {\n emit Approval(owner, to, tokenId);\n }\n }\n\n $._tokenApprovals[tokenId] = to;\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Requirements:\n * - operator can't be the address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n ERC721Storage storage $ = _getERC721Storage();\n if (operator == address(0)) {\n revert ERC721InvalidOperator(operator);\n }\n $._operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).\n * Returns the owner.\n *\n * Overrides to ownership logic should be done to {_ownerOf}.\n */\n function _requireOwned(uint256 tokenId) internal view returns (address) {\n address owner = _ownerOf(tokenId);\n if (owner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n }\n return owner;\n }\n\n /**\n * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the\n * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n */\n function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {\n if (to.code.length > 0) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n if (retval != IERC721Receiver.onERC721Received.selector) {\n revert ERC721InvalidReceiver(to);\n }\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert ERC721InvalidReceiver(to);\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n }\n}\n"
},
"lib/tl-sol-tools/src/upgradeable/access/OwnableAccessControlUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport {OwnableUpgradeable} from \"openzeppelin-upgradeable/access/OwnableUpgradeable.sol\";\nimport {EnumerableSet} from \"openzeppelin/utils/structs/EnumerableSet.sol\";\n\n/// @title OwnableAccessControlUpgradeable.sol\n/// @notice Single owner, flexible access control mechanics\n/// @dev Can easily be extended by inheriting and applying additional roles\n/// @dev By default, only the owner can grant roles but by inheriting, but you\n/// may allow other roles to grant roles by using the internal helper.\n/// @author transientlabs.xyz\n/// @custom:version 3.0.0\nabstract contract OwnableAccessControlUpgradeable is OwnableUpgradeable {\n /*//////////////////////////////////////////////////////////////////////////\n Types\n //////////////////////////////////////////////////////////////////////////*/\n\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /*//////////////////////////////////////////////////////////////////////////\n Storage\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @custom:storage-location erc7201:transientlabs.storage.OwnableAccessControl\n struct OwnableAccessControlStorage {\n uint256 c; // counter to be able to revoke all priviledges\n mapping(uint256 => mapping(bytes32 => mapping(address => bool))) roleStatus;\n mapping(uint256 => mapping(bytes32 => EnumerableSet.AddressSet)) roleMembers;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"transientlabs.storage.OwnableAccessControl\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant OwnableAccessControlStorageLocation =\n 0x0d0469b3d32e63681b9fc586a5627ad5e70b3d1ad20f31767e4b6c4141c7e300;\n\n function _getOwnableAccessControlStorage() private pure returns (OwnableAccessControlStorage storage $) {\n assembly {\n $.slot := OwnableAccessControlStorageLocation\n }\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Events\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @param from Address that authorized the role change\n /// @param user The address who's role has been changed\n /// @param approved Boolean indicating the user's status in role\n /// @param role The bytes32 role created in the inheriting contract\n event RoleChange(address indexed from, address indexed user, bool indexed approved, bytes32 role);\n\n /// @param from Address that authorized the revoke\n event AllRolesRevoked(address indexed from);\n\n /*//////////////////////////////////////////////////////////////////////////\n Errors\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev Does not have specified role\n error NotSpecifiedRole(bytes32 role);\n\n /// @dev Is not specified role or owner\n error NotRoleOrOwner(bytes32 role);\n\n /*//////////////////////////////////////////////////////////////////////////\n Modifiers\n //////////////////////////////////////////////////////////////////////////*/\n\n modifier onlyRole(bytes32 role) {\n if (!hasRole(role, msg.sender)) {\n revert NotSpecifiedRole(role);\n }\n _;\n }\n\n modifier onlyRoleOrOwner(bytes32 role) {\n if (!hasRole(role, msg.sender) && owner() != msg.sender) {\n revert NotRoleOrOwner(role);\n }\n _;\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Initializer\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @param initOwner The address of the initial owner\n function __OwnableAccessControl_init(address initOwner) internal onlyInitializing {\n __Ownable_init(initOwner);\n __OwnableAccessControl_init_unchained();\n }\n\n function __OwnableAccessControl_init_unchained() internal onlyInitializing {}\n\n /*//////////////////////////////////////////////////////////////////////////\n External Role Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to revoke all roles currently present\n /// @dev Increments the `_c` variables\n /// @dev Requires owner privileges\n function revokeAllRoles() external onlyOwner {\n OwnableAccessControlStorage storage $ = _getOwnableAccessControlStorage();\n $.c++;\n emit AllRolesRevoked(msg.sender);\n }\n\n /// @notice Function to renounce role\n /// @param role Bytes32 role created in inheriting contracts\n function renounceRole(bytes32 role) external {\n address[] memory members = new address[](1);\n members[0] = msg.sender;\n _setRole(role, members, false);\n }\n\n /// @notice Function to grant/revoke a role to an address\n /// @dev Requires owner to call this function but this may be further\n /// extended using the internal helper function in inheriting contracts\n /// @param role Bytes32 role created in inheriting contracts\n /// @param roleMembers List of addresses that should have roles attached to them based on `status`\n /// @param status Bool whether to remove or add `roleMembers` to the `role`\n function setRole(bytes32 role, address[] memory roleMembers, bool status) external onlyOwner {\n _setRole(role, roleMembers, status);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n External View Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to see if an address is the owner\n /// @param role Bytes32 role created in inheriting contracts\n /// @param potentialRoleMember Address to check for role membership\n function hasRole(bytes32 role, address potentialRoleMember) public view returns (bool) {\n OwnableAccessControlStorage storage $ = _getOwnableAccessControlStorage();\n return $.roleStatus[$.c][role][potentialRoleMember];\n }\n\n /// @notice Function to get role members\n /// @param role Bytes32 role created in inheriting contracts\n function getRoleMembers(bytes32 role) public view returns (address[] memory) {\n OwnableAccessControlStorage storage $ = _getOwnableAccessControlStorage();\n return $.roleMembers[$.c][role].values();\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Internal Helper Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Helper function to set addresses for a role\n /// @param role Bytes32 role created in inheriting contracts\n /// @param roleMembers List of addresses that should have roles attached to them based on `status`\n /// @param status Bool whether to remove or add `roleMembers` to the `role`\n function _setRole(bytes32 role, address[] memory roleMembers, bool status) internal {\n OwnableAccessControlStorage storage $ = _getOwnableAccessControlStorage();\n for (uint256 i = 0; i < roleMembers.length; i++) {\n $.roleStatus[$.c][role][roleMembers[i]] = status;\n if (status) {\n $.roleMembers[$.c][role].add(roleMembers[i]);\n } else {\n $.roleMembers[$.c][role].remove(roleMembers[i]);\n }\n emit RoleChange(msg.sender, roleMembers[i], status, role);\n }\n }\n}\n"
},
"lib/tl-sol-tools/src/upgradeable/royalties/EIP2981TLUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport {ERC165Upgradeable} from \"openzeppelin-upgradeable/utils/introspection/ERC165Upgradeable.sol\";\nimport {IEIP2981} from \"../../royalties/IEIP2981.sol\";\n\n/// @title EIP2981TLUpgradeable.sol\n/// @notice Abstract contract to define a default royalty spec\n/// while allowing for specific token overrides\n/// @dev Follows EIP-2981 (https://eips.ethereum.org/EIPS/eip-2981)\n/// @author transientlabs.xyz\n/// @custom:version 3.1.0\nabstract contract EIP2981TLUpgradeable is IEIP2981, ERC165Upgradeable {\n /*//////////////////////////////////////////////////////////////////////////\n Types\n //////////////////////////////////////////////////////////////////////////*/\n\n struct RoyaltySpec {\n address recipient;\n uint256 percentage;\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Storage\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @custom:storage-location erc7201:transientlabs.storage.EIP2981TLStorage\n struct EIP2981TLStorage {\n address defaultRecipient;\n uint256 defaultPercentage;\n mapping(uint256 => RoyaltySpec) tokenOverrides;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"transientlabs.storage.EIP2981TLStorage\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant EIP2981TLStorageLocation =\n 0xe9db8e9b56f2e28e12956850f386d9a4c1e886a4f584b61a10a9d0cacee70700;\n\n function _getEIP2981TLStorage() private pure returns (EIP2981TLStorage storage $) {\n assembly {\n $.slot := EIP2981TLStorageLocation\n }\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Constants\n //////////////////////////////////////////////////////////////////////////*/\n\n uint256 public constant BASIS = 10_000;\n\n /*//////////////////////////////////////////////////////////////////////////\n Events\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev Event to emit when the default roylaty is updated\n event DefaultRoyaltyUpdate(address indexed sender, address newRecipient, uint256 newPercentage);\n\n /// @dev Event to emit when a token royalty is overriden\n event TokenRoyaltyOverride(address indexed sender, uint256 indexed tokenId, address newRecipient, uint256 newPercentage);\n\n /*//////////////////////////////////////////////////////////////////////////\n Errors\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev error if the recipient is set to address(0)\n error ZeroAddressError();\n\n /// @dev error if the royalty percentage is greater than to 100%\n error MaxRoyaltyError();\n\n /*//////////////////////////////////////////////////////////////////////////\n Initializer\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to initialize the contract\n /// @param defaultRecipient The default royalty payout address\n /// @param defaultPercentage The deafult royalty percentage, out of 10,000\n function __EIP2981TL_init(address defaultRecipient, uint256 defaultPercentage) internal onlyInitializing {\n __EIP2981TL_init_unchained(defaultRecipient, defaultPercentage);\n }\n\n /// @notice Unchained function to initialize the contract\n /// @param defaultRecipient The default royalty payout address\n /// @param defaultPercentage The deafult royalty percentage, out of 10,000\n function __EIP2981TL_init_unchained(address defaultRecipient, uint256 defaultPercentage)\n internal\n onlyInitializing\n {\n _setDefaultRoyaltyInfo(defaultRecipient, defaultPercentage);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Royalty Changing Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to set default royalty info\n /// @param newRecipient The new default royalty payout address\n /// @param newPercentage The new default royalty percentage, out of 10,000\n function _setDefaultRoyaltyInfo(address newRecipient, uint256 newPercentage) internal {\n EIP2981TLStorage storage $ = _getEIP2981TLStorage();\n if (newRecipient == address(0)) revert ZeroAddressError();\n if (newPercentage > 10_000) revert MaxRoyaltyError();\n $.defaultRecipient = newRecipient;\n $.defaultPercentage = newPercentage;\n emit DefaultRoyaltyUpdate(msg.sender, newRecipient, newPercentage);\n }\n\n /// @notice Function to override royalty spec on a specific token\n /// @param tokenId The token id to override royalty for\n /// @param newRecipient The new royalty payout address\n /// @param newPercentage The new royalty percentage, out of 10,000\n function _overrideTokenRoyaltyInfo(uint256 tokenId, address newRecipient, uint256 newPercentage) internal {\n EIP2981TLStorage storage $ = _getEIP2981TLStorage();\n if (newRecipient == address(0)) revert ZeroAddressError();\n if (newPercentage > 10_000) revert MaxRoyaltyError();\n $.tokenOverrides[tokenId].recipient = newRecipient;\n $.tokenOverrides[tokenId].percentage = newPercentage;\n emit TokenRoyaltyOverride(msg.sender, tokenId, newRecipient, newPercentage);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Royalty Info\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IEIP2981\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount)\n {\n EIP2981TLStorage storage $ = _getEIP2981TLStorage();\n address recipient = $.defaultRecipient;\n uint256 percentage = $.defaultPercentage;\n if ($.tokenOverrides[tokenId].recipient != address(0)) {\n recipient = $.tokenOverrides[tokenId].recipient;\n percentage = $.tokenOverrides[tokenId].percentage;\n }\n return (recipient, salePrice * percentage / BASIS);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n ERC-165 Override\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc ERC165Upgradeable\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable) returns (bool) {\n return interfaceId == type(IEIP2981).interfaceId || ERC165Upgradeable.supportsInterface(interfaceId);\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n External View Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Query the default royalty receiver and percentage.\n /// @return Tuple containing the default royalty recipient and percentage out of 10_000\n function getDefaultRoyaltyRecipientAndPercentage() external view returns (address, uint256) {\n EIP2981TLStorage storage $ = _getEIP2981TLStorage();\n return ($.defaultRecipient, $.defaultPercentage);\n }\n}\n"
},
"src/interfaces/IBlockListRegistry.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/// @title BlockList Registry\n/// @notice Interface for the BlockListRegistry Contract\n/// @author transientlabs.xyz\n/// @custom:version 4.0.3\ninterface IBlockListRegistry {\n /*//////////////////////////////////////////////////////////////////////////\n Events\n //////////////////////////////////////////////////////////////////////////*/\n\n event BlockListStatusChange(address indexed user, address indexed operator, bool indexed status);\n\n event BlockListCleared(address indexed user);\n\n /*//////////////////////////////////////////////////////////////////////////\n Public Read Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to get blocklist status with True meaning that the operator is blocked\n /// @param operator The operator in question to check against the blocklist\n function getBlockListStatus(address operator) external view returns (bool);\n\n /*//////////////////////////////////////////////////////////////////////////\n Public Write Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to set the block list status for multiple operators\n /// @dev Must be called by the blockList owner\n /// @param operators An address array of operators to set a status for\n /// @param status The status to set for all `operators`\n function setBlockListStatus(address[] calldata operators, bool status) external;\n\n /// @notice Function to clear the block list status\n /// @dev Must be called by the blockList owner\n function clearBlockList() external;\n}\n"
},
"src/interfaces/ICreatorBase.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IBlockListRegistry} from \"./IBlockListRegistry.sol\";\nimport {ITLNftDelegationRegistry} from \"./ITLNftDelegationRegistry.sol\";\n\n/// @title ICreatorBase.sol\n/// @notice Base interface for creator contracts\n/// @dev Interface id = 0x1c8e024d\n/// @author transientlabs.xyz\n/// @custom:version 3.0.0\ninterface ICreatorBase {\n /*//////////////////////////////////////////////////////////////////////////\n Events\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev Event for changing the story status\n event StoryStatusUpdate(address indexed sender, bool indexed status);\n\n /// @dev Event for changing the BlockList registry\n event BlockListRegistryUpdate(\n address indexed sender, address indexed prevBlockListRegistry, address indexed newBlockListRegistry\n );\n\n /// @dev Event for changing the NFT Delegation registry\n event NftDelegationRegistryUpdate(\n address indexed sender, address indexed prevNftDelegationRegistry, address indexed newNftDelegationRegistry\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to get total supply minted so far\n function totalSupply() external view returns (uint256);\n\n /// @notice Function to set approved mint contracts\n /// @dev Access to owner or admin\n /// @param minters Array of minters to grant approval to\n /// @param status Status for the minters\n function setApprovedMintContracts(address[] calldata minters, bool status) external;\n\n /// @notice Function to change the blocklist registry\n /// @dev Access to owner or admin\n /// @param newBlockListRegistry The new blocklist registry\n function setBlockListRegistry(address newBlockListRegistry) external;\n\n /// @notice Function to get the blocklist registry\n function blocklistRegistry() external view returns (IBlockListRegistry);\n\n /// @notice Function to change the TL NFT delegation registry\n /// @dev Access to owner or admin\n /// @param newNftDelegationRegistry The new blocklist registry\n function setNftDelegationRegistry(address newNftDelegationRegistry) external;\n\n /// @notice Function to get the delegation registry\n function tlNftDelegationRegistry() external view returns (ITLNftDelegationRegistry);\n\n /// @notice Function to set the default royalty specification\n /// @dev Requires owner or admin\n /// @param newRecipient The new royalty payout address\n /// @param newPercentage The new royalty percentage in basis (out of 10,000)\n function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external;\n\n /// @notice Function to override a token's royalty info\n /// @dev Requires owner or admin\n /// @param tokenId The token to override royalty for\n /// @param newRecipient The new royalty payout address for the token id\n /// @param newPercentage The new royalty percentage in basis (out of 10,000) for the token id\n function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage) external;\n\n /// @notice Function to enable or disable collector story inscriptions\n /// @dev Requires owner or admin\n /// @param status The status to set for collector story inscriptions\n function setStoryStatus(bool status) external;\n\n /// @notice Function to get the status of collector stories\n /// @return bool Status of collector stories being enabled\n function storyEnabled() external view returns (bool);\n}\n"
},
"src/interfaces/IStory.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/// @title Transient Labs Story Inscriptions Interface\n/// @dev Interface id: 0x2464f17b\n/// @dev Previous interface id that is still supported: 0x0d23ecb9\n/// @author transientlabs.xyz\n/// @custom:version 6.0.0\ninterface IStory {\n /*//////////////////////////////////////////////////////////////////////////\n Events\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Event describing a collection story getting added to a contract\n /// @dev This event stories creator stories on chain in the event log that apply to an entire collection\n /// @param creatorAddress The address of the creator of the collection\n /// @param creatorName String representation of the creator's name\n /// @param story The story written and attached to the collection\n event CollectionStory(address indexed creatorAddress, string creatorName, string story);\n\n /// @notice Event describing a creator story getting added to a token\n /// @dev This events stores creator stories on chain in the event log\n /// @param tokenId The token id to which the story is attached\n /// @param creatorAddress The address of the creator of the token\n /// @param creatorName String representation of the creator's name\n /// @param story The story written and attached to the token id\n event CreatorStory(uint256 indexed tokenId, address indexed creatorAddress, string creatorName, string story);\n\n /// @notice Event describing a collector story getting added to a token\n /// @dev This events stores collector stories on chain in the event log\n /// @param tokenId The token id to which the story is attached\n /// @param collectorAddress The address of the collector of the token\n /// @param collectorName String representation of the collectors's name\n /// @param story The story written and attached to the token id\n event Story(uint256 indexed tokenId, address indexed collectorAddress, string collectorName, string story);\n\n /*//////////////////////////////////////////////////////////////////////////\n Story Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to let the creator add a story to the collection they have created\n /// @dev Depending on the implementation, this function may be restricted in various ways, such as\n /// limiting the number of times the creator may write a story.\n /// @dev This function MUST emit the CollectionStory event each time it is called\n /// @dev This function MUST implement logic to restrict access to only the creator\n /// @param creatorName String representation of the creator's name\n /// @param story The story written and attached to the token id\n function addCollectionStory(string calldata creatorName, string calldata story) external;\n\n /// @notice Function to let the creator add a story to any token they have created\n /// @dev Depending on the implementation, this function may be restricted in various ways, such as\n /// limiting the number of times the creator may write a story.\n /// @dev This function MUST emit the CreatorStory event each time it is called\n /// @dev This function MUST implement logic to restrict access to only the creator\n /// @dev This function MUST revert if a story is written to a non-existent token\n /// @param tokenId The token id to which the story is attached\n /// @param creatorName String representation of the creator's name\n /// @param story The story written and attached to the token id\n function addCreatorStory(uint256 tokenId, string calldata creatorName, string calldata story) external;\n\n /// @notice Function to let collectors add a story to any token they own\n /// @dev Depending on the implementation, this function may be restricted in various ways, such as\n /// limiting the number of times a collector may write a story.\n /// @dev This function MUST emit the Story event each time it is called\n /// @dev This function MUST implement logic to restrict access to only the owner of the token\n /// @dev This function MUST revert if a story is written to a non-existent token\n /// @param tokenId The token id to which the story is attached\n /// @param collectorName String representation of the collectors's name\n /// @param story The story written and attached to the token id\n function addStory(uint256 tokenId, string calldata collectorName, string calldata story) external;\n}\n"
},
"src/interfaces/ISynergy.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/// @title ISynergy.sol\n/// @notice Interface for Synergy\n/// @dev Interface id = 0x8193ebea\n/// @author transientlabs.xyz\n/// @custom:version 3.0.0\ninterface ISynergy {\n /*//////////////////////////////////////////////////////////////////////////\n Types\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev Enum defining Synergy actions\n enum SynergyAction {\n Created,\n Accepted,\n Rejected\n }\n\n /*//////////////////////////////////////////////////////////////////////////\n Events\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @dev Event for changing the status of a proposed metadata update.\n event SynergyStatusChange(address indexed from, uint256 indexed tokenId, SynergyAction indexed action, string uri);\n\n /*//////////////////////////////////////////////////////////////////////////\n Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to propose a token uri update for a specific token\n /// @dev Requires owner or admin\n /// @dev If the owner of the contract is the owner of the token, the change takes hold right away\n /// @dev MUST emit a `MetadataUpdate` event if the owner of the token is the owner of the contract\n /// @dev MUST emit a `SynergyStatusChange` event if the owner of the token is not the owner of the contract\n /// @param tokenId The token to propose new metadata for\n /// @param newUri The new token uri proposed\n function proposeNewTokenUri(uint256 tokenId, string calldata newUri) external;\n\n /// @notice Function to accept a proposed token uri update for a specific token\n /// @dev Requires owner of the token or delegate to call the function\n /// @dev MUST emit a `SynergyStatusChange` event\n /// @param tokenId The token to accept the metadata update for\n function acceptTokenUriUpdate(uint256 tokenId) external;\n\n /// @notice Function to reject a proposed token uri update for a specific token\n /// @dev Requires owner of the token or delegate to call the function\n /// @dev MUST emit a `SynergyStatusChange` event\n /// @param tokenId The token to reject the metadata update for\n function rejectTokenUriUpdate(uint256 tokenId) external;\n}\n"
},
"src/interfaces/ITLNftDelegationRegistry.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n/// @title ITLNftDelegationRegistry.sol\n/// @notice Interface for the TL NFT Delegation Registry\n/// @author transientlabs.xyz\n/// @custom:version 1.0.0\ninterface ITLNftDelegationRegistry {\n /// @notice Function to check if an address is delegated for a vault for an ERC-721 token\n /// @dev This function does not ensure the vault is the current owner of the token\n /// @dev This function SHOULD return `True` if the delegate is delegated for the vault whether it's on the token level, contract level, or wallet level (all)\n /// @param delegate The address to check for delegation status\n /// @param vault The vault address to check against\n /// @param nftContract The nft contract address to check\n /// @param tokenId The token id to check against\n /// @return bool `True` is delegated, `False` if not\n function checkDelegateForERC721(address delegate, address vault, address nftContract, uint256 tokenId)\n external\n view\n returns (bool);\n\n /// @notice Function to check if an address is delegated for a vault for an ERC-1155 token\n /// @dev This function does not ensure the vault has a balance of the token in question\n /// @dev This function SHOULD return `True` if the delegate is delegated for the vault whether it's on the token level, contract level, or wallet level (all)\n /// @param delegate The address to check for delegation status\n /// @param vault The vault address to check against\n /// @param nftContract The nft contract address to check\n /// @param tokenId The token id to check against\n /// @return bool `True` is delegated, `False` if not\n function checkDelegateForERC1155(address delegate, address vault, address nftContract, uint256 tokenId)\n external\n view\n returns (bool);\n}\n"
},
"src/erc-721/IERC721TL.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/// @title IERC721TL.sol\n/// @notice Interface for ERC721TL\n/// @dev Interface id = 0xc74089ae\n/// @author transientlabs.xyz\n/// @custom:version 3.0.0\ninterface IERC721TL {\n /*//////////////////////////////////////////////////////////////////////////\n Functions\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Function to mint a single token\n /// @dev Requires owner or admin\n /// @param recipient The recipient of the token - assumed as able to receive 721 tokens\n /// @param uri The token uri to mint\n function mint(address recipient, string calldata uri) external;\n\n /// @notice Function to mint a single token with specific token royalty\n /// @dev Requires owner or admin\n /// @param recipient The recipient of the token - assumed as able to receive 721 tokens\n /// @param uri The token uri to mint\n /// @param royaltyAddress Royalty payout address for this new token\n /// @param royaltyPercent Royalty percentage for this new token\n function mint(address recipient, string calldata uri, address royaltyAddress, uint256 royaltyPercent) external;\n\n /// @notice Function to batch mint tokens\n /// @dev Requires owner or admin\n /// @dev The `baseUri` folder should have the same number of json files in it as `numTokens`\n /// @dev The `baseUri` folder should have files named without any file extension\n /// @param recipient The recipient of the token - assumed as able to receive 721 tokens\n /// @param numTokens Number of tokens in the batch mint\n /// @param baseUri The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing `/`\n function batchMint(address recipient, uint128 numTokens, string calldata baseUri) external;\n\n /// @notice Function to airdrop tokens to addresses\n /// @dev Requires owner or admin\n /// @dev Utilizes batch mint token uri values to save some gas but still ultimately mints individual tokens to people\n /// @dev The `baseUri` folder should have the same number of json files in it as addresses in `addresses`\n /// @dev The `baseUri` folder should have files named without any file extension\n /// @param addresses Dynamic array of addresses to mint to\n /// @param baseUri The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing `/`\n function airdrop(address[] calldata addresses, string calldata baseUri) external;\n\n /// @notice Function to allow an approved mint contract to mint\n /// @dev Requires the caller to be an approved mint contract\n /// @param recipient The recipient of the token - assumed as able to receive 721 tokens\n /// @param uri The token uri to mint\n function externalMint(address recipient, string calldata uri) external;\n\n /// @notice Function to burn a token\n /// @dev Caller must be approved or owner of the token\n /// @param tokenId The token to burn\n function burn(uint256 tokenId) external;\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/interfaces/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"../token/ERC721/IERC721.sol\";\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/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"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../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`.\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\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\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 have been allowed to move this token by either {approve} or\n * {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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 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 address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) 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 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"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.20;\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\n * reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.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"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\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 ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/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"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.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 \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165 {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\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"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/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 = 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"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n /// @custom:storage-location erc7201:openzeppelin.storage.Ownable\n struct OwnableStorage {\n address _owner;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Ownable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;\n\n function _getOwnableStorage() private pure returns (OwnableStorage storage $) {\n assembly {\n $.slot := OwnableStorageLocation\n }\n }\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n function __Ownable_init(address initialOwner) internal onlyInitializing {\n __Ownable_init_unchained(initialOwner);\n }\n\n function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n OwnableStorage storage $ = _getOwnableStorage();\n return $._owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n OwnableStorage storage $ = _getOwnableStorage();\n address oldOwner = $._owner;\n $._owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value => uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n"
},
"lib/tl-sol-tools/src/royalties/IEIP2981.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\n///\n/// @dev Interface for the NFT Royalty Standard\n///\ninterface IEIP2981 {\n /// ERC165 bytes to add to interface array - set in parent contract\n /// implementing this standard\n ///\n /// bytes4(keccak256(\"royaltyInfo(uint256,uint256)\")) == 0x2a55205a\n\n /// @notice Called with the sale price to determine how much royalty\n // is owed and to whom.\n /// @param tokenId The NFT asset queried for royalty information\n /// @param salePrice The sale price of the NFT asset specified by tokenId\n /// @return receiver Address of who should be sent the royalty payment\n /// @return royaltyAmount The royalty payment amount for salePrice\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n"
}
},
"settings": {
"remappings": [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-upgradeable/=lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/contracts/",
"openzeppelin/=lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/",
"tl-sol-tools/=lib/tl-sol-tools/src/",
"@manifoldxyz/libraries-solidity/=lib/tl-sol-tools/lib/royalty-registry-solidity/lib/libraries-solidity/",
"@openzeppelin/contracts-upgradeable/=lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/",
"create2-helpers/=lib/tl-sol-tools/lib/royalty-registry-solidity/lib/create2-helpers/",
"create2-scripts/=lib/tl-sol-tools/lib/royalty-registry-solidity/lib/create2-helpers/script/",
"erc4626-tests/=lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"libraries-solidity/=lib/tl-sol-tools/lib/royalty-registry-solidity/lib/libraries-solidity/contracts/",
"royalty-registry-solidity/=lib/tl-sol-tools/lib/royalty-registry-solidity/",
"openzeppelin-contracts-upgradeable/=lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/tl-sol-tools/lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 10000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {}
}
}}
|
1 | 20,290,243 |
3e261a289111a707baf9ada18d4d5a9fefed246255f3fb5232a914071e31848d
|
d37c939a9341272f5ef37bc447445ac7f279b8100d2b9705cb550a610eba7269
|
6a0fcbffc963cc03cb9837ef4736d898eb14545d
|
6a0fcbffc963cc03cb9837ef4736d898eb14545d
|
21e144a799aa1336807bf25c8eae9f2a34089c39
|
6080346100c657601f6112bd38819003918201601f19168301916001600160401b038311848410176100cb578084926020946040528339810103126100c657516001600160a01b0390818116908190036100c65733156100ad5760005460018060a01b0319903382821617600055604051933391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a360015416176001556111db90816100e28239f35b604051631e4fbdf760e01b815260006004820152602490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6040608081526004908136101561001557600080fd5b600091823560e01c80631b985e5c14610a1257806331a20611146106195780633ee70896146105e157806348a76f4b14610516578063715018a6146104b957806384ba316d1461041a57806386e306b5146103d55780638da5cb5b146103ad578063908bb2ae1461028d578063959eeb0414610165578063a7c6402c146101385763f2fde38b146100a557600080fd5b34610134576020366003190112610134576100be610ba3565b906100c7611116565b6001600160a01b0391821692831561011e575050600054826bffffffffffffffffffffffff60a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8280fd5b50503461016157816003193601126101615760015490516001600160a01b039091168152602090f35b5080fd5b5090346101345761017536610c2a565b91909294610181611116565b6001600160a01b038681169390610199851515610d1d565b600180946101a982855111610d69565b60ff8951916101b783610bbe565b16815260209760ff89830191168152898201948552878c526002895260ff8a8d2092511661ff008354925160081b169161ffff19161717815501915180519367ffffffffffffffff851161027a575086906102128585610db5565b0191895285892090895b848110610267578a8a7f5567c94ea5180f8b49121d2bfac889dfb6737f211f691643f28ff8352d78111b6102618c60028d8d8752528085209051918291339583610e89565b0390a280f35b835182168382015592870192850161021c565b634e487b7160e01b8b526041905260248afd5b5090346101345760203660031901126101345781356001600160a01b0381811693918490036103a9576102be611116565b8315610366576001549081169182851461031557506001600160a01b03191683176001558151928352602083015233917f2f963642a56f2e696ba7f74fab40cc248c374f3f3e463b59294b2adb9a01e6c39190a280f35b608490602085519162461bcd60e51b8352820152602560248201527f4d75737420626520646966666572656e742066726f6d2063757272656e74207260448201526437baba32b960d91b6064820152fd5b506020606492519162461bcd60e51b8352820152601c60248201527f526f7574657220616464726573732063616e2774206265207a65726f000000006044820152fd5b8480fd5b505034610161578160031936011261016157905490516001600160a01b039091168152602090f35b505034610161576020366003190112610161579081906001600160a01b036103fb610ba3565b1681526002602052205460ff825191818116835260081c166020820152f35b50503461016157602036600319011261016157610435610ba3565b61043d611116565b6001600160a01b0316808352600260205281832083815560019081018054600082559293929081610499575b505050519081527fcb77b0a22052fb1b991edffd88b74e8ab29106953e561907e692a299fdf28d4260203392a280f35b6000526020600020908101905b81811015610469576000815582016104a6565b83346105135780600319360112610513576104d2611116565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b5050346101615760209182600319360112610513576001926001600160a01b03919082610541610ba3565b1690818352600281528483209385519561055a87610bbe565b60ff80875498818a168152818682019a60081c168a5261058b8b996105848651809e819301610e17565b038c610bf0565b8a8482015251169751169080519760808901958952848901528701526080606087015286518093528160a08701970193905b8382106105ca5786880387f35b8451811688529682019693820193908501906105bd565b828434610513576060366003190112610513575061060d610600610ba3565b6044359060243590610f5c565b82519182526020820152f35b50903461013457606036600319011261013457610634610ba3565b6001600160a01b039360249081358681169190829003610513576044803593838352602097600289526001998a8986200154156109d25786158015906109cb575b1561098b576106b585828d541688825260028d528d8c832001908c8b81519586948593849363d06ca61f60e01b85528b8501528b8401528b830190610e17565b03915afa9081156108d7578691610969575b50805160001981019190821161095757906106e191610ece565b5193895191808c84019a6323b872dd60e01b8c5216998a8685015230838501528960648501526064845260a084019367ffffffffffffffff9481811086821117610945578d52518891829190828c5af13d15610939573d8481116109275761076b918e918e519061075b84601f19601f8401160183610bf0565b81528a81933d92013e5b8a611142565b8051908d821515928361090e575b5050506108f7578c54169087875260028c528c8b88200160784201918242116108e557833b156108e157928a89878f956107da8b9660a08e9b9a869a519c8d9a8b998a98635c11d79560e01b8a5289015287015285015260a4840190610e17565b90336064840152608483015203925af180156108d7576108b3575b50508751996108038b610bbe565b60028b5288368b8d0137866108178c610eab565b528a5111156108a05750509161088a86809695937ff8248d1f1434f4df07d44fa1efb30943baa8b22bc99dc3c991f1e3a8b1022b469561089c998c015283815260028a5220926108778751948594855260808b8601526080850190610e5e565b9087840152828103606084015289610ce9565b0390a251928284938452830190610ce9565b0390f35b603290634e487b7160e01b600052526000fd5b81959295116108c65788529238806107f5565b50634e487b7160e01b815260418452fd5b8a513d88823e3d90fd5b8880fd5b634e487b7160e01b8952601186528689fd5b50508851635274afe760e01b815291820186905250fd5b61091e9350820181019101610dff565b15388d81610779565b634e487b7160e01b8952604186528689fd5b61076b90606090610765565b634e487b7160e01b8a5260418752878afd5b634e487b7160e01b8752601184528487fd5b61098591503d8088833e61097d8183610bf0565b810190610ee2565b386106c7565b507f7265717569726520616d6f756e74496e204f5220616d6f756e744f757400000083601d6064948c8c519562461bcd60e51b8752860152840152820152fd5b5084610675565b507f546869732063757272656e6379206973206e6f7420616c6c6f7765640000000083601c6064948c8c519562461bcd60e51b8752860152840152820152fd5b50903461013457610a2236610c2a565b91610a2f95919395611116565b6001600160a01b0386811693909190610a49851515610d1d565b60018092610a5982845111610d69565b60ff895191610a6783610bbe565b16815260209760ff89830191168152898201938452878c526002895260ff8a8d2092511661ff008354925160081b169161ffff1916171781550190519081519167ffffffffffffffff8311610b90578790610ac28484610db5565b01908a52868a208a5b838110610b7d5750505050506001541684519163095ea7b360e01b83528201526000196024820152828160448189865af18015610b7357927f82826bb7dc9a26d2346c3ebc533704c20400de4b6553f76a5846b453305d59d2949260029261026195610b46575b508752528085209051918291339583610e89565b610b6590833d8511610b6c575b610b5d8183610bf0565b810190610dff565b5038610b32565b503d610b53565b84513d88823e3d90fd5b8251861682820155918801918401610acb565b634e487b7160e01b8b526041865260248bfd5b600435906001600160a01b0382168203610bb957565b600080fd5b6060810190811067ffffffffffffffff821117610bda57604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff821117610bda57604052565b67ffffffffffffffff8111610bda5760051b60200190565b6080600319820112610bb9576001600160a01b03906004358281168103610bb9579260243560ff81168103610bb9579260443560ff81168103610bb957926064359067ffffffffffffffff8211610bb95780602383011215610bb957816004013592610c9584610c12565b93610ca36040519586610bf0565b8085526020936024602087019260051b820101938411610bb957602401905b838210610cd157505050505090565b81358381168103610bb9578152908401908401610cc2565b90815180825260208080930193019160005b828110610d09575050505090565b835185529381019392810192600101610cfb565b15610d2457565b60405162461bcd60e51b815260206004820152601c60248201527f536f7572636520616464726573732063616e2774206265207a65726f000000006044820152606490fd5b15610d7057565b60405162461bcd60e51b815260206004820152601c60248201527f537761702070617468206c656e677468206d757374206265203e2031000000006044820152606490fd5b680100000000000000008211610bda57805491808255828110610dd757505050565b600091600052602060002092830192015b828110610df457505050565b818155600101610de8565b90816020910312610bb957518015158103610bb95790565b9081548082526020809201926000526020600020916000905b828210610e3e575050505090565b83546001600160a01b031685529384019360019384019390910190610e30565b60016060610e869360ff8454818116835260081c166020820152816040820152019101610e17565b90565b6001600160a01b039091168152604060208201819052610e8692910190610e5e565b805115610eb85760200190565b634e487b7160e01b600052603260045260246000fd5b8051821015610eb85760209160051b010190565b6020908181840312610bb95780519067ffffffffffffffff8211610bb957019180601f84011215610bb9578251610f1881610c12565b93610f266040519586610bf0565b818552838086019260051b820101928311610bb9578301905b828210610f4d575050505090565b81518152908301908301610f3f565b9290801580159061110d575b156110c857821561100c5750610fc260018060a01b0393846001541660009586921682526002602052600160408320019060405180809581946307c0329d60e21b8352896004840152604060248401526044830190610e17565b03915afa9081156110015784610fe193949592610fe6575b5050610eab565b519190565b610ffa92503d8091833e61097d8183610bf0565b3880610fda565b6040513d86823e3d90fd5b9290915061105e60018060a01b03918260015416600093849216825260026020526001604083200190604051808095819463d06ca61f60e01b83528a6004840152604060248401526044830190610e17565b03915afa9081156110bd5782916110a3575b50805160001981019290831161108f57509061108b91610ece565b5190565b634e487b7160e01b81526011600452602490fd5b6110b791503d8084833e61097d8183610bf0565b38611070565b6040513d84823e3d90fd5b60405162461bcd60e51b815260206004820152601d60248201527f7265717569726520616d6f756e74496e204f5220616d6f756e744f75740000006044820152606490fd5b50821515610f68565b6000546001600160a01b0316330361112a57565b60405163118cdaa760e01b8152336004820152602490fd5b90611169575080511561115757805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158061119c575b61117a575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561117256fea2646970667358221220f5447b3af0de9677f47a73a74267c21dc80af58db91f7e3932d0f2f0dfd19b0e64736f6c634300081600330000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
|
6040608081526004908136101561001557600080fd5b600091823560e01c80631b985e5c14610a1257806331a20611146106195780633ee70896146105e157806348a76f4b14610516578063715018a6146104b957806384ba316d1461041a57806386e306b5146103d55780638da5cb5b146103ad578063908bb2ae1461028d578063959eeb0414610165578063a7c6402c146101385763f2fde38b146100a557600080fd5b34610134576020366003190112610134576100be610ba3565b906100c7611116565b6001600160a01b0391821692831561011e575050600054826bffffffffffffffffffffffff60a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8280fd5b50503461016157816003193601126101615760015490516001600160a01b039091168152602090f35b5080fd5b5090346101345761017536610c2a565b91909294610181611116565b6001600160a01b038681169390610199851515610d1d565b600180946101a982855111610d69565b60ff8951916101b783610bbe565b16815260209760ff89830191168152898201948552878c526002895260ff8a8d2092511661ff008354925160081b169161ffff19161717815501915180519367ffffffffffffffff851161027a575086906102128585610db5565b0191895285892090895b848110610267578a8a7f5567c94ea5180f8b49121d2bfac889dfb6737f211f691643f28ff8352d78111b6102618c60028d8d8752528085209051918291339583610e89565b0390a280f35b835182168382015592870192850161021c565b634e487b7160e01b8b526041905260248afd5b5090346101345760203660031901126101345781356001600160a01b0381811693918490036103a9576102be611116565b8315610366576001549081169182851461031557506001600160a01b03191683176001558151928352602083015233917f2f963642a56f2e696ba7f74fab40cc248c374f3f3e463b59294b2adb9a01e6c39190a280f35b608490602085519162461bcd60e51b8352820152602560248201527f4d75737420626520646966666572656e742066726f6d2063757272656e74207260448201526437baba32b960d91b6064820152fd5b506020606492519162461bcd60e51b8352820152601c60248201527f526f7574657220616464726573732063616e2774206265207a65726f000000006044820152fd5b8480fd5b505034610161578160031936011261016157905490516001600160a01b039091168152602090f35b505034610161576020366003190112610161579081906001600160a01b036103fb610ba3565b1681526002602052205460ff825191818116835260081c166020820152f35b50503461016157602036600319011261016157610435610ba3565b61043d611116565b6001600160a01b0316808352600260205281832083815560019081018054600082559293929081610499575b505050519081527fcb77b0a22052fb1b991edffd88b74e8ab29106953e561907e692a299fdf28d4260203392a280f35b6000526020600020908101905b81811015610469576000815582016104a6565b83346105135780600319360112610513576104d2611116565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b5050346101615760209182600319360112610513576001926001600160a01b03919082610541610ba3565b1690818352600281528483209385519561055a87610bbe565b60ff80875498818a168152818682019a60081c168a5261058b8b996105848651809e819301610e17565b038c610bf0565b8a8482015251169751169080519760808901958952848901528701526080606087015286518093528160a08701970193905b8382106105ca5786880387f35b8451811688529682019693820193908501906105bd565b828434610513576060366003190112610513575061060d610600610ba3565b6044359060243590610f5c565b82519182526020820152f35b50903461013457606036600319011261013457610634610ba3565b6001600160a01b039360249081358681169190829003610513576044803593838352602097600289526001998a8986200154156109d25786158015906109cb575b1561098b576106b585828d541688825260028d528d8c832001908c8b81519586948593849363d06ca61f60e01b85528b8501528b8401528b830190610e17565b03915afa9081156108d7578691610969575b50805160001981019190821161095757906106e191610ece565b5193895191808c84019a6323b872dd60e01b8c5216998a8685015230838501528960648501526064845260a084019367ffffffffffffffff9481811086821117610945578d52518891829190828c5af13d15610939573d8481116109275761076b918e918e519061075b84601f19601f8401160183610bf0565b81528a81933d92013e5b8a611142565b8051908d821515928361090e575b5050506108f7578c54169087875260028c528c8b88200160784201918242116108e557833b156108e157928a89878f956107da8b9660a08e9b9a869a519c8d9a8b998a98635c11d79560e01b8a5289015287015285015260a4840190610e17565b90336064840152608483015203925af180156108d7576108b3575b50508751996108038b610bbe565b60028b5288368b8d0137866108178c610eab565b528a5111156108a05750509161088a86809695937ff8248d1f1434f4df07d44fa1efb30943baa8b22bc99dc3c991f1e3a8b1022b469561089c998c015283815260028a5220926108778751948594855260808b8601526080850190610e5e565b9087840152828103606084015289610ce9565b0390a251928284938452830190610ce9565b0390f35b603290634e487b7160e01b600052526000fd5b81959295116108c65788529238806107f5565b50634e487b7160e01b815260418452fd5b8a513d88823e3d90fd5b8880fd5b634e487b7160e01b8952601186528689fd5b50508851635274afe760e01b815291820186905250fd5b61091e9350820181019101610dff565b15388d81610779565b634e487b7160e01b8952604186528689fd5b61076b90606090610765565b634e487b7160e01b8a5260418752878afd5b634e487b7160e01b8752601184528487fd5b61098591503d8088833e61097d8183610bf0565b810190610ee2565b386106c7565b507f7265717569726520616d6f756e74496e204f5220616d6f756e744f757400000083601d6064948c8c519562461bcd60e51b8752860152840152820152fd5b5084610675565b507f546869732063757272656e6379206973206e6f7420616c6c6f7765640000000083601c6064948c8c519562461bcd60e51b8752860152840152820152fd5b50903461013457610a2236610c2a565b91610a2f95919395611116565b6001600160a01b0386811693909190610a49851515610d1d565b60018092610a5982845111610d69565b60ff895191610a6783610bbe565b16815260209760ff89830191168152898201938452878c526002895260ff8a8d2092511661ff008354925160081b169161ffff1916171781550190519081519167ffffffffffffffff8311610b90578790610ac28484610db5565b01908a52868a208a5b838110610b7d5750505050506001541684519163095ea7b360e01b83528201526000196024820152828160448189865af18015610b7357927f82826bb7dc9a26d2346c3ebc533704c20400de4b6553f76a5846b453305d59d2949260029261026195610b46575b508752528085209051918291339583610e89565b610b6590833d8511610b6c575b610b5d8183610bf0565b810190610dff565b5038610b32565b503d610b53565b84513d88823e3d90fd5b8251861682820155918801918401610acb565b634e487b7160e01b8b526041865260248bfd5b600435906001600160a01b0382168203610bb957565b600080fd5b6060810190811067ffffffffffffffff821117610bda57604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff821117610bda57604052565b67ffffffffffffffff8111610bda5760051b60200190565b6080600319820112610bb9576001600160a01b03906004358281168103610bb9579260243560ff81168103610bb9579260443560ff81168103610bb957926064359067ffffffffffffffff8211610bb95780602383011215610bb957816004013592610c9584610c12565b93610ca36040519586610bf0565b8085526020936024602087019260051b820101938411610bb957602401905b838210610cd157505050505090565b81358381168103610bb9578152908401908401610cc2565b90815180825260208080930193019160005b828110610d09575050505090565b835185529381019392810192600101610cfb565b15610d2457565b60405162461bcd60e51b815260206004820152601c60248201527f536f7572636520616464726573732063616e2774206265207a65726f000000006044820152606490fd5b15610d7057565b60405162461bcd60e51b815260206004820152601c60248201527f537761702070617468206c656e677468206d757374206265203e2031000000006044820152606490fd5b680100000000000000008211610bda57805491808255828110610dd757505050565b600091600052602060002092830192015b828110610df457505050565b818155600101610de8565b90816020910312610bb957518015158103610bb95790565b9081548082526020809201926000526020600020916000905b828210610e3e575050505090565b83546001600160a01b031685529384019360019384019390910190610e30565b60016060610e869360ff8454818116835260081c166020820152816040820152019101610e17565b90565b6001600160a01b039091168152604060208201819052610e8692910190610e5e565b805115610eb85760200190565b634e487b7160e01b600052603260045260246000fd5b8051821015610eb85760209160051b010190565b6020908181840312610bb95780519067ffffffffffffffff8211610bb957019180601f84011215610bb9578251610f1881610c12565b93610f266040519586610bf0565b818552838086019260051b820101928311610bb9578301905b828210610f4d575050505090565b81518152908301908301610f3f565b9290801580159061110d575b156110c857821561100c5750610fc260018060a01b0393846001541660009586921682526002602052600160408320019060405180809581946307c0329d60e21b8352896004840152604060248401526044830190610e17565b03915afa9081156110015784610fe193949592610fe6575b5050610eab565b519190565b610ffa92503d8091833e61097d8183610bf0565b3880610fda565b6040513d86823e3d90fd5b9290915061105e60018060a01b03918260015416600093849216825260026020526001604083200190604051808095819463d06ca61f60e01b83528a6004840152604060248401526044830190610e17565b03915afa9081156110bd5782916110a3575b50805160001981019290831161108f57509061108b91610ece565b5190565b634e487b7160e01b81526011600452602490fd5b6110b791503d8084833e61097d8183610bf0565b38611070565b6040513d84823e3d90fd5b60405162461bcd60e51b815260206004820152601d60248201527f7265717569726520616d6f756e74496e204f5220616d6f756e744f75740000006044820152606490fd5b50821515610f68565b6000546001600160a01b0316330361112a57565b60405163118cdaa760e01b8152336004820152602490fd5b90611169575080511561115757805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158061119c575b61117a575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561117256fea2646970667358221220f5447b3af0de9677f47a73a74267c21dc80af58db91f7e3932d0f2f0dfd19b0e64736f6c63430008160033
|
{{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\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.1) (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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"
},
"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol": {
"content": "pragma solidity >=0.6.2;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n"
},
"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol": {
"content": "pragma solidity >=0.6.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n"
},
"contracts/SaleStrategy/Converter/UniswapV2Swapper.sol": {
"content": "//SPDX-License-Identifier: MPL-2.0\npragma solidity ^0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Context.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\";\n\ncontract UniswapV2Swapper is Context, Ownable {\n using SafeERC20 for IERC20;\n\n IUniswapV2Router02 public uniswapV2Router02;\n\n struct AllowedCurrency {\n uint8 sourceDecimals;\n uint8 destinationDecimals;\n address[] uniswapV2SwapPath;\n }\n\n mapping(address => AllowedCurrency) public allowedCurrencies;\n\n /* Events */\n event ExecutedConversion(\n address indexed payer,\n address sourceCurrency, \n AllowedCurrency currencyDetails, \n uint256 amountIn,\n uint[] amounts\n );\n\n event UpdatedAllowedCurrency(\n address indexed from,\n address sourceCurrency, \n AllowedCurrency currencyDetails\n );\n\n event AddedAllowedCurrency( \n address indexed from,\n address sourceCurrency, \n AllowedCurrency currencyDetails\n );\n\n event RemovedAllowedCurrency( \n address indexed from,\n address sourceCurrency\n );\n\n event UpdatedUniswapRouter( \n address indexed from,\n address newRouter,\n address oldRouter\n );\n\n constructor( \n IUniswapV2Router02 _uniswapV2Router02\n ) Ownable(_msgSender()) {\n uniswapV2Router02 = _uniswapV2Router02;\n }\n\n function executeConversion( \n address _payer, \n address _sourceCurrency, \n uint256 _amountIn\n ) external returns (uint[] memory) {\n require(allowedCurrencies[_sourceCurrency].uniswapV2SwapPath.length > 0, \"This currency is not allowed\");\n\n // Get a quote using Router02 in order to prevent pricing errors\n (uint256 amountIn, uint256 amountOut) = getQuote(\n _sourceCurrency, \n _amountIn,\n 0\n );\n\n swapERC20Tokens(\n _payer,\n _sourceCurrency, \n amountIn,\n amountOut\n );\n\n uint[] memory amounts = new uint[](2);\n amounts[0] = uint(amountIn);\n amounts[1] = uint(amountOut);\n\n emit ExecutedConversion(\n _payer,\n _sourceCurrency, \n allowedCurrencies[_sourceCurrency], \n _amountIn,\n amounts\n );\n\n return amounts;\n }\n\n function swapERC20Tokens(\n address _payer,\n address _sourceCurrency, \n uint256 _amountIn,\n uint256 _minAmountOut\n ) internal {\n IERC20(_sourceCurrency).safeTransferFrom(address(_payer), address(this), _amountIn);\n\n uniswapV2Router02.swapExactTokensForTokensSupportingFeeOnTransferTokens(\n _amountIn,\n _minAmountOut,\n allowedCurrencies[_sourceCurrency].uniswapV2SwapPath,\n _msgSender(),\n block.timestamp + 120\n );\n\n }\n\n function getQuote(\n address _sourceCurrency, \n uint256 _amountIn,\n uint256 _amountOut \n ) public view returns (uint256, uint256) {\n require(_amountIn > 0 || _amountOut > 0, \"require amountIn OR amountOut\");\n\n if(_amountOut > 0) {\n uint256[] memory amountsIn = uniswapV2Router02.getAmountsIn(_amountOut, allowedCurrencies[_sourceCurrency].uniswapV2SwapPath);\n return (amountsIn[0], _amountOut);\n } else {\n uint256[] memory amountsOut = uniswapV2Router02.getAmountsOut(_amountIn, allowedCurrencies[_sourceCurrency].uniswapV2SwapPath);\n return ( _amountIn, amountsOut[amountsOut.length - 1]);\n }\n\n }\n\n function viewAllowedCurrency(address _sourceCurrency) public view returns (address, uint8, uint8, address[] memory) {\n AllowedCurrency memory currency = allowedCurrencies[_sourceCurrency];\n return (_sourceCurrency, currency.sourceDecimals, currency.destinationDecimals, currency.uniswapV2SwapPath);\n }\n\n function changeAllowedCurrency( \n address _sourceCurrency,\n uint8 _sourceDecimals,\n uint8 _destinationDecimals,\n address[] memory _uniswapV2SwapPath\n ) external onlyOwner {\n require(_sourceCurrency != address(0), \"Source address can't be zero\");\n require(_uniswapV2SwapPath.length > 1, \"Swap path length must be > 1\");\n\n allowedCurrencies[_sourceCurrency] = AllowedCurrency({\n sourceDecimals: _sourceDecimals,\n destinationDecimals: _destinationDecimals,\n uniswapV2SwapPath: _uniswapV2SwapPath\n });\n\n emit UpdatedAllowedCurrency(\n _msgSender(),\n _sourceCurrency,\n allowedCurrencies[_sourceCurrency]\n );\n }\n\n function addAllowedCurrency( \n address _sourceCurrency,\n uint8 _sourceDecimals,\n uint8 _destinationDecimals,\n address[] memory _uniswapV2SwapPath\n ) external onlyOwner {\n require(_sourceCurrency != address(0), \"Source address can't be zero\");\n require(_uniswapV2SwapPath.length > 1, \"Swap path length must be > 1\");\n\n allowedCurrencies[_sourceCurrency] = AllowedCurrency({\n sourceDecimals: _sourceDecimals,\n destinationDecimals: _destinationDecimals,\n uniswapV2SwapPath: _uniswapV2SwapPath\n });\n\n IERC20(_sourceCurrency).approve(address(uniswapV2Router02), type(uint256).max);\n\n emit AddedAllowedCurrency(\n _msgSender(),\n _sourceCurrency,\n allowedCurrencies[_sourceCurrency]\n );\n }\n\n function removeAllowedCurrency(address _sourceCurrency) external onlyOwner {\n delete allowedCurrencies[_sourceCurrency];\n\n emit RemovedAllowedCurrency( \n _msgSender(),\n _sourceCurrency\n );\n }\n\n function updateUniswapRouter( \n IUniswapV2Router02 _uniswapV2Router02\n ) external onlyOwner {\n require(address(_uniswapV2Router02) != address(0), \"Router address can't be zero\");\n require(address(_uniswapV2Router02) != address(uniswapV2Router02), \"Must be different from current router\");\n\n address oldRouter = address(uniswapV2Router02);\n uniswapV2Router02 = _uniswapV2Router02;\n\n emit UpdatedUniswapRouter( \n _msgSender(),\n address(_uniswapV2Router02),\n oldRouter\n );\n }\n\n}\n"
}
},
"settings": {
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}
}}
|
1 | 20,290,244 |
dffc7567096f72d104bbf39895aa6a441029e9c11b979ffe87de4d2d3ea7c529
|
085f1310bc181d4119ad68eab17f3222f7d08020ec0e72210ea79d6f86ccd80c
|
849a02be4c2ec8bbd06052c5a0cd51147994ad96
|
39c40c8f040cf363fa3cc6ed379dced87f318c36
|
77817cc9ae804e9c8ec38ce0e3f070d5f4e5a420
|
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
| ||
1 | 20,290,245 |
d717247d4dbd757c9069882edd7b4d073c6fd8eac319b0f28c96f30968848193
|
b4318fdda0ef6fe4a5a9163ee6e0ab1c2fba8067d76b23645874915d35a7d4d5
|
00e8ac37857d723c8212a3ad7c5380ea78ffa067
|
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
|
7cab546b5cd82bfbd76262c0120cc7cc6d3b6816
|
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,245 |
d717247d4dbd757c9069882edd7b4d073c6fd8eac319b0f28c96f30968848193
|
379611422a018324a96fcae353b69c427f41e0be910c9a8c7e95aefdd0c5caa9
|
0000db5c8b030ae20308ac975898e09741e70000
|
ed0e416e0feea5b484ba5c95d375545ac2b60572
|
fe62e7dbdf1b077aba70cc658988adb951027f18
|
608060405234801561001057600080fd5b50604051610a1a380380610a1a8339818101604052810190610032919061011c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550326000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610149565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100e9826100be565b9050919050565b6100f9816100de565b811461010457600080fd5b50565b600081519050610116816100f0565b92915050565b600060208284031215610132576101316100b9565b5b600061014084828501610107565b91505092915050565b6108c2806101586000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033000000000000000000000000000037bb05b2cef17c6469f4bcdb198826ce0000
|
608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033
| |
1 | 20,290,245 |
d717247d4dbd757c9069882edd7b4d073c6fd8eac319b0f28c96f30968848193
|
647d965045e9885de9c02f55dc7326978e0b25fe2ddb0df3c3177709db864c93
|
849a02be4c2ec8bbd06052c5a0cd51147994ad96
|
39c40c8f040cf363fa3cc6ed379dced87f318c36
|
d493e3398322a707590a3980761730e93d52fa85
|
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
| ||
1 | 20,290,245 |
d717247d4dbd757c9069882edd7b4d073c6fd8eac319b0f28c96f30968848193
|
edb97f280915825b790c66f10c90faba350a18473f3f852f51aed67b0f947038
|
617eb5daaabb433f97c741c5b09a9083b88ba0d7
|
617eb5daaabb433f97c741c5b09a9083b88ba0d7
|
f6f8e77c402221a66916995b2af187377aca8a00
|
6080604052348015600f57600080fd5b506109ab8061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806322d06aea14610030575b600080fd5b61004361003e36600461068b565b610045565b005b6000808673ffffffffffffffffffffffffffffffffffffffff16636bb1ee6160e01b86868660405160240161007c939291906107b2565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516101059190610818565b6000604051808303816000865af19150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b50602081015191935091507fffffffff0000000000000000000000000000000000000000000000000000000081167f9ab1818000000000000000000000000000000000000000000000000000000000146101d857816040517faf5a25c60000000000000000000000000000000000000000000000000000000081526004016101cf9190610834565b60405180910390fd5b6000806101f38460048087516101ee919061087d565b6103ce565b8060200190518101906102069190610896565b915091508873ffffffffffffffffffffffffffffffffffffffff16638999ae2960e01b838360405160240161023c929190610919565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516102c59190610818565b6000604051808303816000865af19150503d8060008114610302576040519150601f19603f3d011682016040523d82523d6000602084013e610307565b606091505b506020810151919650945092507fffffffff0000000000000000000000000000000000000000000000000000000083167f189152c3000000000000000000000000000000000000000000000000000000001461039157836040517fd76e54c40000000000000000000000000000000000000000000000000000000081526004016101cf9190610834565b60248401516040517f284f3b430000000000000000000000000000000000000000000000000000000081526101cf9084908390859060040161093a565b6060816103dc81601f610962565b1015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f7700000000000000000000000000000000000060448201526064016101cf565b61044e8284610962565b845110156104b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e647300000000000000000000000000000060448201526064016101cf565b6060821580156104d7576040519150600082526020820160405261053f565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156105105780518352602092830192016104f8565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056c57600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156105e7576105e7610571565b604052919050565b600067ffffffffffffffff82111561060957610609610571565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261064657600080fd5b8135610659610654826105ef565b6105a0565b81815284602083860101111561066e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000608086880312156106a357600080fd5b6106ac86610548565b94506106ba60208701610548565b9350604086013567ffffffffffffffff808211156106d757600080fd5b818801915088601f8301126106eb57600080fd5b8135818111156106fa57600080fd5b89602082850101111561070c57600080fd5b60208301955080945050606088013591508082111561072a57600080fd5b5061073788828901610635565b9150509295509295909350565b60005b8381101561075f578181015183820152602001610747565b50506000910152565b60008151808452610780816020860160208601610744565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b604081528260408201528284606083013760006060848301015260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501168201606083820301602084015261080e6060820185610768565b9695505050505050565b6000825161082a818460208701610744565b9190910192915050565b6020815260006108476020830184610768565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156108905761089061084e565b92915050565b600080604083850312156108a957600080fd5b82519150602083015167ffffffffffffffff8111156108c757600080fd5b8301601f810185136108d857600080fd5b80516108e6610654826105ef565b8181528660208385010111156108fb57600080fd5b61090c826020830160208601610744565b8093505050509250929050565b8281526040602082015260006109326040830184610768565b949350505050565b8381528260208201526060604082015260006109596060830184610768565b95945050505050565b808201808211156108905761089061084e56fea26469706673582212200a10f4f84c7233ee43bcf3e5228eeead0661872c4773a39113f4a60916bd65b064736f6c63430008190033
|
608060405234801561001057600080fd5b506004361061002b5760003560e01c806322d06aea14610030575b600080fd5b61004361003e36600461068b565b610045565b005b6000808673ffffffffffffffffffffffffffffffffffffffff16636bb1ee6160e01b86868660405160240161007c939291906107b2565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516101059190610818565b6000604051808303816000865af19150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b50602081015191935091507fffffffff0000000000000000000000000000000000000000000000000000000081167f9ab1818000000000000000000000000000000000000000000000000000000000146101d857816040517faf5a25c60000000000000000000000000000000000000000000000000000000081526004016101cf9190610834565b60405180910390fd5b6000806101f38460048087516101ee919061087d565b6103ce565b8060200190518101906102069190610896565b915091508873ffffffffffffffffffffffffffffffffffffffff16638999ae2960e01b838360405160240161023c929190610919565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516102c59190610818565b6000604051808303816000865af19150503d8060008114610302576040519150601f19603f3d011682016040523d82523d6000602084013e610307565b606091505b506020810151919650945092507fffffffff0000000000000000000000000000000000000000000000000000000083167f189152c3000000000000000000000000000000000000000000000000000000001461039157836040517fd76e54c40000000000000000000000000000000000000000000000000000000081526004016101cf9190610834565b60248401516040517f284f3b430000000000000000000000000000000000000000000000000000000081526101cf9084908390859060040161093a565b6060816103dc81601f610962565b1015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f7700000000000000000000000000000000000060448201526064016101cf565b61044e8284610962565b845110156104b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e647300000000000000000000000000000060448201526064016101cf565b6060821580156104d7576040519150600082526020820160405261053f565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156105105780518352602092830192016104f8565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461056c57600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156105e7576105e7610571565b604052919050565b600067ffffffffffffffff82111561060957610609610571565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f83011261064657600080fd5b8135610659610654826105ef565b6105a0565b81815284602083860101111561066e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000608086880312156106a357600080fd5b6106ac86610548565b94506106ba60208701610548565b9350604086013567ffffffffffffffff808211156106d757600080fd5b818801915088601f8301126106eb57600080fd5b8135818111156106fa57600080fd5b89602082850101111561070c57600080fd5b60208301955080945050606088013591508082111561072a57600080fd5b5061073788828901610635565b9150509295509295909350565b60005b8381101561075f578181015183820152602001610747565b50506000910152565b60008151808452610780816020860160208601610744565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b604081528260408201528284606083013760006060848301015260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501168201606083820301602084015261080e6060820185610768565b9695505050505050565b6000825161082a818460208701610744565b9190910192915050565b6020815260006108476020830184610768565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156108905761089061084e565b92915050565b600080604083850312156108a957600080fd5b82519150602083015167ffffffffffffffff8111156108c757600080fd5b8301601f810185136108d857600080fd5b80516108e6610654826105ef565b8181528660208385010111156108fb57600080fd5b61090c826020830160208601610744565b8093505050509250929050565b8281526040602082015260006109326040830184610768565b949350505050565b8381528260208201526060604082015260006109596060830184610768565b95945050505050565b808201808211156108905761089061084e56fea26469706673582212200a10f4f84c7233ee43bcf3e5228eeead0661872c4773a39113f4a60916bd65b064736f6c63430008190033
| |
1 | 20,290,246 |
dbfb7e70045f780b6576e036f5d95ae3caf658bb519d64fe488d607ee7d20f95
|
7d647debe393f76d0ca7dd72e18dd05ad81ffd879c1912150f7079f6c413ffa6
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
6aa5e104b44c231468c2ac5cebe727cdbca438c7
|
608060405234801561001057600080fd5b50610587806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80631555fe6b14610030575b600080fd5b61004361003e366004610317565b610059565b604051610050919061036e565b60405180910390f35b6060600061006a6040840184610479565b600081811061007b5761007b6104e8565b6100919260206040909202019081019150610517565b905060008360200135905061016560405180606001604052806100b38561016e565b73ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001836040516024016100e891815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fc5ebeaec000000000000000000000000000000000000000000000000000000001790529052610214565b95945050505050565b600080610179610280565b6040517fbbe4f6db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301529192509082169063bbe4f6db90602401602060405180830381865afa1580156101e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020d9190610534565b9392505050565b604080516001808252818301909252606091816020015b6040805160608082018352600080835260208301529181019190915281526020019060019003908161022b5790505090508181600081518110610270576102706104e8565b6020026020010181905250919050565b7fe26698d2bdb6483c27c4bb03b63ce41a68f1e73346c654a061e8af0459744f875473ffffffffffffffffffffffffffffffffffffffff16806102ef576040517f972777d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90565b73ffffffffffffffffffffffffffffffffffffffff8116811461031457600080fd5b50565b6000806040838503121561032a57600080fd5b8235610335816102f2565b9150602083013567ffffffffffffffff81111561035157600080fd5b83016060818603121561036357600080fd5b809150509250929050565b600060208083018184528085518083526040925060408601915060408160051b8701018488016000805b8481101561046a578984037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00186528251805173ffffffffffffffffffffffffffffffffffffffff16855288810151898601528701516060888601819052815190860181905283905b8082101561041f578282018b015187830160800152908a0190610401565b8681016080908101869052988b0198601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690960190950194505091870191600101610398565b50919998505050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126104ae57600080fd5b83018035915067ffffffffffffffff8211156104c957600080fd5b6020019150600681901b36038213156104e157600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561052957600080fd5b813561020d816102f2565b60006020828403121561054657600080fd5b815161020d816102f256fea26469706673582212206e571054a3c8acef2e917056b9ee1320fcb086a632d3b0ad5717d9c33947aeda64736f6c63430008160033
|
608060405234801561001057600080fd5b506004361061002b5760003560e01c80631555fe6b14610030575b600080fd5b61004361003e366004610317565b610059565b604051610050919061036e565b60405180910390f35b6060600061006a6040840184610479565b600081811061007b5761007b6104e8565b6100919260206040909202019081019150610517565b905060008360200135905061016560405180606001604052806100b38561016e565b73ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001836040516024016100e891815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fc5ebeaec000000000000000000000000000000000000000000000000000000001790529052610214565b95945050505050565b600080610179610280565b6040517fbbe4f6db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301529192509082169063bbe4f6db90602401602060405180830381865afa1580156101e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020d9190610534565b9392505050565b604080516001808252818301909252606091816020015b6040805160608082018352600080835260208301529181019190915281526020019060019003908161022b5790505090508181600081518110610270576102706104e8565b6020026020010181905250919050565b7fe26698d2bdb6483c27c4bb03b63ce41a68f1e73346c654a061e8af0459744f875473ffffffffffffffffffffffffffffffffffffffff16806102ef576040517f972777d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90565b73ffffffffffffffffffffffffffffffffffffffff8116811461031457600080fd5b50565b6000806040838503121561032a57600080fd5b8235610335816102f2565b9150602083013567ffffffffffffffff81111561035157600080fd5b83016060818603121561036357600080fd5b809150509250929050565b600060208083018184528085518083526040925060408601915060408160051b8701018488016000805b8481101561046a578984037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00186528251805173ffffffffffffffffffffffffffffffffffffffff16855288810151898601528701516060888601819052815190860181905283905b8082101561041f578282018b015187830160800152908a0190610401565b8681016080908101869052988b0198601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690960190950194505091870191600101610398565b50919998505050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126104ae57600080fd5b83018035915067ffffffffffffffff8211156104c957600080fd5b6020019150600681901b36038213156104e157600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561052957600080fd5b813561020d816102f2565b60006020828403121561054657600080fd5b815161020d816102f256fea26469706673582212206e571054a3c8acef2e917056b9ee1320fcb086a632d3b0ad5717d9c33947aeda64736f6c63430008160033
|
{{
"language": "Solidity",
"sources": {
"@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/interpreter/arkis/LiquidityPoolEvaluator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IDecreasePositionEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/index.sol\";\nimport {IPool} from \"contracts/interfaces/liquidityManagement/liquidityPool/IPool.sol\";\nimport {\n IPoolFactory\n} from \"contracts/interfaces/liquidityManagement/liquidityPool/IPoolFactory.sol\";\n\nimport {Config} from \"contracts/accountAbstraction/interpreter/libraries/Config.sol\";\nimport {Command} from \"contracts/libraries/CommandLibrary.sol\";\n\ncontract LiquidityPoolEvaluator is IDecreasePositionEvaluator {\n function evaluate(\n address,\n DecreasePositionRequest calldata _request\n ) external view override returns (Command[] memory) {\n address token = _request.minOutput[0].token;\n uint256 amount = _request.liquidity;\n\n return\n Command({\n target: getPool(token),\n value: 0,\n payload: abi.encodeCall(IPool.borrow, (amount))\n }).asArray();\n }\n\n function getPool(address _token) private view returns (address) {\n IPoolFactory pf = IPoolFactory(Config.getLiquidityPoolAddress());\n return pf.getPool(_token);\n }\n}\n"
},
"contracts/accountAbstraction/interpreter/libraries/Config.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Address} from \"contracts/libraries/Address.sol\";\n\nlibrary Config {\n using Address for bytes32;\n\n struct Storage {\n address marginEngine;\n address liquidityPool;\n address insuranceFund;\n }\n\n bytes32 private constant STORAGE_SLOT = keccak256(\"AssetmblySandbox's Config Slot V1\");\n\n error MarginAccountAddressNotFound();\n error LiquidityPoolAddressNotFound();\n error InsuranceFundAddressNotFound();\n\n function setModules(\n address _marginEngine,\n address _liquidityPool,\n address _insuranceFund\n ) internal returns (bool storageModified_) {\n if (_storage().marginEngine != _marginEngine) {\n _storage().marginEngine = _marginEngine;\n storageModified_ = true;\n }\n if (_storage().liquidityPool != _liquidityPool) {\n _storage().liquidityPool = _liquidityPool;\n storageModified_ = true;\n }\n if (_storage().insuranceFund != _insuranceFund) {\n _storage().insuranceFund = _insuranceFund;\n storageModified_ = true;\n }\n }\n\n function getMarginEngineAddress() internal view returns (address result_) {\n if ((result_ = _storage().marginEngine) == address(0))\n revert MarginAccountAddressNotFound();\n }\n\n function getLiquidityPoolAddress() internal view returns (address result_) {\n if ((result_ = _storage().liquidityPool) == address(0))\n revert LiquidityPoolAddressNotFound();\n }\n\n function getInsuranceFundAddress() internal view returns (address result_) {\n if ((result_ = _storage().insuranceFund) == address(0))\n revert InsuranceFundAddressNotFound();\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/compliance/IWhitelistingController.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @title Status\n * @notice Enum representing status of a record (e.g., token, protocol, operator)\n * used for operation validation.\n * @notice Validators must adhere to the following rules for different operations and contexts:\n * 1) For exchanges: `operator`, `pool`, and `input token` *MAY* be either supported or suspended, but the `output token` *MUST* be supported.\n * 2) For deposits: `operator`, `pool`, and every `token` in the `pool` *MUST* be supported.\n * 3) For withdrawals: `operator`, `pool`, and each `token` *MAY* be either supported or suspended.\n *\n * @dev **Note** that deposit denotes **all** ways of aquiring liquidity such\n * as token deposit, LP tokens stake, NFT mint etc.\n */\nenum Status {\n Undefined,\n Supported,\n Suspended\n}\n\n/**\n * @title WhitelistingAddressRecord\n * @notice A struct to store an address and its support status.\n * @dev This struct stores an address and its support status.\n * @dev `source`: The address to be stored.\n * @dev `supported`: Indicates whether the address is supported or not.\n */\nstruct WhitelistingAddressRecord {\n address source;\n bool supported;\n}\n\n/**\n * @title TokenPermission\n * @notice This enum represents different levels of permission for a token, including trading, collateral, leverage, and full access.\n * @dev `None`: Represents no permissions granted for the token.\n * @dev `TradeOnly`: Represents the lowest permission level where you can only trade the token.\n * @dev `Collateral`: Allows you to use the token as collateral.\n * @dev `Leverage`: Allows you to leverage the token.\n * @dev `FullAccess`: Represents the highest permission level where you have full access to trade, use as collateral, and leverage the token.\n */\nenum TokenPermission {\n None,\n TradeOnly,\n Collateral,\n Leverage,\n FullAccess\n}\n\n/**\n * @title WhitelistingTokenRecord\n * @notice This struct stores an address and its support status for whitelisting, collateral and leverage.\n * @dev `source`: The address of the token.\n * @dev `supported`: Whether the token can be received from a protocol trades.\n * @dev `permission`: Level of [`TokenPermission`](./enum.TokenPermission.html).\n */\nstruct WhitelistingTokenRecord {\n address source;\n bool supported;\n TokenPermission permission;\n}\n\n/**\n * @notice An error indicating that a token is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported token is used.\n * @dev `token`: The address of the unsupported token.\n */\nerror TokenIsNotSupported(address token);\n\n/**\n * @notice An error indicating that a token is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended token is used.\n * @dev `token`: The address of the suspended token.\n */\nerror TokenIsSuspended(address token);\n\n/**\n * @notice An error indicating that the token's permission level is insufficient for the requested action.\n * @dev This can be thrown at [`IWhitelistingController.enforceTokenHasPermission()`](./interface.IWhitelistingController.html#enforcetokenhaspermission)\n * @param token The address of the token that has insufficient permissions.\n * @param required The required permission level for the action.\n * @param actual The actual permission level of the token.\n */\nerror TokenLevelInsufficient(address token, TokenPermission required, TokenPermission actual);\n\n/**\n * @notice An error indicating that an operator is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported operator is used.\n * @dev `operator`: The address of the unsupported operator.\n */\nerror OperatorIsNotSupported(address operator);\n\n/**\n * @notice An error indicating that an operator is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended operator is used.\n * @dev `operator`: The address of the suspended operator.\n */\nerror OperatorIsSuspended(address operator);\n\n/**\n * @notice An error indicating that a protocol is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported protocol is used.\n * @dev `protocol`: The identification string of the unsupported protocol.\n */\nerror ProtocolIsNotSupported(string protocol);\n\n/**\n * @notice An error indicating that a protocol is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended protocol is used.\n * @dev `protocol`: The identification string of the unsupported protocol.\n */\nerror ProtocolIsSuspended(string protocol);\n\n/**\n * @title IWhitelistingController\n * @notice Interface for managing whitelisting of tokens, protocols, and operators.\n */\ninterface IWhitelistingController {\n /**\n * @dev Emitted when the support status of a protocol changes.\n * @dev `protocol`: The identification string of the protocol.\n * @dev `supported`: Whether the protocol is supported or not.\n */\n event ProtocolSupportChanged(string indexed protocol, bool supported);\n\n /**\n * @dev Emitted when the support status of a token changes.\n * @dev `token`: The address of the token.\n * @dev `supported`: Whether the token is supported or not.\n * @dev `permission`: Level of [`TokenPermission`](./enum.TokenPermission.html).\n */\n event TokenSupportChanged(address indexed token, bool supported, TokenPermission permission);\n\n /**\n * @dev Emitted when the support status of an operator changes for a specific protocol.\n * @dev `protocol`: The identification string of the protocol.\n * @dev `operator`: The address of the operator.\n * @dev `supported`: Whether the operator is supported or not.\n */\n event OperatorSupportChanged(string indexed protocol, address indexed operator, bool supported);\n\n /**\n * @notice Update the support status of multiple tokens.\n * @dev Emits a [`TokenSupportChanged()`](#tokensupportchanged) event for each token whose status changed.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if no token status changed.\n * @param _tokens An array of [`WhitelistingTokenRecord`](./struct.WhitelistingTokenRecord.html)\n * structs containing token addresses, support statuses and permissions.\n */\n function updateTokensSupport(WhitelistingTokenRecord[] calldata _tokens) external;\n\n /**\n * @notice Update the support status of a protocol.\n * @dev Emits a [`ProtocolSupportChanged()`](#protocolsupportchanged) event.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if protocol status is up to date.\n * @param _protocol The identification string of the protocol.\n * @param _adapterEvaluator The address of the adapter evaluator for the protocol.\n * @param _supported Whether the protocol is supported or not.\n */\n function updateProtocolSupport(\n string calldata _protocol,\n address _adapterEvaluator,\n bool _supported\n ) external;\n\n /**\n * @notice Update the support status of multiple operators for a specific protocol.\n * @dev Emits a [`OperatorSupportChanged()`](#operatorsupportchanged) event for each token whose status changed.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if no operator status changed.\n * @param _protocol The identification string of the protocol.\n * @param _operators An array of `WhitelistingAddressRecord` structs containing operator addresses and support statuses.\n */\n function updateOperatorsSupport(\n string calldata _protocol,\n WhitelistingAddressRecord[] calldata _operators\n ) external;\n\n /**\n * @notice Ensures that a token has the specified permission level.\n * @dev This check does not enforce exact match, but only that level is sufficient.\n * So if `permission` is TokenPermission.TradeOnly and the token has TokenPermission.Collateral\n * then it assumes that level is sufficient since Collateral level includes both\n * TradeOnly and Collateral levels.\n * @param token The address of the token to check for permission.\n * @param permission The required [`TokenPermission`](TokenPermission) to be enforced.\n */\n function enforceTokenHasPermission(address token, TokenPermission permission) external view;\n\n /**\n * @notice Returns the support status of a token as well as it's permissions.\n * @param _token The address of the token.\n * @return The [`Status`](./enum.Status.html)\n * of the token.\n * @return The [`TokenPermission`](./enum.TokenPermission.html)\n * of the token.\n */\n function getTokenSupport(address _token) external view returns (Status, TokenPermission);\n\n /**\n * @notice Returns the support status of a protocol.\n * @param _protocol The identification string of the protocol.\n * @return The [`Status`](./enum.Status.html)\n * of the protocol.\n */\n function getProtocolStatus(string calldata _protocol) external view returns (Status);\n\n /**\n * @notice Returns the address of the adapter evaluator for a protocol.\n * @param _protocol The identification string of the protocol.\n * @return The address of the adapter evaluator for the protocol.\n */\n function getProtocolEvaluator(string calldata _protocol) external view returns (address);\n\n /**\n * @notice Returns the support status of an operator for a specific protocol.\n * @param _operator The address of the operator.\n * @return operatorStatus_ The [`Status`](./enum.Status.html)\n * of the operator.\n * @return protocolStatus_ The [`Status`](./enum.Status.html)\n * of the protocol.\n */\n function getOperatorStatus(\n address _operator\n ) external view returns (Status operatorStatus_, Status protocolStatus_);\n}\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/ILiquidityPoolsRepository.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/* solhint-disable no-unused-import */\nimport {\n Status,\n TokenIsNotSupported\n} from \"contracts/interfaces/accountAbstraction/compliance/IWhitelistingController.sol\";\nimport {AlreadyUpToDate} from \"contracts/interfaces/base/CommonErrors.sol\";\n/* solhint-enable no-unused-import */\n\n/**\n * @notice Error indicating that the pool ID was not found.\n * @param encodedPool The encoded pool data that was searched for.\n */\nerror PoolIdNotFound(bytes encodedPool);\n\n/**\n * @notice Error indicating that the pool does not exist.\n * @param poolId The unique identifier of the pool that was searched for.\n */\nerror PoolIsNotSupported(uint256 poolId);\n\n/**\n * @notice Error indicating that the pool is suspended.\n * @param poolId The unique identifier of the pool that is suspended.\n */\nerror PoolIsSuspended(uint256 poolId);\n\n/**\n * @title ILiquidityPoolsRepository\n * @notice Interface for managing liquidity pools and their support status.\n */\ninterface ILiquidityPoolsRepository {\n /**\n * @notice Update the support status of a liquidity pool.\n * @param _encodedPool The encoded pool data.\n * @param _supported Whether the pool is supported or not.\n * @return poolId_ The unique identifier of the pool.\n * @dev Reverts with a [`PoolIdNotFound()`](/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol/error.PoolIdNotFound.html)\n * error if the pool does not exist.\n */\n function updatePoolSupport(\n bytes calldata _encodedPool,\n bool _supported\n ) external returns (uint256 poolId_);\n\n /**\n * @notice Get the status of a specific pool.\n * @param _poolId The unique identifier of the pool.\n * @return status The status of the pool.\n * @dev Reverts with a [`PoolIsNotSupported()`](/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol/error.PoolIsNotSupported.html)\n * error if the pool does not exist.\n */\n function getPoolStatus(uint256 _poolId) external returns (Status status);\n\n /**\n * @notice Get the unique identifier (pool ID) of a specific pool.\n * @param _encodedPool The encoded pool data.\n * @return poolId_ The unique identifier of the pool.\n * @dev Reverts with a [`PoolIsNotSupported()`](/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol/error.PoolIsNotSupported.html)\n * error if the pool does not exist.\n */\n function getPoolId(bytes calldata _encodedPool) external view returns (uint256 poolId_);\n}\n"
},
"contracts/interfaces/accountAbstraction/interpreter/adapters/index.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IDecreasePositionEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/IDecreasePositionEvaluator.sol\";\nimport {\n IExchangeEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/IExchangeEvaluator.sol\";\nimport {\n IIncreasePositionEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/IIncreasePositionEvaluator.sol\";\nimport {\n AlreadyUpToDate,\n ILiquidityPoolsRepository,\n PoolIdNotFound,\n PoolIsNotSupported,\n PoolIsSuspended,\n Status,\n TokenIsNotSupported\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol\";\nimport {\n PositionDescriptor\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/PositionDescriptor.sol\";\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/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/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/interfaces/liquidityManagement/liquidityPool/IPoolFactory.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @title IPoolFactory\n * @notice A factory contract for managing liquidity pools.\n */\ninterface IPoolFactory {\n /**\n * @notice Emitted from [`createPool()`](#createpool) when a pool is successfully created.\n * @dev `token` The address of the token associated with the pool.\n * @dev `pool` The address of the registered pool.\n */\n event PoolCreated(address indexed token, address indexed pool);\n\n /**\n * @notice Deploys a liquidity pool for the token.\n * @dev This function creates a new pool contract for the specified token with a given threshold and registers it's address.\n * @dev It can only be called by the owner; otherwise, it will throw an [`UnauthorizedAccount()`](#unauthorizedaccount) error.\n * @dev Throws a [`AddressAlreadyRegistered()`](#anchor) error, if a pool for the specified token is already exists.\n * @dev Emits a [`PoolCreated()`](#poolcreated) event on success.\n * @param borrower The address allowed to borrow from Pool\n * @param token The token address.\n * @param threshold The limit on the total amount of tokens that can be deposited into this pool.\n * @return pool The address of the newly created pool.\n */\n function createPool(\n address borrower,\n address token,\n uint256 threshold\n ) external returns (address pool);\n\n /**\n * @notice Sets the insurance fund for a specific liquidity pool.\n * @dev Allows setting once the address which will have repayer role in the pool.\n * If fund is already set, will revert with [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html) custom error.\n * @param pool The address of the pool.\n * @param fund The address to set as the fund for the pool.\n */\n function setFund(address pool, address fund) external;\n\n /**\n * @notice Triggers the suspended state for a pool when deposits are disabled.\n * @dev This function can only be called by the owner; otherwise, it reverts with an [`UnauthorizedAccount()`](#unauthorizedaccount) error.\n * @dev Throws a [`\"Pausable: paused\"`](#arcor) error if the pool is already in suspended mode (see [`isSuspended()`](#issuspended)).\n * @dev Emits a [`Paused(address account)`](#anchor) event on succes.\n * @param pool The address of the pool.\n */\n function suspendPool(address pool) external;\n\n /**\n * @notice Triggers the normal mode for a pool.\n * @dev This function can only be called by the owner; otherwise, it reverts with an [`UnauthorizedAccount()`](#unauthorizedaccount) error.\n * @dev Throws a [`\"Pausable: not paused\"`](#arcor) error if the pool is already not suspended mode (see [`isSuspended()`](#issuspended)).\n * @dev Emits a [`Unpaused(address account)`](#anchor) event on succes.\n * @param pool The address of the pool.\n */\n function unsuspendPool(address pool) external;\n\n /**\n * @notice Retrieves the pool address for the given token.\n * @dev Throws a [`AddressIsNotRegisteredUnderKey()`](#anchor) error if the fund doesn't exist.\n * @param token The address of the token.\n * @return pool The address of the pool.\n */\n function getPool(address token) external view returns (address pool);\n\n /**\n * @notice Checks whether a pool exists for the given token.\n * @param token The address of the token.\n * @return True if a pool exists, otherwise false.\n */\n function isPoolExist(address token) external view returns (bool);\n\n /**\n * @notice Checks whether a pool is in a suspended mode.\n * @param pool The address of the pool.\n * @return True if the pool is suspended, otherwise false.\n */\n function isSuspended(address pool) external view returns (bool);\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/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/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": {}
}
}}
|
1 | 20,290,246 |
dbfb7e70045f780b6576e036f5d95ae3caf658bb519d64fe488d607ee7d20f95
|
83970ab4a49225bf326e64fc15bceb4799d6096707eae2e2e06a1d517d0ace24
|
7164d86577722cfedbcb16d3f2f92325fc3467b8
|
612e2daddc89d91409e40f946f9f7cfe422e777e
|
330e3636e84811d80e91a37aa24e66131b5bcc1f
|
3d602d80600a3d3981f3363d3d373d3d3d363d73d3de35027a5c3dafae8f7a7d354eec22d4461cdd5af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73d3de35027a5c3dafae8f7a7d354eec22d4461cdd5af43d82803e903d91602b57fd5bf3
|
{{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-upgradeable-v5/access/Ownable2StepUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.20;\n\nimport {OwnableUpgradeable} from \"./OwnableUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is specified at deployment time in the constructor for `Ownable`. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step\n struct Ownable2StepStorage {\n address _pendingOwner;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Ownable2Step\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00;\n\n function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) {\n assembly {\n $.slot := Ownable2StepStorageLocation\n }\n }\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n function __Ownable2Step_init() internal onlyInitializing {\n }\n\n function __Ownable2Step_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n Ownable2StepStorage storage $ = _getOwnable2StepStorage();\n return $._pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n Ownable2StepStorage storage $ = _getOwnable2StepStorage();\n $._pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n Ownable2StepStorage storage $ = _getOwnable2StepStorage();\n delete $._pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n if (pendingOwner() != sender) {\n revert OwnableUnauthorizedAccount(sender);\n }\n _transferOwnership(sender);\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v5/access/OwnableUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n /// @custom:storage-location erc7201:openzeppelin.storage.Ownable\n struct OwnableStorage {\n address _owner;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Ownable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;\n\n function _getOwnableStorage() private pure returns (OwnableStorage storage $) {\n assembly {\n $.slot := OwnableStorageLocation\n }\n }\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n function __Ownable_init(address initialOwner) internal onlyInitializing {\n __Ownable_init_unchained(initialOwner);\n }\n\n function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n OwnableStorage storage $ = _getOwnableStorage();\n return $._owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n OwnableStorage storage $ = _getOwnableStorage();\n address oldOwner = $._owner;\n $._owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v5/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 = 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-upgradeable-v5/token/ERC721/ERC721Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {ContextUpgradeable} from \"../../utils/ContextUpgradeable.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {ERC165Upgradeable} from \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport {IERC721Errors} from \"@openzeppelin/contracts/interfaces/draft-IERC6093.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\nabstract contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721, IERC721Metadata, IERC721Errors {\n using Strings for uint256;\n\n /// @custom:storage-location erc7201:openzeppelin.storage.ERC721\n struct ERC721Storage {\n // Token name\n string _name;\n\n // Token symbol\n string _symbol;\n\n mapping(uint256 tokenId => address) _owners;\n\n mapping(address owner => uint256) _balances;\n\n mapping(uint256 tokenId => address) _tokenApprovals;\n\n mapping(address owner => mapping(address operator => bool)) _operatorApprovals;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ERC721\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant ERC721StorageLocation = 0x80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300;\n\n function _getERC721Storage() private pure returns (ERC721Storage storage $) {\n assembly {\n $.slot := ERC721StorageLocation\n }\n }\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n ERC721Storage storage $ = _getERC721Storage();\n $._name = name_;\n $._symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual returns (uint256) {\n ERC721Storage storage $ = _getERC721Storage();\n if (owner == address(0)) {\n revert ERC721InvalidOwner(address(0));\n }\n return $._balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual returns (address) {\n return _requireOwned(tokenId);\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual returns (string memory) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual returns (string memory) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual returns (string memory) {\n _requireOwned(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n _approve(to, tokenId, _msgSender());\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual returns (address) {\n _requireOwned(tokenId);\n\n return _getApproved(tokenId);\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n // Setting an \"auth\" arguments enables the `_isAuthorized` check which verifies that the token exists\n // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.\n address previousOwner = _update(to, tokenId, _msgSender());\n if (previousOwner != from) {\n revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n }\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {\n transferFrom(from, to, tokenId);\n _checkOnERC721Received(from, to, tokenId, data);\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n *\n * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the\n * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances\n * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by\n * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._owners[tokenId];\n }\n\n /**\n * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.\n */\n function _getApproved(uint256 tokenId) internal view virtual returns (address) {\n ERC721Storage storage $ = _getERC721Storage();\n return $._tokenApprovals[tokenId];\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in\n * particular (ignoring whether it is owned by `owner`).\n *\n * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this\n * assumption.\n */\n function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {\n return\n spender != address(0) &&\n (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.\n * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets\n * the `spender` for the specific `tokenId`.\n *\n * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this\n * assumption.\n */\n function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {\n if (!_isAuthorized(owner, spender, tokenId)) {\n if (owner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n } else {\n revert ERC721InsufficientApproval(spender, tokenId);\n }\n }\n }\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that\n * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.\n *\n * WARNING: Increasing an account's balance using this function tends to be paired with an override of the\n * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership\n * remain consistent with one another.\n */\n function _increaseBalance(address account, uint128 value) internal virtual {\n ERC721Storage storage $ = _getERC721Storage();\n unchecked {\n $._balances[account] += value;\n }\n }\n\n /**\n * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner\n * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.\n *\n * The `auth` argument is optional. If the value passed is non 0, then this function will check that\n * `auth` is either the owner of the token, or approved to operate on the token (by the owner).\n *\n * Emits a {Transfer} event.\n *\n * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.\n */\n function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {\n ERC721Storage storage $ = _getERC721Storage();\n address from = _ownerOf(tokenId);\n\n // Perform (optional) operator check\n if (auth != address(0)) {\n _checkAuthorized(from, auth, tokenId);\n }\n\n // Execute the update\n if (from != address(0)) {\n // Clear approval. No need to re-authorize or emit the Approval event\n _approve(address(0), tokenId, address(0), false);\n\n unchecked {\n $._balances[from] -= 1;\n }\n }\n\n if (to != address(0)) {\n unchecked {\n $._balances[to] += 1;\n }\n }\n\n $._owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n return from;\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n address previousOwner = _update(to, tokenId, address(0));\n if (previousOwner != address(0)) {\n revert ERC721InvalidSender(address(0));\n }\n }\n\n /**\n * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\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 _safeMint(address to, uint256 tokenId) internal {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n _checkOnERC721Received(address(0), to, tokenId, data);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal {\n address previousOwner = _update(address(0), tokenId, address(0));\n if (previousOwner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n }\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal {\n if (to == address(0)) {\n revert ERC721InvalidReceiver(address(0));\n }\n address previousOwner = _update(to, tokenId, address(0));\n if (previousOwner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n } else if (previousOwner != from) {\n revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n }\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients\n * are aware of the ERC721 standard to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is like {safeTransferFrom} in the sense that it invokes\n * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `tokenId` token must exist and be owned by `from`.\n * - `to` cannot be the zero address.\n * - `from` cannot be the zero address.\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 _safeTransfer(address from, address to, uint256 tokenId) internal {\n _safeTransfer(from, to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n _checkOnERC721Received(from, to, tokenId, data);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is\n * either the owner of the token, or approved to operate on all tokens held by this owner.\n *\n * Emits an {Approval} event.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address to, uint256 tokenId, address auth) internal {\n _approve(to, tokenId, auth, true);\n }\n\n /**\n * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not\n * emitted in the context of transfers.\n */\n function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {\n ERC721Storage storage $ = _getERC721Storage();\n // Avoid reading the owner unless necessary\n if (emitEvent || auth != address(0)) {\n address owner = _requireOwned(tokenId);\n\n // We do not use _isAuthorized because single-token approvals should not be able to call approve\n if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {\n revert ERC721InvalidApprover(auth);\n }\n\n if (emitEvent) {\n emit Approval(owner, to, tokenId);\n }\n }\n\n $._tokenApprovals[tokenId] = to;\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Requirements:\n * - operator can't be the address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n ERC721Storage storage $ = _getERC721Storage();\n if (operator == address(0)) {\n revert ERC721InvalidOperator(operator);\n }\n $._operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).\n * Returns the owner.\n *\n * Overrides to ownership logic should be done to {_ownerOf}.\n */\n function _requireOwned(uint256 tokenId) internal view returns (address) {\n address owner = _ownerOf(tokenId);\n if (owner == address(0)) {\n revert ERC721NonexistentToken(tokenId);\n }\n return owner;\n }\n\n /**\n * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the\n * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n */\n function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {\n if (to.code.length > 0) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n if (retval != IERC721Receiver.onERC721Received.selector) {\n revert ERC721InvalidReceiver(to);\n }\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert ERC721InvalidReceiver(to);\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v5/token/ERC721/extensions/ERC721BurnableUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ERC721Upgradeable} from \"../ERC721Upgradeable.sol\";\nimport {ContextUpgradeable} from \"../../../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be burned (destroyed).\n */\nabstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {\n function __ERC721Burnable_init() internal onlyInitializing {\n }\n\n function __ERC721Burnable_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n // Setting an \"auth\" arguments enables the `_isAuthorized` check which verifies that the token exists\n // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.\n _update(address(0), tokenId, _msgSender());\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v5/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\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 ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v5/utils/introspection/ERC165Upgradeable.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 \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165 {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\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-upgradeable/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 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://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 isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"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"
},
"@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"
},
"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../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`.\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\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\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 have been allowed to move this token by either {approve} or\n * {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\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(address from, address to, uint256 tokenId) 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 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 address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) 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 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"
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.20;\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\n * reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.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/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"
},
"@openzeppelin/contracts/utils/math/SignedMath.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n"
},
"@openzeppelin/contracts/utils/ShortStrings.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(32);\n /// @solidity memory-safe-assembly\n assembly {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 31) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n * {setWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n"
},
"@openzeppelin/contracts/utils/StorageSlot.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n"
},
"@openzeppelin/contracts/utils/Strings.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n uint8 private constant ADDRESS_LENGTH = 20;\n\n /**\n * @dev The `value` string doesn't fit in the specified `length`.\n */\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toStringSigned(int256 value) internal pure returns (string memory) {\n return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n uint256 localValue = value;\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n localValue >>= 4;\n }\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n * representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"
},
"contracts/collectionTemplates/NFTCollection.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.18;\n\n// solhint-disable max-line-length\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport { IERC721Metadata } from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport { INFTCollectionInitializer } from \"../interfaces/internal/collections/INFTCollectionInitializer.sol\";\n\nimport { AddressUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport { ERC721BurnableUpgradeable } from \"@openzeppelin/contracts-upgradeable-v5/token/ERC721/extensions/ERC721BurnableUpgradeable.sol\";\nimport { ERC721Upgradeable } from \"@openzeppelin/contracts-upgradeable-v5/token/ERC721/ERC721Upgradeable.sol\";\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable-v5/proxy/utils/Initializable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin/contracts-upgradeable-v5/access/Ownable2StepUpgradeable.sol\";\nimport \"../mixins/shared/Constants.sol\";\n\nimport { AddressLibrary } from \"../libraries/AddressLibrary.sol\";\nimport { CollectionRoyalties } from \"../mixins/collections/CollectionRoyalties.sol\";\nimport { NFTCollectionType } from \"../mixins/collections/NFTCollectionType.sol\";\nimport { SelfDestructibleCollection } from \"../mixins/collections/SelfDestructibleCollection.sol\";\nimport { SequentialMintCollection } from \"../mixins/collections/SequentialMintCollection.sol\";\nimport { StringsLibrary } from \"../libraries/StringsLibrary.sol\";\nimport { TokenLimitedCollection } from \"../mixins/collections/TokenLimitedCollection.sol\";\n// solhint-enable max-line-length\n\nerror NFTCollection_Max_Token_Id_Has_Already_Been_Minted(uint256 maxTokenId);\nerror NFTCollection_Token_CID_Already_Minted();\nerror NFTCollection_Token_Creator_Payment_Address_Required();\n\n/**\n * @title A collection of 1:1 NFTs by a single creator.\n * @notice A 10% royalty to the creator is included which may be split with collaborators on a per-NFT basis.\n * @author batu-inal & HardlyDifficult\n */\ncontract NFTCollection is\n INFTCollectionInitializer,\n Initializable,\n Ownable2StepUpgradeable,\n ERC721Upgradeable,\n ERC721BurnableUpgradeable,\n NFTCollectionType,\n SequentialMintCollection,\n TokenLimitedCollection,\n CollectionRoyalties,\n SelfDestructibleCollection\n{\n using AddressLibrary for address;\n using AddressUpgradeable for address;\n\n /**\n * @notice The baseURI to use for the tokenURI, if undefined then `ipfs://` is used.\n */\n string private baseURI_;\n\n /**\n * @notice Stores hashes minted to prevent duplicates.\n * @dev 0 means not yet minted, set to 1 when minted.\n * For why using uint is better than using bool here:\n * github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.7.3/contracts/security/ReentrancyGuard.sol#L23-L27\n */\n mapping(string => uint256) private cidToMinted;\n\n /**\n * @dev Stores an optional alternate address to receive creator revenue and royalty payments.\n * The target address may be a contract which could split or escrow payments.\n */\n mapping(uint256 => address payable) private tokenIdToCreatorPaymentAddress;\n\n /**\n * @dev Stores a CID for each NFT.\n */\n mapping(uint256 => string) private _tokenCIDs;\n\n /**\n * @notice Emitted when the owner changes the base URI to be used for NFTs in this collection.\n * @param baseURI The new base URI to use.\n */\n event BaseURIUpdated(string baseURI);\n\n /**\n * @notice Emitted when a new NFT is minted.\n * @param creator The address of the collection owner at this time this NFT was minted.\n * @param tokenId The tokenId of the newly minted NFT.\n * @param indexedTokenCID The CID of the newly minted NFT, indexed to enable watching for mint events by the tokenCID.\n * @param tokenCID The actual CID of the newly minted NFT.\n */\n event Minted(address indexed creator, uint256 indexed tokenId, string indexed indexedTokenCID, string tokenCID);\n\n /**\n * @notice Emitted when the payment address for creator royalties is set.\n * @param fromPaymentAddress The original address used for royalty payments.\n * @param toPaymentAddress The new address used for royalty payments.\n * @param tokenId The NFT which had the royalty payment address updated.\n */\n event TokenCreatorPaymentAddressSet(\n address indexed fromPaymentAddress,\n address indexed toPaymentAddress,\n uint256 indexed tokenId\n );\n\n /// @notice Initialize the template's immutable variables.\n constructor() NFTCollectionType(NFT_COLLECTION_TYPE) reinitializer(type(uint64).max) {\n __ERC721_init_unchained(\"NFT Collection Implementation\", \"NFT\");\n\n // Using reinitializer instead of _disableInitializers allows initializing of OZ mixins, describing the template.\n }\n\n /**\n * @notice Called by the contract factory on creation.\n * @param _creator The creator of this collection.\n * @param _name The collection's `name`.\n * @param _symbol The collection's `symbol`.\n */\n function initialize(address payable _creator, string calldata _name, string calldata _symbol) external initializer {\n __ERC721_init_unchained(_name, _symbol);\n __Ownable_init_unchained(_creator);\n // maxTokenId defaults to 0 but may be assigned later on.\n }\n\n /**\n * @notice Mint an NFT defined by its metadata path.\n * @dev This is only callable by the collection creator/owner.\n * @param tokenCID The CID for the metadata json of the NFT to mint.\n * @return tokenId The tokenId of the newly minted NFT.\n */\n function mint(string calldata tokenCID) external returns (uint256 tokenId) {\n tokenId = _mint(tokenCID);\n }\n\n /**\n * @notice Mint an NFT defined by its metadata path and approves the provided operator address.\n * @dev This is only callable by the collection creator/owner.\n * It can be used the first time they mint to save having to issue a separate approval\n * transaction before listing the NFT for sale.\n * @param tokenCID The CID for the metadata json of the NFT to mint.\n * @param operator The address to set as an approved operator for the creator's account.\n * @return tokenId The tokenId of the newly minted NFT.\n */\n function mintAndApprove(string calldata tokenCID, address operator) external returns (uint256 tokenId) {\n tokenId = _mint(tokenCID);\n setApprovalForAll(operator, true);\n }\n\n /**\n * @notice Mint an NFT defined by its metadata path and have creator revenue/royalties sent to an alternate address.\n * @dev This is only callable by the collection creator/owner.\n * @param tokenCID The CID for the metadata json of the NFT to mint.\n * @param tokenCreatorPaymentAddress The royalty recipient address to use for this NFT.\n * @return tokenId The tokenId of the newly minted NFT.\n */\n function mintWithCreatorPaymentAddress(\n string calldata tokenCID,\n address payable tokenCreatorPaymentAddress\n ) public returns (uint256 tokenId) {\n if (tokenCreatorPaymentAddress == address(0)) {\n revert NFTCollection_Token_Creator_Payment_Address_Required();\n }\n tokenId = _mint(tokenCID);\n tokenIdToCreatorPaymentAddress[tokenId] = tokenCreatorPaymentAddress;\n emit TokenCreatorPaymentAddressSet(address(0), tokenCreatorPaymentAddress, tokenId);\n }\n\n /**\n * @notice Mint an NFT defined by its metadata path and approves the provided operator address.\n * @dev This is only callable by the collection creator/owner.\n * It can be used the first time they mint to save having to issue a separate approval\n * transaction before listing the NFT for sale.\n * @param tokenCID The CID for the metadata json of the NFT to mint.\n * @param tokenCreatorPaymentAddress The royalty recipient address to use for this NFT.\n * @param operator The address to set as an approved operator for the creator's account.\n * @return tokenId The tokenId of the newly minted NFT.\n */\n function mintWithCreatorPaymentAddressAndApprove(\n string calldata tokenCID,\n address payable tokenCreatorPaymentAddress,\n address operator\n ) external returns (uint256 tokenId) {\n tokenId = mintWithCreatorPaymentAddress(tokenCID, tokenCreatorPaymentAddress);\n setApprovalForAll(operator, true);\n }\n\n /**\n * @notice Mint an NFT defined by its metadata path and have creator revenue/royalties sent to an alternate address\n * which is defined by a contract call, typically a proxy contract address representing the payment terms.\n * @dev This is only callable by the collection creator/owner.\n * @param tokenCID The CID for the metadata json of the NFT to mint.\n * @param paymentAddressFactory The contract to call which will return the address to use for payments.\n * @param paymentAddressCall The call details to send to the factory provided.\n * @return tokenId The tokenId of the newly minted NFT.\n */\n function mintWithCreatorPaymentFactory(\n string calldata tokenCID,\n address paymentAddressFactory,\n bytes calldata paymentAddressCall\n ) public returns (uint256 tokenId) {\n address payable tokenCreatorPaymentAddress = paymentAddressFactory.callAndReturnContractAddress(paymentAddressCall);\n tokenId = mintWithCreatorPaymentAddress(tokenCID, tokenCreatorPaymentAddress);\n }\n\n /**\n * @notice Mint an NFT defined by its metadata path and have creator revenue/royalties sent to an alternate address\n * which is defined by a contract call, typically a proxy contract address representing the payment terms.\n * @dev This is only callable by the collection creator/owner.\n * It can be used the first time they mint to save having to issue a separate approval\n * transaction before listing the NFT for sale.\n * @param tokenCID The CID for the metadata json of the NFT to mint.\n * @param paymentAddressFactory The contract to call which will return the address to use for payments.\n * @param paymentAddressCall The call details to send to the factory provided.\n * @param operator The address to set as an approved operator for the creator's account.\n * @return tokenId The tokenId of the newly minted NFT.\n */\n function mintWithCreatorPaymentFactoryAndApprove(\n string calldata tokenCID,\n address paymentAddressFactory,\n bytes calldata paymentAddressCall,\n address operator\n ) external returns (uint256 tokenId) {\n tokenId = mintWithCreatorPaymentFactory(tokenCID, paymentAddressFactory, paymentAddressCall);\n setApprovalForAll(operator, true);\n }\n\n /**\n * @notice Allows the collection creator to destroy this contract only if no NFTs have been minted yet or the minted\n * NFTs have been burned.\n */\n function selfDestruct() external onlyOwner {\n _selfDestruct();\n }\n\n /**\n * @notice Allows the owner to assign a baseURI to use for the tokenURI instead of the default `ipfs://`.\n * @param baseURIOverride The new base URI to use for all NFTs in this collection.\n */\n function updateBaseURI(string calldata baseURIOverride) external onlyOwner {\n baseURI_ = baseURIOverride;\n\n emit BaseURIUpdated(baseURIOverride);\n }\n\n /**\n * @notice Allows the owner to set a max tokenID.\n * This provides a guarantee to collectors about the limit of this collection contract, if applicable.\n * @dev Once this value has been set, it may be decreased but can never be increased.\n * This max may be more than the final `totalSupply` if 1 or more tokens were burned.\n * @param _maxTokenId The max tokenId to set, all NFTs must have a tokenId less than or equal to this value.\n */\n function updateMaxTokenId(uint32 _maxTokenId) external onlyOwner {\n _updateMaxTokenId(_maxTokenId);\n }\n\n /// @inheritdoc ERC721Upgradeable\n function _update(\n address to,\n uint256 tokenId,\n address auth\n ) internal override(ERC721Upgradeable, SequentialMintCollection) returns (address from) {\n if (to == address(0)) {\n // On burn clean up\n delete cidToMinted[_tokenCIDs[tokenId]];\n delete tokenIdToCreatorPaymentAddress[tokenId];\n delete _tokenCIDs[tokenId];\n }\n\n from = super._update(to, tokenId, auth);\n }\n\n function _mint(string calldata tokenCID) private onlyOwner returns (uint256 tokenId) {\n StringsLibrary.validateStringNotEmpty(tokenCID);\n if (cidToMinted[tokenCID] != 0) {\n revert NFTCollection_Token_CID_Already_Minted();\n }\n // If the mint will exceed uint32, the addition here will overflow. But it's not realistic to mint that many tokens.\n tokenId = ++latestTokenId;\n if (maxTokenId != 0 && tokenId > maxTokenId) {\n revert NFTCollection_Max_Token_Id_Has_Already_Been_Minted(maxTokenId);\n }\n cidToMinted[tokenCID] = 1;\n _tokenCIDs[tokenId] = tokenCID;\n _safeMint(msg.sender, tokenId);\n emit Minted(msg.sender, tokenId, tokenCID, tokenCID);\n }\n\n /**\n * @notice The base URI used for all NFTs in this collection.\n * @dev The `tokenCID` is appended to this to obtain an NFT's `tokenURI`.\n * e.g. The URI for a token with the `tokenCID`: \"foo\" and `baseURI`: \"ipfs://\" is \"ipfs://foo\".\n * @return uri The base URI used by this collection.\n */\n function baseURI() external view returns (string memory uri) {\n uri = _baseURI();\n }\n\n /**\n * @notice Checks if the creator has already minted a given NFT using this collection contract.\n * @param tokenCID The CID to check for.\n * @return hasBeenMinted True if the creator has already minted an NFT with this CID.\n */\n function getHasMintedCID(string calldata tokenCID) external view returns (bool hasBeenMinted) {\n hasBeenMinted = cidToMinted[tokenCID] != 0;\n }\n\n /**\n * @inheritdoc CollectionRoyalties\n */\n function getTokenCreatorPaymentAddress(\n uint256 tokenId\n ) public view override returns (address payable creatorPaymentAddress) {\n creatorPaymentAddress = tokenIdToCreatorPaymentAddress[tokenId];\n if (creatorPaymentAddress == address(0)) {\n creatorPaymentAddress = payable(owner());\n }\n }\n\n /// @inheritdoc IERC165\n function supportsInterface(\n bytes4 interfaceId\n ) public view override(ERC721Upgradeable, CollectionRoyalties) returns (bool interfaceSupported) {\n interfaceSupported = super.supportsInterface(interfaceId);\n }\n\n /// @inheritdoc IERC721Metadata\n function tokenURI(uint256 tokenId) public view override returns (string memory uri) {\n _requireOwned(tokenId);\n\n uri = string.concat(_baseURI(), _tokenCIDs[tokenId]);\n }\n\n function _baseURI() internal view override returns (string memory uri) {\n uri = baseURI_;\n if (bytes(uri).length == 0) {\n uri = \"ipfs://\";\n }\n }\n\n function totalSupply()\n public\n view\n override(SelfDestructibleCollection, SequentialMintCollection)\n returns (uint256 supply)\n {\n supply = super.totalSupply();\n }\n}\n"
},
"contracts/interfaces/internal/collections/INFTCollectionInitializer.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\n/**\n * @title Declares the interface for initializing an NFTCollection contract.\n * @author batu-inal & HardlyDifficult\n */\ninterface INFTCollectionInitializer {\n function initialize(address payable _creator, string memory _name, string memory _symbol) external;\n}\n"
},
"contracts/interfaces/internal/INFTCollectionType.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\n/**\n * @title Declares the type of the collection contract.\n * @dev This interface is declared as an ERC-165 interface.\n * @author reggieag\n */\ninterface INFTCollectionType {\n function getNFTCollectionType() external view returns (string memory collectionType);\n}\n"
},
"contracts/interfaces/standards/royalties/IGetFees.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\n/**\n * @notice An interface for communicating fees to 3rd party marketplaces.\n * @dev Originally implemented in mainnet contract 0x44d6e8933f8271abcf253c72f9ed7e0e4c0323b3\n */\ninterface IGetFees {\n /**\n * @notice Get the recipient addresses to which creator royalties should be sent.\n * @dev The expected royalty amounts are communicated with `getFeeBps`.\n * @param tokenId The ID of the NFT to get royalties for.\n * @return recipients An array of addresses to which royalties should be sent.\n */\n function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory recipients);\n\n /**\n * @notice Get the creator royalty amounts to be sent to each recipient, in basis points.\n * @dev The expected recipients are communicated with `getFeeRecipients`.\n * @param tokenId The ID of the NFT to get royalties for.\n * @return royaltiesInBasisPoints The array of fees to be sent to each recipient, in basis points.\n */\n function getFeeBps(uint256 tokenId) external view returns (uint256[] memory royaltiesInBasisPoints);\n}\n"
},
"contracts/interfaces/standards/royalties/IGetRoyalties.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\ninterface IGetRoyalties {\n /**\n * @notice Get the creator royalties to be sent.\n * @dev The data is the same as when calling `getFeeRecipients` and `getFeeBps` separately.\n * @param tokenId The ID of the NFT to get royalties for.\n * @return recipients An array of addresses to which royalties should be sent.\n * @return royaltiesInBasisPoints The array of fees to be sent to each recipient, in basis points.\n */\n function getRoyalties(\n uint256 tokenId\n ) external view returns (address payable[] memory recipients, uint256[] memory royaltiesInBasisPoints);\n}\n"
},
"contracts/interfaces/standards/royalties/IRoyaltyInfo.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\n/**\n * @notice Interface for EIP-2981: NFT Royalty Standard.\n * For more see: https://eips.ethereum.org/EIPS/eip-2981.\n */\ninterface IRoyaltyInfo {\n /**\n * @notice Get the creator royalties to be sent.\n * @param tokenId The ID of the NFT to get royalties for.\n * @param salePrice The total price of the sale.\n * @return receiver The address to which royalties should be sent.\n * @return royaltyAmount The total amount that should be sent to the `receiver`.\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount);\n}\n"
},
"contracts/interfaces/standards/royalties/ITokenCreator.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\ninterface ITokenCreator {\n /**\n * @notice Returns the creator of this NFT collection.\n * @param tokenId The ID of the NFT to get the creator payment address for.\n * @return creator The creator of this collection.\n */\n function tokenCreator(uint256 tokenId) external view returns (address payable creator);\n}\n"
},
"contracts/libraries/AddressLibrary.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\nimport { AddressUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\n\nstruct CallWithoutValue {\n address target;\n bytes callData;\n}\n\n/**\n * @title A library for address helpers not already covered by the OZ library.\n * @author batu-inal & HardlyDifficult\n */\nlibrary AddressLibrary {\n using AddressUpgradeable for address;\n using AddressUpgradeable for address payable;\n\n error AddressLibrary_Proxy_Call_Did_Not_Return_A_Contract(address addressReturned);\n\n /**\n * @notice Calls an external contract with arbitrary data and parse the return value into an address.\n * @param externalContract The address of the contract to call.\n * @param callData The data to send to the contract.\n * @return contractAddress The address of the contract returned by the call.\n */\n function callAndReturnContractAddress(\n address externalContract,\n bytes calldata callData\n ) internal returns (address payable contractAddress) {\n bytes memory returnData = externalContract.functionCall(callData);\n contractAddress = abi.decode(returnData, (address));\n if (!contractAddress.isContract()) {\n revert AddressLibrary_Proxy_Call_Did_Not_Return_A_Contract(contractAddress);\n }\n }\n\n function callAndReturnContractAddress(\n CallWithoutValue calldata call\n ) internal returns (address payable contractAddress) {\n contractAddress = callAndReturnContractAddress(call.target, call.callData);\n }\n\n /**\n * @notice Makes multiple external contract calls with arbitrary data.\n * @param calls The calls to make.\n */\n function multicall(CallWithoutValue[] calldata calls) internal {\n for (uint256 i = 0; i < calls.length; ++i) {\n calls[i].target.functionCall(calls[i].callData);\n }\n }\n}\n"
},
"contracts/libraries/StringsLibrary.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.18;\n\nimport { Strings } from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nlibrary StringsLibrary {\n using Strings for uint256;\n\n error StringsLibrary_Required_String_Is_Empty();\n\n /**\n * @notice Converts a number into a string and adds leading \"0\"s so the total string length matches `digitCount`.\n */\n function padLeadingZeros(uint256 value, uint256 digitCount) internal pure returns (string memory paddedString) {\n paddedString = value.toString();\n for (uint256 i = bytes(paddedString).length; i < digitCount; ) {\n paddedString = string.concat(\"0\", paddedString);\n unchecked {\n ++i;\n }\n }\n }\n\n function validateStringNotEmpty(string memory str) internal pure {\n if (bytes(str).length == 0) {\n revert StringsLibrary_Required_String_Is_Empty();\n }\n }\n}\n"
},
"contracts/mixins/collections/CollectionRoyalties.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable-v5/utils/introspection/ERC165Upgradeable.sol\";\n\nimport \"../../interfaces/standards/royalties/IGetFees.sol\";\nimport \"../../interfaces/standards/royalties/IGetRoyalties.sol\";\nimport \"../../interfaces/standards/royalties/IRoyaltyInfo.sol\";\nimport \"../../interfaces/standards/royalties/ITokenCreator.sol\";\n\nimport \"../shared/Constants.sol\";\n\n/**\n * @title Defines various royalty APIs for broad marketplace support.\n * @author batu-inal & HardlyDifficult\n */\nabstract contract CollectionRoyalties is IGetRoyalties, IGetFees, IRoyaltyInfo, ITokenCreator, ERC165Upgradeable {\n /**\n * @inheritdoc IGetFees\n */\n function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory recipients) {\n recipients = new address payable[](1);\n recipients[0] = getTokenCreatorPaymentAddress(tokenId);\n }\n\n /**\n * @inheritdoc IGetFees\n * @dev The tokenId param is ignored since all NFTs return the same value.\n */\n function getFeeBps(uint256 /* tokenId */) external pure returns (uint256[] memory royaltiesInBasisPoints) {\n royaltiesInBasisPoints = new uint256[](1);\n royaltiesInBasisPoints[0] = ROYALTY_IN_BASIS_POINTS;\n }\n\n /**\n * @inheritdoc IGetRoyalties\n */\n function getRoyalties(\n uint256 tokenId\n ) external view returns (address payable[] memory recipients, uint256[] memory royaltiesInBasisPoints) {\n recipients = new address payable[](1);\n recipients[0] = getTokenCreatorPaymentAddress(tokenId);\n royaltiesInBasisPoints = new uint256[](1);\n royaltiesInBasisPoints[0] = ROYALTY_IN_BASIS_POINTS;\n }\n\n /**\n * @notice The address to pay the creator proceeds/royalties for the collection.\n * @param tokenId The ID of the NFT to get the creator payment address for.\n * @return creatorPaymentAddress The address to which royalties should be paid.\n */\n function getTokenCreatorPaymentAddress(\n uint256 tokenId\n ) public view virtual returns (address payable creatorPaymentAddress);\n\n /**\n * @inheritdoc IRoyaltyInfo\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount) {\n receiver = getTokenCreatorPaymentAddress(tokenId);\n unchecked {\n royaltyAmount = salePrice / ROYALTY_RATIO;\n }\n }\n\n /**\n * @inheritdoc IERC165\n * @dev Checks the supported royalty interfaces.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool interfaceSupported) {\n interfaceSupported = (interfaceId == type(IRoyaltyInfo).interfaceId ||\n interfaceId == type(ITokenCreator).interfaceId ||\n interfaceId == type(IGetRoyalties).interfaceId ||\n interfaceId == type(IGetFees).interfaceId ||\n super.supportsInterface(interfaceId));\n }\n}\n"
},
"contracts/mixins/collections/NFTCollectionType.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\nimport \"@openzeppelin/contracts-upgradeable-v5/utils/introspection/ERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts/utils/ShortStrings.sol\";\n\nimport \"../../interfaces/internal/INFTCollectionType.sol\";\n\n/**\n * @title A mixin to add the NFTCollectionType interface to a contract.\n * @author HardlyDifficult & reggieag\n */\nabstract contract NFTCollectionType is INFTCollectionType {\n using ShortStrings for string;\n using ShortStrings for ShortString;\n\n ShortString private immutable _collectionTypeName;\n\n constructor(string memory collectionTypeName) {\n _collectionTypeName = collectionTypeName.toShortString();\n }\n\n /**\n * @notice Returns a name of the type of collection this contract represents.\n * @return collectionType The collection type.\n */\n function getNFTCollectionType() external view returns (string memory collectionType) {\n collectionType = _collectionTypeName.toString();\n }\n}\n"
},
"contracts/mixins/collections/SelfDestructibleCollection.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.18;\n\nimport { ContextUpgradeable } from \"@openzeppelin/contracts-upgradeable-v5/utils/ContextUpgradeable.sol\";\n\n/**\n * @title Allows the contract owner to signal that this contract should no longer be used.\n * @author HardlyDifficult\n * @dev It's understood that self destruct is no longer functional on-chain. This feature is still used to signal to the\n * app that a collection should be hidden.\n * This feature may be renamed in the future and may disable the contract instead, e.g. \"brick contract\".\n */\nabstract contract SelfDestructibleCollection is ContextUpgradeable {\n /**\n * @notice Emitted when this collection is self destructed by the creator/owner/admin.\n * @param operator The account which requested this contract be self destructed.\n */\n event SelfDestruct(address indexed operator);\n\n error SelfDestructibleCollection_Minted_NFTs_Must_Be_Burned_First(uint256 totalSupply);\n\n function totalSupply() public view virtual returns (uint256 supply);\n\n /**\n * @notice Allows the collection owner to signal that this contract should no longer be used only if no NFTs have been\n * minted yet or the minted NFTs have been burned.\n * @dev The caller is responsible for checking the caller's permissions.\n */\n function _selfDestruct() internal {\n if (totalSupply() != 0) {\n revert SelfDestructibleCollection_Minted_NFTs_Must_Be_Burned_First(totalSupply());\n }\n\n address sender = _msgSender();\n\n // The event appears to only emit when called before `selfdestruct`.\n emit SelfDestruct(sender);\n\n // It is understood that this is no longer effective. It does still communicate intent and the event allows our\n // app to hide these collections. The feature will be reevaluated in the future.\n selfdestruct(payable(sender));\n }\n}\n"
},
"contracts/mixins/collections/SequentialMintCollection.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\npragma solidity ^0.8.18;\n\n// solhint-disable max-line-length\nimport { ITokenCreator } from \"../../interfaces/standards/royalties/ITokenCreator.sol\";\n\nimport { ERC721BurnableUpgradeable } from \"@openzeppelin/contracts-upgradeable-v5/token/ERC721/extensions/ERC721BurnableUpgradeable.sol\";\nimport { Ownable2StepUpgradeable } from \"@openzeppelin/contracts-upgradeable-v5/access/Ownable2StepUpgradeable.sol\";\n// solhint-enable max-line-length\n\n/**\n * @title Extends the OZ ERC721 implementation for collections which mint sequential token IDs.\n * @author batu-inal & HardlyDifficult\n */\nabstract contract SequentialMintCollection is ITokenCreator, Ownable2StepUpgradeable, ERC721BurnableUpgradeable {\n /**\n * @notice The tokenId of the most recently created NFT.\n * @dev Minting starts at tokenId 1. Each mint will use this value + 1.\n * @return The most recently minted tokenId, or 0 if no NFTs have been minted yet.\n */\n uint32 public latestTokenId;\n\n /**\n * @notice Tracks how many tokens have been burned.\n * @dev This number is used to calculate the total supply efficiently.\n */\n uint32 private burnCounter;\n\n function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address from) {\n if (to == address(0)) {\n _checkOwner();\n unchecked {\n // Number of burned tokens cannot exceed latestTokenId which is the same size.\n ++burnCounter;\n }\n }\n\n from = super._update(to, tokenId, auth);\n }\n\n /**\n * @inheritdoc ITokenCreator\n * @dev The tokenId param is ignored since all NFTs return the same value.\n */\n function tokenCreator(uint256 /* tokenId */) external view returns (address payable creator) {\n creator = payable(owner());\n }\n\n /**\n * @notice Returns the total amount of tokens stored by the contract.\n * @dev From the ERC-721 enumerable standard.\n * @return supply The total number of NFTs tracked by this contract.\n */\n function totalSupply() public view virtual returns (uint256 supply) {\n unchecked {\n // Number of tokens minted is always >= burned tokens.\n supply = latestTokenId - burnCounter;\n }\n }\n}\n"
},
"contracts/mixins/collections/TokenLimitedCollection.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\nimport \"./SequentialMintCollection.sol\";\n\nerror TokenLimitedCollection_Max_Token_Id_May_Not_Be_Cleared(uint256 currentMaxTokenId);\nerror TokenLimitedCollection_Max_Token_Id_May_Not_Increase(uint256 currentMaxTokenId);\nerror TokenLimitedCollection_Max_Token_Id_Must_Be_Greater_Than_Current_Minted_Count(uint256 currentMintedCount);\nerror TokenLimitedCollection_Max_Token_Id_Must_Not_Be_Zero();\n\n/**\n * @title Defines an upper limit on the number of tokens which may be minted by this collection.\n * @author HardlyDifficult\n */\nabstract contract TokenLimitedCollection is SequentialMintCollection {\n /**\n * @notice The max tokenId which can be minted.\n * @dev This max may be less than the final `totalSupply` if 1 or more tokens were burned.\n * @return The max tokenId which can be minted.\n */\n uint32 public maxTokenId;\n\n /**\n * @notice Emitted when the max tokenId supported by this collection is updated.\n * @param maxTokenId The new max tokenId. All NFTs in this collection will have a tokenId less than\n * or equal to this value.\n */\n event MaxTokenIdUpdated(uint256 indexed maxTokenId);\n\n function _initializeTokenLimitedCollection(uint32 _maxTokenId) internal {\n if (_maxTokenId == 0) {\n // When 0 is desired, the collection may choose to simply not call this initializer.\n revert TokenLimitedCollection_Max_Token_Id_Must_Not_Be_Zero();\n }\n\n maxTokenId = _maxTokenId;\n }\n\n /**\n * @notice Allows the owner to set a max tokenID.\n * This provides a guarantee to collectors about the limit of this collection contract, if applicable.\n * @dev Once this value has been set, it may be decreased but can never be increased.\n * @param _maxTokenId The max tokenId to set, all NFTs must have a tokenId less than or equal to this value.\n */\n function _updateMaxTokenId(uint32 _maxTokenId) internal {\n if (_maxTokenId == 0) {\n revert TokenLimitedCollection_Max_Token_Id_May_Not_Be_Cleared(maxTokenId);\n }\n if (maxTokenId != 0 && _maxTokenId >= maxTokenId) {\n revert TokenLimitedCollection_Max_Token_Id_May_Not_Increase(maxTokenId);\n }\n if (latestTokenId > _maxTokenId) {\n revert TokenLimitedCollection_Max_Token_Id_Must_Be_Greater_Than_Current_Minted_Count(latestTokenId);\n }\n\n maxTokenId = _maxTokenId;\n emit MaxTokenIdUpdated(_maxTokenId);\n }\n}\n"
},
"contracts/mixins/shared/Constants.sol": {
"content": "// SPDX-License-Identifier: MIT OR Apache-2.0\n\npragma solidity ^0.8.18;\n\n/// Constant values shared across mixins.\n\n/// @dev 100% in basis points.\nuint256 constant BASIS_POINTS = 10_000;\n\n/// @dev The default admin role defined by OZ ACL modules.\nbytes32 constant DEFAULT_ADMIN_ROLE = 0x00;\n\n/// @dev The `role` type used to validate drop collections have granted this market access to mint.\nbytes32 constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n////////////////////////////////////////////////////////////////\n// Royalties & Take Rates\n////////////////////////////////////////////////////////////////\n\n/// @dev The max take rate a World can have.\nuint256 constant MAX_WORLD_TAKE_RATE = 5_000;\n\n/// @dev Cap the number of royalty recipients.\n/// A cap is required to ensure gas costs are not too high when a sale is settled.\nuint256 constant MAX_ROYALTY_RECIPIENTS = 5;\n\n/// @dev Default royalty cut paid out on secondary sales.\n/// Set to 10% of the secondary sale.\nuint96 constant ROYALTY_IN_BASIS_POINTS = 1_000;\n\n/// @dev Reward paid to referrers when a sale is made.\n/// Set to 20% of the protocol fee.\nuint96 constant BUY_REFERRER_IN_BASIS_POINTS = 2000;\n\n/// @dev 10%, expressed as a denominator for more efficient calculations.\nuint256 constant ROYALTY_RATIO = BASIS_POINTS / ROYALTY_IN_BASIS_POINTS;\n\n/// @dev 20%, expressed as a denominator for more efficient calculations.\nuint256 constant BUY_REFERRER_RATIO = BASIS_POINTS / BUY_REFERRER_IN_BASIS_POINTS;\n\n////////////////////////////////////////////////////////////////\n// Gas Limits\n////////////////////////////////////////////////////////////////\n\n/// @dev The gas limit used when making external read-only calls.\n/// This helps to ensure that external calls does not prevent the market from executing.\nuint256 constant READ_ONLY_GAS_LIMIT = 40_000;\n\n/// @dev The gas limit to send ETH to multiple recipients, enough for a 5-way split.\nuint256 constant SEND_VALUE_GAS_LIMIT_MULTIPLE_RECIPIENTS = 210_000;\n\n/// @dev The gas limit to send ETH to a single recipient, enough for a contract with a simple receiver.\nuint256 constant SEND_VALUE_GAS_LIMIT_SINGLE_RECIPIENT = 20_000;\n\n////////////////////////////////////////////////////////////////\n// Collection Type Names\n////////////////////////////////////////////////////////////////\n\n/// @dev The NFT collection type.\nstring constant NFT_COLLECTION_TYPE = \"NFT Collection\";\n\n/// @dev The NFT drop collection type.\nstring constant NFT_DROP_COLLECTION_TYPE = \"NFT Drop Collection\";\n\n/// @dev The NFT timed edition collection type.\nstring constant NFT_TIMED_EDITION_COLLECTION_TYPE = \"NFT Timed Edition Collection\";\n\n/// @dev The NFT limited edition collection type.\nstring constant NFT_LIMITED_EDITION_COLLECTION_TYPE = \"NFT Limited Edition Collection\";\n\n/// @dev The Multi-Token (ERC-1155) collection type.\nstring constant MULTI_TOKEN_COLLECTION_TYPE = \"Multi-Token Collection\";\n\n////////////////////////////////////////////////////////////////\n// Business Logic\n////////////////////////////////////////////////////////////////\n\n/// @dev Limits scheduled start/end times to be less than 2 years in the future.\nuint256 constant MAX_SCHEDULED_TIME_IN_THE_FUTURE = 365 days * 2;\n\n/// @dev The minimum increase of 10% required when making an offer or placing a bid.\nuint256 constant MIN_PERCENT_INCREMENT_DENOMINATOR = BASIS_POINTS / 1_000;\n\n/// @dev The fixed fee charged for each NFT minted.\nuint256 constant MINT_FEE_IN_WEI = 0.0008 ether;\n\n/// @dev Default for how long an auction lasts for once the first bid has been received.\nuint256 constant DEFAULT_DURATION = 1 days;\n\n/// @dev The window for auction extensions, any bid placed in the final 5 minutes\n/// of an auction will reset the time remaining to 5 minutes.\nuint256 constant EXTENSION_DURATION = 5 minutes;\n\n/// @dev Caps the max duration that may be configured for an auction.\nuint256 constant MAX_DURATION = 7 days;\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 1337000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}
}}
|
1 | 20,290,248 |
82456df9367c02c55541056a82ee6b368d865523a8fb1ac79441693e20ad25ed
|
09271d2486b92e2955ec1281db8126fe0036b909cadfedac1d0846b5c05e93ef
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
3d796da43d587322991b5c9235ac7099ad7e75b9
|
608060405234801561001057600080fd5b506123e0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80633ec6f326116100505780633ec6f326146100b257806350ec51f2146100c5578063b34a5f72146100d857600080fd5b80630a743f531461006c5780631555fe6b14610092575b600080fd5b61007f61007a36600461146e565b610143565b6040519081526020015b60405180910390f35b6100a56100a03660046114e5565b610201565b60405161008991906115a0565b61007f6100c0366004611665565b6104a5565b6100a56100d33660046116b9565b6105d2565b6101366100e6366004611705565b60009081527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020600101547501000000000000000000000000000000000000000000900460ff1690565b604051610089919061174d565b6000806101a66101538585610677565b60008181527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020600101549093507501000000000000000000000000000000000000000000900460ff1690565b60028111156101b7576101b761171e565b036101fb5782826040517ffffed0ee0000000000000000000000000000000000000000000000000000000081526004016101f2929190611767565b60405180910390fd5b92915050565b606061020b61131f565b6102536040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016060815260200160608152602001606081525090565b60008061026961026387806117b4565b356106bc565b50909250905061027c60408701876117f2565b600081811061028d5761028d61185a565b6102a39260206040909202019081019150611889565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610365576102df86806117b4565b356102ed60408801886117f2565b60008181106102fe576102fe61185a565b6103149260206040909202019081019150611889565b6040517f60ae9350000000000000000000000000000000000000000000000000000000008152600481019290925273ffffffffffffffffffffffffffffffffffffffff1660248201526044016101f2565b73ffffffffffffffffffffffffffffffffffffffff8216845261038b60408701876117f2565b600081811061039c5761039c61185a565b60206040918202939093018301358784015273ffffffffffffffffffffffffffffffffffffffff851687820152516000926103e692508a9185918b01359089908990602401611b18565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f60da086000000000000000000000000000000000000000000000000000000000179052815160608101835273888888888889758f76e7103c6cbf23abbf58f94681526000818301529182018390529192506104999184908a01356107df565b98975050505050505050565b60006104b184846108d0565b60008181527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020600101549091507501000000000000000000000000000000000000000000900460ff1682801561051f5750600081600281111561051d5761051d61171e565b145b156105365761052e85856108dc565b9150506105cb565b828015610554575060028160028111156105525761055261171e565b145b1561056a57610564826001610b4c565b506105cb565b82158015610589575060018160028111156105875761058761171e565b145b1561059957610564826002610b4c565b6040517fde5f46d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9392505050565b606060006106056105e66020850185611bca565b6040860135606087013561060060a0890160808a01611889565b610bd5565b905061062a816020015173ffffffffffffffffffffffffffffffffffffffff16610ce6565b805160408051606080820183528285015173ffffffffffffffffffffffffffffffffffffffff168252600060208301528401518183015261066f9290918601356107df565b949350505050565b60007fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a804816106a58585610df8565b815260200190815260200160002054905092915050565b60008060008360006107198260009081527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a805602052604090206001015460ff75010000000000000000000000000000000000000000009091041690565b9050600081600281111561072f5761072f61171e565b03610769576040517f9746888d000000000000000000000000000000000000000000000000000000008152600481018390526024016101f2565b505050600092835250507fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020805460019091015473ffffffffffffffffffffffffffffffffffffffff91821692918116917401000000000000000000000000000000000000000090910460ff1690565b606081156108c7576108c0846108ba858760000151866040805160608082018352600060208301528183015273ffffffffffffffffffffffffffffffffffffffff8581168252915191841660248301526044820183905290606401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790528201529392505050565b90610e9a565b90506105cb565b61066f84610f25565b60006105cb8383610677565b60008080806108ed85870187611c2f565b92509250925061091a7fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80390565b805460009061092890611c80565b91829055507fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a804600061095a8989610df8565b81526020019081526020016000208190555060405180608001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018260ff1660028111156109c4576109c461171e565b60028111156109d5576109d561171e565b8152600160209182018190527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a8035460008181527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a8058452604090819020855181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9283161783559587015194820180549687169590911694851781559186015192995093919290917fffffffffffffffffffffff000000000000000000000000000000000000000000161774010000000000000000000000000000000000000000836002811115610ae057610ae061171e565b021790555060608201516001820180547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000836002811115610b3b57610b3b61171e565b021790555090505050505092915050565b60008281527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a8056020526040902060010180548291907fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000836002811115610bcc57610bcc61171e565b02179055505050565b6040805160808101825260008082526020820181905291810191909152606080820152366000610c08876004818b611cdf565b90925090506000610c1c6004828a8c611cdf565b610c2591611d09565b90507fa6b57734000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601610c8457610c7d8383898989610f91565b9350610cda565b6040517ffdf396fd0000000000000000000000000000000000000000000000000000000081527fffffffff00000000000000000000000000000000000000000000000000000000821660048201526024016101f2565b50505095945050505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f4ee4f677e144fb4d5c31b8eed273749a84da058775f0769bea2378ffb4c11985602052604090205460ff166001816002811115610d4257610d4261171e565b14610df4576002816002811115610d5b57610d5b61171e565b03610daa576040517fd78f44dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016101f2565b6040517f05fd61ad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016101f2565b5050565b6000808080610e0985870187611c2f565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606085811b8216602084015284901b1660348201527fff0000000000000000000000000000000000000000000000000000000000000060f883901b166048820152929550909350915060490160405160208183030381529060405280519060200120935050505092915050565b6040805160028082526060828101909352816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081610eb05790505090508281600081518110610ef557610ef561185a565b60200260200101819052508181600181518110610f1457610f1461185a565b602002602001018190525092915050565b604080516001808252818301909252606091816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081610f3c5790505090508181600081518110610f8157610f8161185a565b6020026020010181905250919050565b6040805160808101825260008082526020820181905291810182905260608082015290610fbe8787611171565b90506000816020015190506000808273ffffffffffffffffffffffffffffffffffffffff16632c8ce6bc6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103b9190611d80565b73ffffffffffffffffffffffffffffffffffffffff8083168952604080890180515183166020808d0191909152905181018d905281517fe184c9be00000000000000000000000000000000000000000000000000000000815291519497509295504294509087169263e184c9be926004808401939192918290030181865afa1580156110cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ef9190611dc2565b11156111335761110e8685602001518a876040015188606001516111b6565b606087015273ffffffffffffffffffffffffffffffffffffffff166040860152611164565b61114386828a876040015161126c565b606087015273ffffffffffffffffffffffffffffffffffffffff1660408601525b5050505095945050505050565b6111796113b9565b611185828401846121f4565b606086015260408501525073ffffffffffffffffffffffffffffffffffffffff908116602084015216815292915050565b60405173888888888889758f76e7103c6cbf23abbf58f946906060906111e89088908890889088908890602401611b18565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f594a88cc00000000000000000000000000000000000000000000000000000000179052919791965090945050505050565b60405173888888888889758f76e7103c6cbf23abbf58f9469060609061129c908790879087908790602401612361565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f47f1de22000000000000000000000000000000000000000000000000000000001790529196919550909350505050565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016113b4604080516080810190915280600081526000602082018190526060604083018190529091015290565b905290565b60408051608081018252600080825260208201529081016113d861131f565b81526020016113b46040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016060815260200160608152602001606081525090565b60008083601f84011261143757600080fd5b50813567ffffffffffffffff81111561144f57600080fd5b60208301915083602082850101111561146757600080fd5b9250929050565b6000806020838503121561148157600080fd5b823567ffffffffffffffff81111561149857600080fd5b6114a485828601611425565b90969095509350505050565b73ffffffffffffffffffffffffffffffffffffffff811681146114d257600080fd5b50565b80356114e0816114b0565b919050565b600080604083850312156114f857600080fd5b8235611503816114b0565b9150602083013567ffffffffffffffff81111561151f57600080fd5b83016060818603121561153157600080fd5b809150509250929050565b6000815180845260005b8181101561156257602081850181015186830182015201611546565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b83811015611647578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805173ffffffffffffffffffffffffffffffffffffffff168452878101518885015286015160608785018190526116338186018361153c565b9689019694505050908601906001016115c9565b509098975050505050505050565b803580151581146114e057600080fd5b60008060006040848603121561167a57600080fd5b833567ffffffffffffffff81111561169157600080fd5b61169d86828701611425565b90945092506116b0905060208501611655565b90509250925092565b600080604083850312156116cc57600080fd5b82356116d7816114b0565b9150602083013567ffffffffffffffff8111156116f357600080fd5b830160a0818603121561153157600080fd5b60006020828403121561171757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600383106117615761176161171e565b91905290565b60208152816020820152818360408301376000818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126117e857600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261182757600080fd5b83018035915067ffffffffffffffff82111561184257600080fd5b6020019150600681901b360382131561146757600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561189b57600080fd5b81356105cb816114b0565b600481106114d2576114d261171e565b600073ffffffffffffffffffffffffffffffffffffffff80835116845260208301516020850152806040840151166040850152806060840151166060850152608083015160a06080860152805161190c816118a6565b60a0860152602081015190911660c08501526040810151608060e08601529061193961012086018361153c565b915060608101511515610100860152508091505092915050565b61195c816118a6565b9052565b600082825180855260208086019550808260051b84010181860160005b84811015611b0b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08684030189528151606081518186528051828701528681015160808181890152604091508183015160a081818b015285850151955060c091506119eb828b0187611953565b91840151945060e091611a158a84018773ffffffffffffffffffffffffffffffffffffffff169052565b8401519450610100611a3e8a82018773ffffffffffffffffffffffffffffffffffffffff169052565b90840151945061012090611a698a83018773ffffffffffffffffffffffffffffffffffffffff169052565b91840151945061014091611a948a84018773ffffffffffffffffffffffffffffffffffffffff169052565b8401516101608a81019190915290840151610180808b0191909152918401516101a08a01528301516101c08901919091529250611ad56101e088018461153c565b925087840151915086830388880152611aee838361153c565b93810151960195909552509884019892509083019060010161197d565b5090979650505050505050565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015285604084015260a06060840152611b5660a08401866118b6565b8381036080850152818551168152602085015160208201526040850151915060a06040820152611b8960a0820183611960565b915060608501518183036060830152611ba28382611960565b92505060808501518183036080830152611bbc838261153c565b9a9950505050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611bff57600080fd5b83018035915067ffffffffffffffff821115611c1a57600080fd5b60200191503681900382131561146757600080fd5b600080600060608486031215611c4457600080fd5b8335611c4f816114b0565b92506020840135611c5f816114b0565b9150604084013560ff81168114611c7557600080fd5b809150509250925092565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611cd8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60008085851115611cef57600080fd5b83861115611cfc57600080fd5b5050820193919092039150565b7fffffffff000000000000000000000000000000000000000000000000000000008135818116916004851015611d495780818660040360031b1b83161692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080600060608486031215611d9557600080fd5b8351611da0816114b0565b6020850151909350611db1816114b0565b6040850151909250611c75816114b0565b600060208284031215611dd457600080fd5b5051919050565b6040516060810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b60405290565b604051610180810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b60405160a0810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b6040516080810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611eb557611eb5611d51565b604052919050565b600481106114d257600080fd5b80356114e081611ebd565b600082601f830112611ee657600080fd5b813567ffffffffffffffff811115611f0057611f00611d51565b611f3160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611e6e565b818152846020838601011115611f4657600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611f7457600080fd5b8135602067ffffffffffffffff80831115611f9157611f91611d51565b8260051b611fa0838201611e6e565b9384528581018301938381019088861115611fba57600080fd5b84880192505b8583101561049957823584811115611fd757600080fd5b88017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06060828c038201121561200c57600080fd5b612014611ddb565b878301358781111561202557600080fd5b8301610180818e038401121561203a57600080fd5b612042611e04565b92508881013583526040810135898401526060810135604084015261206960808201611eca565b606084015261207a60a082016114d5565b608084015261208b60c082016114d5565b60a084015261209c60e082016114d5565b60c08401526101006120af8183016114d5565b60e08501526101208083013582860152610140915081830135818601525061016080830135828601526101808301359150898211156120ed57600080fd5b6120fb8f8c84860101611ed5565b9085015250509081526040820135908682111561211757600080fd5b6121258c8984860101611ed5565b818901526060929092013560408301525082529184019190840190611fc0565b600060a0828403121561215757600080fd5b61215f611e28565b905061216a826114d5565b815260208201356020820152604082013567ffffffffffffffff8082111561219157600080fd5b61219d85838601611f63565b604084015260608401359150808211156121b657600080fd5b6121c285838601611f63565b606084015260808401359150808211156121db57600080fd5b506121e884828501611ed5565b60808301525092915050565b600080600080600060a0868803121561220c57600080fd5b8535612217816114b0565b94506020860135612227816114b0565b935060408601359250606086013567ffffffffffffffff8082111561224b57600080fd5b9087019060a0828a03121561225f57600080fd5b612267611e28565b8235612272816114b0565b815260208381013590820152604083013561228c816114b0565b6040820152606083013561229f816114b0565b60608201526080830135828111156122b657600080fd5b92909201916080838b0312156122cb57600080fd5b6122d3611e4b565b83356122de81611ebd565b815260208401356122ee816114b0565b602082015260408401358381111561230557600080fd5b6123118c828701611ed5565b60408301525061232360608501611655565b60608201528060808301525080945050608088013591508082111561234757600080fd5b5061235488828901612145565b9150509295509295909350565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250836040830152608060608301526123a060808301846118b6565b969550505050505056fea26469706673582212202fb5562210f697b8255315555cac920fe5766802a600f44473c6093a36087a7864736f6c63430008160033
|
608060405234801561001057600080fd5b50600436106100675760003560e01c80633ec6f326116100505780633ec6f326146100b257806350ec51f2146100c5578063b34a5f72146100d857600080fd5b80630a743f531461006c5780631555fe6b14610092575b600080fd5b61007f61007a36600461146e565b610143565b6040519081526020015b60405180910390f35b6100a56100a03660046114e5565b610201565b60405161008991906115a0565b61007f6100c0366004611665565b6104a5565b6100a56100d33660046116b9565b6105d2565b6101366100e6366004611705565b60009081527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020600101547501000000000000000000000000000000000000000000900460ff1690565b604051610089919061174d565b6000806101a66101538585610677565b60008181527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020600101549093507501000000000000000000000000000000000000000000900460ff1690565b60028111156101b7576101b761171e565b036101fb5782826040517ffffed0ee0000000000000000000000000000000000000000000000000000000081526004016101f2929190611767565b60405180910390fd5b92915050565b606061020b61131f565b6102536040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016060815260200160608152602001606081525090565b60008061026961026387806117b4565b356106bc565b50909250905061027c60408701876117f2565b600081811061028d5761028d61185a565b6102a39260206040909202019081019150611889565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610365576102df86806117b4565b356102ed60408801886117f2565b60008181106102fe576102fe61185a565b6103149260206040909202019081019150611889565b6040517f60ae9350000000000000000000000000000000000000000000000000000000008152600481019290925273ffffffffffffffffffffffffffffffffffffffff1660248201526044016101f2565b73ffffffffffffffffffffffffffffffffffffffff8216845261038b60408701876117f2565b600081811061039c5761039c61185a565b60206040918202939093018301358784015273ffffffffffffffffffffffffffffffffffffffff851687820152516000926103e692508a9185918b01359089908990602401611b18565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f60da086000000000000000000000000000000000000000000000000000000000179052815160608101835273888888888889758f76e7103c6cbf23abbf58f94681526000818301529182018390529192506104999184908a01356107df565b98975050505050505050565b60006104b184846108d0565b60008181527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020600101549091507501000000000000000000000000000000000000000000900460ff1682801561051f5750600081600281111561051d5761051d61171e565b145b156105365761052e85856108dc565b9150506105cb565b828015610554575060028160028111156105525761055261171e565b145b1561056a57610564826001610b4c565b506105cb565b82158015610589575060018160028111156105875761058761171e565b145b1561059957610564826002610b4c565b6040517fde5f46d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9392505050565b606060006106056105e66020850185611bca565b6040860135606087013561060060a0890160808a01611889565b610bd5565b905061062a816020015173ffffffffffffffffffffffffffffffffffffffff16610ce6565b805160408051606080820183528285015173ffffffffffffffffffffffffffffffffffffffff168252600060208301528401518183015261066f9290918601356107df565b949350505050565b60007fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a804816106a58585610df8565b815260200190815260200160002054905092915050565b60008060008360006107198260009081527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a805602052604090206001015460ff75010000000000000000000000000000000000000000009091041690565b9050600081600281111561072f5761072f61171e565b03610769576040517f9746888d000000000000000000000000000000000000000000000000000000008152600481018390526024016101f2565b505050600092835250507fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80560205260409020805460019091015473ffffffffffffffffffffffffffffffffffffffff91821692918116917401000000000000000000000000000000000000000090910460ff1690565b606081156108c7576108c0846108ba858760000151866040805160608082018352600060208301528183015273ffffffffffffffffffffffffffffffffffffffff8581168252915191841660248301526044820183905290606401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790528201529392505050565b90610e9a565b90506105cb565b61066f84610f25565b60006105cb8383610677565b60008080806108ed85870187611c2f565b92509250925061091a7fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a80390565b805460009061092890611c80565b91829055507fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a804600061095a8989610df8565b81526020019081526020016000208190555060405180608001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018260ff1660028111156109c4576109c461171e565b60028111156109d5576109d561171e565b8152600160209182018190527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a8035460008181527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a8058452604090819020855181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9283161783559587015194820180549687169590911694851781559186015192995093919290917fffffffffffffffffffffff000000000000000000000000000000000000000000161774010000000000000000000000000000000000000000836002811115610ae057610ae061171e565b021790555060608201516001820180547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000836002811115610b3b57610b3b61171e565b021790555090505050505092915050565b60008281527fdb30d141cb14f7793ef507f58c70af081a451bad8a68a642aa3dfbd48964a8056020526040902060010180548291907fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000836002811115610bcc57610bcc61171e565b02179055505050565b6040805160808101825260008082526020820181905291810191909152606080820152366000610c08876004818b611cdf565b90925090506000610c1c6004828a8c611cdf565b610c2591611d09565b90507fa6b57734000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601610c8457610c7d8383898989610f91565b9350610cda565b6040517ffdf396fd0000000000000000000000000000000000000000000000000000000081527fffffffff00000000000000000000000000000000000000000000000000000000821660048201526024016101f2565b50505095945050505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f4ee4f677e144fb4d5c31b8eed273749a84da058775f0769bea2378ffb4c11985602052604090205460ff166001816002811115610d4257610d4261171e565b14610df4576002816002811115610d5b57610d5b61171e565b03610daa576040517fd78f44dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016101f2565b6040517f05fd61ad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016101f2565b5050565b6000808080610e0985870187611c2f565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606085811b8216602084015284901b1660348201527fff0000000000000000000000000000000000000000000000000000000000000060f883901b166048820152929550909350915060490160405160208183030381529060405280519060200120935050505092915050565b6040805160028082526060828101909352816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081610eb05790505090508281600081518110610ef557610ef561185a565b60200260200101819052508181600181518110610f1457610f1461185a565b602002602001018190525092915050565b604080516001808252818301909252606091816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081610f3c5790505090508181600081518110610f8157610f8161185a565b6020026020010181905250919050565b6040805160808101825260008082526020820181905291810182905260608082015290610fbe8787611171565b90506000816020015190506000808273ffffffffffffffffffffffffffffffffffffffff16632c8ce6bc6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103b9190611d80565b73ffffffffffffffffffffffffffffffffffffffff8083168952604080890180515183166020808d0191909152905181018d905281517fe184c9be00000000000000000000000000000000000000000000000000000000815291519497509295504294509087169263e184c9be926004808401939192918290030181865afa1580156110cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ef9190611dc2565b11156111335761110e8685602001518a876040015188606001516111b6565b606087015273ffffffffffffffffffffffffffffffffffffffff166040860152611164565b61114386828a876040015161126c565b606087015273ffffffffffffffffffffffffffffffffffffffff1660408601525b5050505095945050505050565b6111796113b9565b611185828401846121f4565b606086015260408501525073ffffffffffffffffffffffffffffffffffffffff908116602084015216815292915050565b60405173888888888889758f76e7103c6cbf23abbf58f946906060906111e89088908890889088908890602401611b18565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f594a88cc00000000000000000000000000000000000000000000000000000000179052919791965090945050505050565b60405173888888888889758f76e7103c6cbf23abbf58f9469060609061129c908790879087908790602401612361565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f47f1de22000000000000000000000000000000000000000000000000000000001790529196919550909350505050565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016113b4604080516080810190915280600081526000602082018190526060604083018190529091015290565b905290565b60408051608081018252600080825260208201529081016113d861131f565b81526020016113b46040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016060815260200160608152602001606081525090565b60008083601f84011261143757600080fd5b50813567ffffffffffffffff81111561144f57600080fd5b60208301915083602082850101111561146757600080fd5b9250929050565b6000806020838503121561148157600080fd5b823567ffffffffffffffff81111561149857600080fd5b6114a485828601611425565b90969095509350505050565b73ffffffffffffffffffffffffffffffffffffffff811681146114d257600080fd5b50565b80356114e0816114b0565b919050565b600080604083850312156114f857600080fd5b8235611503816114b0565b9150602083013567ffffffffffffffff81111561151f57600080fd5b83016060818603121561153157600080fd5b809150509250929050565b6000815180845260005b8181101561156257602081850181015186830182015201611546565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b83811015611647578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805173ffffffffffffffffffffffffffffffffffffffff168452878101518885015286015160608785018190526116338186018361153c565b9689019694505050908601906001016115c9565b509098975050505050505050565b803580151581146114e057600080fd5b60008060006040848603121561167a57600080fd5b833567ffffffffffffffff81111561169157600080fd5b61169d86828701611425565b90945092506116b0905060208501611655565b90509250925092565b600080604083850312156116cc57600080fd5b82356116d7816114b0565b9150602083013567ffffffffffffffff8111156116f357600080fd5b830160a0818603121561153157600080fd5b60006020828403121561171757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60208101600383106117615761176161171e565b91905290565b60208152816020820152818360408301376000818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18336030181126117e857600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261182757600080fd5b83018035915067ffffffffffffffff82111561184257600080fd5b6020019150600681901b360382131561146757600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561189b57600080fd5b81356105cb816114b0565b600481106114d2576114d261171e565b600073ffffffffffffffffffffffffffffffffffffffff80835116845260208301516020850152806040840151166040850152806060840151166060850152608083015160a06080860152805161190c816118a6565b60a0860152602081015190911660c08501526040810151608060e08601529061193961012086018361153c565b915060608101511515610100860152508091505092915050565b61195c816118a6565b9052565b600082825180855260208086019550808260051b84010181860160005b84811015611b0b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08684030189528151606081518186528051828701528681015160808181890152604091508183015160a081818b015285850151955060c091506119eb828b0187611953565b91840151945060e091611a158a84018773ffffffffffffffffffffffffffffffffffffffff169052565b8401519450610100611a3e8a82018773ffffffffffffffffffffffffffffffffffffffff169052565b90840151945061012090611a698a83018773ffffffffffffffffffffffffffffffffffffffff169052565b91840151945061014091611a948a84018773ffffffffffffffffffffffffffffffffffffffff169052565b8401516101608a81019190915290840151610180808b0191909152918401516101a08a01528301516101c08901919091529250611ad56101e088018461153c565b925087840151915086830388880152611aee838361153c565b93810151960195909552509884019892509083019060010161197d565b5090979650505050505050565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015285604084015260a06060840152611b5660a08401866118b6565b8381036080850152818551168152602085015160208201526040850151915060a06040820152611b8960a0820183611960565b915060608501518183036060830152611ba28382611960565b92505060808501518183036080830152611bbc838261153c565b9a9950505050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611bff57600080fd5b83018035915067ffffffffffffffff821115611c1a57600080fd5b60200191503681900382131561146757600080fd5b600080600060608486031215611c4457600080fd5b8335611c4f816114b0565b92506020840135611c5f816114b0565b9150604084013560ff81168114611c7557600080fd5b809150509250925092565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611cd8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60008085851115611cef57600080fd5b83861115611cfc57600080fd5b5050820193919092039150565b7fffffffff000000000000000000000000000000000000000000000000000000008135818116916004851015611d495780818660040360031b1b83161692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080600060608486031215611d9557600080fd5b8351611da0816114b0565b6020850151909350611db1816114b0565b6040850151909250611c75816114b0565b600060208284031215611dd457600080fd5b5051919050565b6040516060810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b60405290565b604051610180810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b60405160a0810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b6040516080810167ffffffffffffffff81118282101715611dfe57611dfe611d51565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611eb557611eb5611d51565b604052919050565b600481106114d257600080fd5b80356114e081611ebd565b600082601f830112611ee657600080fd5b813567ffffffffffffffff811115611f0057611f00611d51565b611f3160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611e6e565b818152846020838601011115611f4657600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611f7457600080fd5b8135602067ffffffffffffffff80831115611f9157611f91611d51565b8260051b611fa0838201611e6e565b9384528581018301938381019088861115611fba57600080fd5b84880192505b8583101561049957823584811115611fd757600080fd5b88017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06060828c038201121561200c57600080fd5b612014611ddb565b878301358781111561202557600080fd5b8301610180818e038401121561203a57600080fd5b612042611e04565b92508881013583526040810135898401526060810135604084015261206960808201611eca565b606084015261207a60a082016114d5565b608084015261208b60c082016114d5565b60a084015261209c60e082016114d5565b60c08401526101006120af8183016114d5565b60e08501526101208083013582860152610140915081830135818601525061016080830135828601526101808301359150898211156120ed57600080fd5b6120fb8f8c84860101611ed5565b9085015250509081526040820135908682111561211757600080fd5b6121258c8984860101611ed5565b818901526060929092013560408301525082529184019190840190611fc0565b600060a0828403121561215757600080fd5b61215f611e28565b905061216a826114d5565b815260208201356020820152604082013567ffffffffffffffff8082111561219157600080fd5b61219d85838601611f63565b604084015260608401359150808211156121b657600080fd5b6121c285838601611f63565b606084015260808401359150808211156121db57600080fd5b506121e884828501611ed5565b60808301525092915050565b600080600080600060a0868803121561220c57600080fd5b8535612217816114b0565b94506020860135612227816114b0565b935060408601359250606086013567ffffffffffffffff8082111561224b57600080fd5b9087019060a0828a03121561225f57600080fd5b612267611e28565b8235612272816114b0565b815260208381013590820152604083013561228c816114b0565b6040820152606083013561229f816114b0565b60608201526080830135828111156122b657600080fd5b92909201916080838b0312156122cb57600080fd5b6122d3611e4b565b83356122de81611ebd565b815260208401356122ee816114b0565b602082015260408401358381111561230557600080fd5b6123118c828701611ed5565b60408301525061232360608501611655565b60608201528060808301525080945050608088013591508082111561234757600080fd5b5061235488828901612145565b9150509295509295909350565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250836040830152608060608301526123a060808301846118b6565b969550505050505056fea26469706673582212202fb5562210f697b8255315555cac920fe5766802a600f44473c6093a36087a7864736f6c63430008160033
|
{{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\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/compliance/libraries/TokensRepository.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n Status,\n TokenIsNotSupported,\n TokenIsSuspended,\n TokenLevelInsufficient,\n TokenPermission\n} from \"contracts/interfaces/accountAbstraction/compliance/IWhitelistingController.sol\";\n\nlibrary TokensRepository {\n struct Token {\n Status status;\n TokenPermission perm;\n }\n\n struct Storage {\n mapping(address source => Token) tokens;\n }\n\n bytes32 private constant STORAGE_SLOT = keccak256(\"Supported Tokens repository slot V1\");\n\n error CannotRecognizeTokenPermission(TokenPermission);\n /// @dev We can suspend token, but it's permission will never fall\n /// to None. None reserved for undefined case just because it would\n /// be strange to return TradeOnly permission for undefined tokens.\n error CannotSetPermissionToNone(address);\n\n function updateTokenSupport(\n address token,\n bool supported,\n TokenPermission perm\n ) internal returns (bool storageModified) {\n bool s = updateTokenStatus(token, supported);\n bool p = updateTokenPerm(token, perm);\n storageModified = s || p;\n }\n\n function enforceTokenSupported(address token) internal view {\n Status status = getTokenStatus(token);\n if (status != Status.Supported) {\n if (status == Status.Suspended) revert TokenIsSuspended(token);\n else revert TokenIsNotSupported(token);\n }\n }\n\n function enforceTokenSupportedOrSuspended(address token) internal view {\n Status status = getTokenStatus(token);\n if (status == Status.Undefined) revert TokenIsNotSupported(token);\n }\n\n function enforceTokenHasPermission(address token, TokenPermission required) internal view {\n TokenPermission current = getTokenPerm(token);\n if (current == required) return;\n // if not matched then we check levels\n if (getPermLevel(current) > getPermLevel(required)) return;\n // at this point we know that niether permissions matched\n // nor the current one is higher than required, so\n // it's either current is lower than the required (bad)\n // or equal to it which is only possible for level 2\n // which is not compatible (Collateral != Leverage)\n revert TokenLevelInsufficient(token, required, current);\n }\n\n function getTokenStatus(address token) internal view returns (Status) {\n return _storage()[token].status;\n }\n\n function getTokenPerm(address token) internal view returns (TokenPermission) {\n return _storage()[token].perm;\n }\n\n function updateTokenStatus(\n address token,\n bool supported\n ) private returns (bool storageModified) {\n Status current = getTokenStatus(token);\n if (supported && current != Status.Supported) {\n _storage()[token].status = Status.Supported;\n storageModified = true;\n } else if (!supported && current == Status.Supported) {\n _storage()[token].status = Status.Suspended;\n storageModified = true;\n }\n }\n\n function updateTokenPerm(\n address token,\n TokenPermission perm\n ) private returns (bool storageModified) {\n if (perm == TokenPermission.None) revert CannotSetPermissionToNone(token);\n\n if (getTokenPerm(token) != perm) {\n _storage()[token].perm = perm;\n storageModified = true;\n }\n }\n\n function _storage() private view returns (mapping(address => Token) storage) {\n bytes32 storageSlot = STORAGE_SLOT;\n Storage storage state;\n assembly {\n state.slot := storageSlot\n }\n return state.tokens;\n }\n\n function getPermLevel(TokenPermission perm) private pure returns (uint256) {\n if (perm == TokenPermission.None) return 0;\n if (perm == TokenPermission.TradeOnly) return 1;\n if (perm == TokenPermission.Collateral) return 2;\n if (perm == TokenPermission.Leverage) return 2;\n if (perm == TokenPermission.FullAccess) return 3;\n revert CannotRecognizeTokenPermission(perm);\n }\n}\n"
},
"contracts/accountAbstraction/interpreter/base/LiquidityPoolsRepository.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n AlreadyUpToDate,\n ILiquidityPoolsRepository,\n PoolIdNotFound,\n PoolIsNotSupported,\n Status\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/index.sol\";\n\nabstract contract LiquidityPoolsRepository is ILiquidityPoolsRepository {\n modifier getPoolGuard(uint256 _poolId) {\n Status status = getPoolStatus(_poolId);\n\n if (status == Status.Undefined) revert PoolIsNotSupported(_poolId);\n\n _;\n }\n\n // Interface implementation\n\n function updatePoolSupport(\n bytes calldata _encodedParams,\n bool _supported\n ) external override returns (uint256 poolId_) {\n poolId_ = getPoolIdFromParams(_encodedParams);\n Status status = getPoolStatus(poolId_);\n\n if (_supported && status == Status.Undefined) {\n return initializePool(_encodedParams);\n }\n\n if (_supported && status == Status.Suspended) {\n setPoolStatus(poolId_, Status.Supported);\n return poolId_;\n }\n\n if (!_supported && status == Status.Supported) {\n setPoolStatus(poolId_, Status.Suspended);\n return poolId_;\n }\n\n revert AlreadyUpToDate();\n }\n\n function getPoolId(\n bytes calldata _encodedTokens\n ) external view override returns (uint256 poolId_) {\n if (getPoolStatus(poolId_ = getPoolIdFromTokens(_encodedTokens)) == Status.Undefined) {\n revert PoolIdNotFound(_encodedTokens);\n }\n }\n\n function getPoolStatus(uint256 _poolId) public view virtual override returns (Status);\n\n // Internal fixture\n\n function initializePool(\n bytes calldata _encodedParams\n ) internal virtual returns (uint256 poolId_);\n\n function setPoolStatus(uint256 _poolId, Status _status) internal virtual;\n\n function getPoolIdFromParams(\n bytes calldata _encodedParams\n ) internal view virtual returns (uint256 poolId_);\n\n function getPoolIdFromTokens(\n bytes calldata _encodedTokens\n ) internal view virtual returns (uint256 poolId_);\n}\n"
},
"contracts/accountAbstraction/interpreter/pendle/actions/PendleRouter.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IPActionMiscV3,\n IPActionSwapPTV3,\n LimitOrderData,\n TokenOutput\n} from \"contracts/interfaces/accountAbstraction/compliance/pendle/IPAllActionV3.sol\";\nimport {PendleImmutableState} from \"../base/PendleImmutableState.sol\";\n\nabstract contract PendleRouter is PendleImmutableState {\n function constructSwapExactPtForToken(\n address receiver,\n address market,\n uint256 exactPtIn,\n TokenOutput memory output,\n LimitOrderData memory limit\n ) internal pure returns (address target_, bytes memory data_) {\n target_ = ROUTER;\n data_ = abi.encodeCall(\n IPActionSwapPTV3.swapExactPtForToken,\n (receiver, market, exactPtIn, output, limit)\n );\n }\n\n function constructRedeemPyToToken(\n address receiver,\n address YT,\n uint256 netPyIn,\n TokenOutput memory output\n ) internal pure returns (address target_, bytes memory data_) {\n target_ = ROUTER;\n data_ = abi.encodeCall(IPActionMiscV3.redeemPyToToken, (receiver, YT, netPyIn, output));\n }\n}\n"
},
"contracts/accountAbstraction/interpreter/pendle/base/PendleHub.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IPMarket,\n IPPrincipalToken,\n IPYieldToken\n} from \"contracts/interfaces/accountAbstraction/compliance/pendle/IPMarket.sol\";\nimport {\n IPActionMiscV3,\n IPActionSwapPTV3,\n LimitOrderData,\n PendleRouter,\n TokenOutput\n} from \"../actions/PendleRouter.sol\";\n\n/* solhint-disable ordering */\nabstract contract PendleHub is PendleRouter {\n error UnsupportedPendleRouterFunction(bytes4 selector);\n\n struct SwitchResult {\n address tokenIn;\n address tokenOut;\n address target;\n bytes data;\n }\n\n struct SwapForTokenResult {\n address receiver;\n address market;\n TokenOutput output;\n LimitOrderData limit;\n }\n\n function switchBySelector(\n bytes calldata extraData,\n uint256 amountIn,\n uint256 minAmountOut,\n address recipient\n ) internal view returns (SwitchResult memory result) {\n bytes calldata payload = extraData[4:];\n bytes4 selector = bytes4(extraData[:4]);\n if (selector == IPActionSwapPTV3.swapExactPtForToken.selector) {\n result = swapExactPtForToken(payload, amountIn, minAmountOut, recipient);\n } else {\n revert UnsupportedPendleRouterFunction(selector);\n }\n }\n\n function decodeSwapExactPtForToken(\n bytes calldata payload\n ) private pure returns (SwapForTokenResult memory result) {\n (result.receiver, result.market, , result.output, result.limit) = abi.decode(\n payload,\n (address, address, uint256, TokenOutput, LimitOrderData)\n );\n }\n\n function swapExactPtForToken(\n bytes calldata payload,\n uint256 amountIn,\n uint256 minAmountOut,\n address recipient\n ) internal view virtual returns (SwitchResult memory result) {\n SwapForTokenResult memory decoded = decodeSwapExactPtForToken(payload);\n IPMarket pMarket = IPMarket(decoded.market);\n\n (, IPPrincipalToken tokenPt, IPYieldToken tokenYt) = pMarket.readTokens();\n result.tokenIn = address(tokenPt);\n result.tokenOut = decoded.output.tokenOut;\n\n decoded.output.minTokenOut = minAmountOut;\n if (pMarket.expiry() > block.timestamp) {\n (result.target, result.data) = constructSwapExactPtForToken(\n recipient,\n decoded.market,\n amountIn,\n decoded.output,\n decoded.limit\n );\n } else {\n (result.target, result.data) = constructRedeemPyToToken(\n recipient,\n address(tokenYt),\n amountIn,\n decoded.output\n );\n }\n }\n}\n/* solhint-enable ordering */\n"
},
"contracts/accountAbstraction/interpreter/pendle/base/PendleImmutableState.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ncontract PendleImmutableState {\n address internal constant ROUTER = 0x888888888889758F76e7103c6CbF23ABbF58F946;\n}\n"
},
"contracts/accountAbstraction/interpreter/pendle/PendleEvaluator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IPActionAddRemoveLiqV3,\n LimitOrderData,\n TokenOutput\n} from \"contracts/interfaces/accountAbstraction/compliance/pendle/IPAllActionV3.sol\";\nimport {\n IPPrincipalToken\n} from \"contracts/interfaces/accountAbstraction/compliance/pendle/IPMarket.sol\";\nimport {\n IDecreasePositionEvaluator,\n IExchangeEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/index.sol\";\n\nimport {\n TokensRepository\n} from \"contracts/accountAbstraction/compliance/libraries/TokensRepository.sol\";\nimport {Command} from \"contracts/libraries/CommandLibrary.sol\";\n\nimport {PendleHub} from \"./base/PendleHub.sol\";\nimport {PendleLiquidityPoolsRepository} from \"./PendleLiquidityPoolsRepository.sol\";\n\ncontract PendleEvaluator is\n IDecreasePositionEvaluator,\n IExchangeEvaluator,\n PendleLiquidityPoolsRepository,\n PendleHub\n{\n using TokensRepository for address;\n\n error UnexpectedTokenDuringDecreasePositionRequest(uint256 poolId, address token);\n\n function evaluate(\n address,\n ExchangeRequest calldata _request\n ) external view override returns (Command[] memory cmds_) {\n SwitchResult memory result = switchBySelector(\n _request.extraData,\n _request.amountIn,\n _request.minAmountOut,\n _request.recipient\n );\n\n result.tokenOut.enforceTokenSupported();\n\n cmds_ = Command({target: result.target, value: 0, payload: result.data})\n .populateWithApprove(result.tokenIn, _request.amountIn);\n }\n\n function evaluate(\n address operator,\n DecreasePositionRequest calldata _request\n ) external view override returns (Command[] memory) {\n TokenOutput memory output;\n LimitOrderData memory limit;\n\n (address token, address market, ) = getPool(_request.descriptor.poolId);\n if (token != _request.minOutput[0].token)\n revert UnexpectedTokenDuringDecreasePositionRequest(\n _request.descriptor.poolId,\n _request.minOutput[0].token\n );\n output.tokenOut = token;\n output.minTokenOut = _request.minOutput[0].amount;\n output.tokenRedeemSy = token;\n\n bytes memory payload = abi.encodeCall(\n IPActionAddRemoveLiqV3.removeLiquiditySingleToken,\n (operator, market, _request.liquidity, output, limit)\n );\n\n return\n Command({target: ROUTER, value: 0, payload: payload}).populateWithApprove(\n market,\n _request.liquidity\n );\n }\n}\n"
},
"contracts/accountAbstraction/interpreter/pendle/PendleLiquidityPoolsRepository.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Address} from \"contracts/libraries/Address.sol\";\nimport {LiquidityPoolsRepository, Status} from \"../base/LiquidityPoolsRepository.sol\";\n\nabstract contract PendleLiquidityPoolsRepository is LiquidityPoolsRepository {\n using Address for address;\n\n enum PositionType {\n LP,\n PT,\n YT\n }\n\n struct Pool {\n address token;\n address market;\n PositionType pType;\n Status status;\n }\n\n struct Storage {\n uint256 currentPoolId;\n mapping(bytes32 poolTokensHash => uint256 poolId) ids;\n mapping(uint256 poolId => Pool) pools;\n }\n\n bytes32 private constant STORAGE_POSITION = keccak256(\"Pendle Liquidity Pools State V1\");\n\n function getPoolStatus(uint256 _poolId) public view override returns (Status) {\n return _storage().pools[_poolId].status;\n }\n\n function initializePool(\n bytes calldata _encodedParams\n ) internal override returns (uint256 poolId_) {\n (address token, address market, uint8 pType) = abi.decode(\n _encodedParams,\n (address, address, uint8)\n );\n\n _storage().ids[hashDecode(_encodedParams)] = ++_storage().currentPoolId;\n _storage().pools[poolId_ = _storage().currentPoolId] = Pool({\n token: token,\n market: market,\n pType: PositionType(pType),\n status: Status.Supported\n });\n }\n\n function setPoolStatus(uint256 _poolId, Status _status) internal override {\n _storage().pools[_poolId].status = _status;\n }\n\n function getPool(\n uint256 _poolId\n ) internal view getPoolGuard(_poolId) returns (address, address, PositionType) {\n Pool storage pool = _storage().pools[_poolId];\n return (pool.token, pool.market, pool.pType);\n }\n\n function getPoolIdFromParams(\n bytes calldata _encodedParams\n ) internal view override returns (uint256) {\n return getPoolIdFromTokens(_encodedParams);\n }\n\n function getPoolIdFromTokens(\n bytes calldata _encodedTokens\n ) internal view override returns (uint256) {\n return _storage().ids[hashDecode(_encodedTokens)];\n }\n\n function _storage() private pure returns (Storage storage s_) {\n bytes32 storageSlot = STORAGE_POSITION;\n assembly {\n s_.slot := storageSlot\n }\n }\n\n function hashDecode(bytes calldata _encoded) private pure returns (bytes32) {\n (address token, address market, uint8 pType) = abi.decode(\n _encoded,\n (address, address, uint8)\n );\n return keccak256(abi.encodePacked(token, market, pType));\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/compliance/IWhitelistingController.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @title Status\n * @notice Enum representing status of a record (e.g., token, protocol, operator)\n * used for operation validation.\n * @notice Validators must adhere to the following rules for different operations and contexts:\n * 1) For exchanges: `operator`, `pool`, and `input token` *MAY* be either supported or suspended, but the `output token` *MUST* be supported.\n * 2) For deposits: `operator`, `pool`, and every `token` in the `pool` *MUST* be supported.\n * 3) For withdrawals: `operator`, `pool`, and each `token` *MAY* be either supported or suspended.\n *\n * @dev **Note** that deposit denotes **all** ways of aquiring liquidity such\n * as token deposit, LP tokens stake, NFT mint etc.\n */\nenum Status {\n Undefined,\n Supported,\n Suspended\n}\n\n/**\n * @title WhitelistingAddressRecord\n * @notice A struct to store an address and its support status.\n * @dev This struct stores an address and its support status.\n * @dev `source`: The address to be stored.\n * @dev `supported`: Indicates whether the address is supported or not.\n */\nstruct WhitelistingAddressRecord {\n address source;\n bool supported;\n}\n\n/**\n * @title TokenPermission\n * @notice This enum represents different levels of permission for a token, including trading, collateral, leverage, and full access.\n * @dev `None`: Represents no permissions granted for the token.\n * @dev `TradeOnly`: Represents the lowest permission level where you can only trade the token.\n * @dev `Collateral`: Allows you to use the token as collateral.\n * @dev `Leverage`: Allows you to leverage the token.\n * @dev `FullAccess`: Represents the highest permission level where you have full access to trade, use as collateral, and leverage the token.\n */\nenum TokenPermission {\n None,\n TradeOnly,\n Collateral,\n Leverage,\n FullAccess\n}\n\n/**\n * @title WhitelistingTokenRecord\n * @notice This struct stores an address and its support status for whitelisting, collateral and leverage.\n * @dev `source`: The address of the token.\n * @dev `supported`: Whether the token can be received from a protocol trades.\n * @dev `permission`: Level of [`TokenPermission`](./enum.TokenPermission.html).\n */\nstruct WhitelistingTokenRecord {\n address source;\n bool supported;\n TokenPermission permission;\n}\n\n/**\n * @notice An error indicating that a token is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported token is used.\n * @dev `token`: The address of the unsupported token.\n */\nerror TokenIsNotSupported(address token);\n\n/**\n * @notice An error indicating that a token is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended token is used.\n * @dev `token`: The address of the suspended token.\n */\nerror TokenIsSuspended(address token);\n\n/**\n * @notice An error indicating that the token's permission level is insufficient for the requested action.\n * @dev This can be thrown at [`IWhitelistingController.enforceTokenHasPermission()`](./interface.IWhitelistingController.html#enforcetokenhaspermission)\n * @param token The address of the token that has insufficient permissions.\n * @param required The required permission level for the action.\n * @param actual The actual permission level of the token.\n */\nerror TokenLevelInsufficient(address token, TokenPermission required, TokenPermission actual);\n\n/**\n * @notice An error indicating that an operator is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported operator is used.\n * @dev `operator`: The address of the unsupported operator.\n */\nerror OperatorIsNotSupported(address operator);\n\n/**\n * @notice An error indicating that an operator is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended operator is used.\n * @dev `operator`: The address of the suspended operator.\n */\nerror OperatorIsSuspended(address operator);\n\n/**\n * @notice An error indicating that a protocol is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported protocol is used.\n * @dev `protocol`: The identification string of the unsupported protocol.\n */\nerror ProtocolIsNotSupported(string protocol);\n\n/**\n * @notice An error indicating that a protocol is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended protocol is used.\n * @dev `protocol`: The identification string of the unsupported protocol.\n */\nerror ProtocolIsSuspended(string protocol);\n\n/**\n * @title IWhitelistingController\n * @notice Interface for managing whitelisting of tokens, protocols, and operators.\n */\ninterface IWhitelistingController {\n /**\n * @dev Emitted when the support status of a protocol changes.\n * @dev `protocol`: The identification string of the protocol.\n * @dev `supported`: Whether the protocol is supported or not.\n */\n event ProtocolSupportChanged(string indexed protocol, bool supported);\n\n /**\n * @dev Emitted when the support status of a token changes.\n * @dev `token`: The address of the token.\n * @dev `supported`: Whether the token is supported or not.\n * @dev `permission`: Level of [`TokenPermission`](./enum.TokenPermission.html).\n */\n event TokenSupportChanged(address indexed token, bool supported, TokenPermission permission);\n\n /**\n * @dev Emitted when the support status of an operator changes for a specific protocol.\n * @dev `protocol`: The identification string of the protocol.\n * @dev `operator`: The address of the operator.\n * @dev `supported`: Whether the operator is supported or not.\n */\n event OperatorSupportChanged(string indexed protocol, address indexed operator, bool supported);\n\n /**\n * @notice Update the support status of multiple tokens.\n * @dev Emits a [`TokenSupportChanged()`](#tokensupportchanged) event for each token whose status changed.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if no token status changed.\n * @param _tokens An array of [`WhitelistingTokenRecord`](./struct.WhitelistingTokenRecord.html)\n * structs containing token addresses, support statuses and permissions.\n */\n function updateTokensSupport(WhitelistingTokenRecord[] calldata _tokens) external;\n\n /**\n * @notice Update the support status of a protocol.\n * @dev Emits a [`ProtocolSupportChanged()`](#protocolsupportchanged) event.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if protocol status is up to date.\n * @param _protocol The identification string of the protocol.\n * @param _adapterEvaluator The address of the adapter evaluator for the protocol.\n * @param _supported Whether the protocol is supported or not.\n */\n function updateProtocolSupport(\n string calldata _protocol,\n address _adapterEvaluator,\n bool _supported\n ) external;\n\n /**\n * @notice Update the support status of multiple operators for a specific protocol.\n * @dev Emits a [`OperatorSupportChanged()`](#operatorsupportchanged) event for each token whose status changed.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if no operator status changed.\n * @param _protocol The identification string of the protocol.\n * @param _operators An array of `WhitelistingAddressRecord` structs containing operator addresses and support statuses.\n */\n function updateOperatorsSupport(\n string calldata _protocol,\n WhitelistingAddressRecord[] calldata _operators\n ) external;\n\n /**\n * @notice Ensures that a token has the specified permission level.\n * @dev This check does not enforce exact match, but only that level is sufficient.\n * So if `permission` is TokenPermission.TradeOnly and the token has TokenPermission.Collateral\n * then it assumes that level is sufficient since Collateral level includes both\n * TradeOnly and Collateral levels.\n * @param token The address of the token to check for permission.\n * @param permission The required [`TokenPermission`](TokenPermission) to be enforced.\n */\n function enforceTokenHasPermission(address token, TokenPermission permission) external view;\n\n /**\n * @notice Returns the support status of a token as well as it's permissions.\n * @param _token The address of the token.\n * @return The [`Status`](./enum.Status.html)\n * of the token.\n * @return The [`TokenPermission`](./enum.TokenPermission.html)\n * of the token.\n */\n function getTokenSupport(address _token) external view returns (Status, TokenPermission);\n\n /**\n * @notice Returns the support status of a protocol.\n * @param _protocol The identification string of the protocol.\n * @return The [`Status`](./enum.Status.html)\n * of the protocol.\n */\n function getProtocolStatus(string calldata _protocol) external view returns (Status);\n\n /**\n * @notice Returns the address of the adapter evaluator for a protocol.\n * @param _protocol The identification string of the protocol.\n * @return The address of the adapter evaluator for the protocol.\n */\n function getProtocolEvaluator(string calldata _protocol) external view returns (address);\n\n /**\n * @notice Returns the support status of an operator for a specific protocol.\n * @param _operator The address of the operator.\n * @return operatorStatus_ The [`Status`](./enum.Status.html)\n * of the operator.\n * @return protocolStatus_ The [`Status`](./enum.Status.html)\n * of the protocol.\n */\n function getOperatorStatus(\n address _operator\n ) external view returns (Status operatorStatus_, Status protocolStatus_);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/core/Market/IMarketMathCore.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nstruct MarketState {\n int256 totalPt;\n int256 totalSy;\n int256 totalLp;\n address treasury;\n /// immutable variables ///\n int256 scalarRoot;\n uint256 expiry;\n /// fee data ///\n uint256 lnFeeRateRoot;\n uint256 reserveFeePercent; // base 100\n /// last trade data ///\n uint256 lastLnImpliedRate;\n}\n\n// params that are expensive to compute, therefore we pre-compute them\nstruct MarketPreCompute {\n int256 rateScalar;\n int256 totalAsset;\n int256 rateAnchor;\n int256 feeRate;\n}\n\n// The following library was truncated because it required additional unnecessary imports.\n// Also changed file name from MarketMathCore.sol to IMarketMathCore.sol\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IDiamondLoupe.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/******************************************************************************\\\n* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)\n* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535\n/******************************************************************************/\n\n// A loupe is a small magnifying glass used to look at diamonds.\n// These functions look at diamonds\ninterface IDiamondLoupe {\n /// These functions are expected to be called frequently\n /// by tools.\n\n struct Facet {\n address facetAddress;\n bytes4[] functionSelectors;\n }\n\n /// @notice Gets all facet addresses and their four byte function selectors.\n /// @return facets_ Facet\n function facets() external view returns (Facet[] memory facets_);\n\n /// @notice Gets all the function selectors supported by a specific facet.\n /// @param _facet The facet address.\n /// @return facetFunctionSelectors_\n function facetFunctionSelectors(\n address _facet\n ) external view returns (bytes4[] memory facetFunctionSelectors_);\n\n /// @notice Get all the facet addresses used by a diamond.\n /// @return facetAddresses_\n function facetAddresses() external view returns (address[] memory facetAddresses_);\n\n /// @notice Gets the facet that supports the given selector.\n /// @dev If facet is not found return address(0).\n /// @param _functionSelector The function selector.\n /// @return facetAddress_ The facet address.\n function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPActionAddRemoveLiqV3.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"./IPAllActionTypeV3.sol\";\nimport {ApproxParams} from \"./router/base/IMarketApproxLib.sol\";\n\n/*\n *******************************************************************************************************************\n *******************************************************************************************************************\n * NOTICE *\n * Refer to https://docs.pendle.finance/Developers/Contracts/PendleRouter for more information on\n * TokenInput, TokenOutput, ApproxParams, LimitOrderData\n * It's recommended to use Pendle's Hosted SDK to generate the params\n *******************************************************************************************************************\n *******************************************************************************************************************\n */\n\ninterface IPActionAddRemoveLiqV3 {\n event AddLiquidityDualSyAndPt(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n uint256 netSyUsed,\n uint256 netPtUsed,\n uint256 netLpOut\n );\n\n event AddLiquidityDualTokenAndPt(\n address indexed caller,\n address indexed market,\n address indexed tokenIn,\n address receiver,\n uint256 netTokenUsed,\n uint256 netPtUsed,\n uint256 netLpOut,\n uint256 netSyInterm\n );\n\n event AddLiquiditySinglePt(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n uint256 netPtIn,\n uint256 netLpOut\n );\n\n event AddLiquiditySingleSy(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n uint256 netSyIn,\n uint256 netLpOut\n );\n\n event AddLiquiditySingleToken(\n address indexed caller,\n address indexed market,\n address indexed token,\n address receiver,\n uint256 netTokenIn,\n uint256 netLpOut,\n uint256 netSyInterm\n );\n\n event AddLiquiditySingleSyKeepYt(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n uint256 netSyIn,\n uint256 netSyMintPy,\n uint256 netLpOut,\n uint256 netYtOut\n );\n\n event AddLiquiditySingleTokenKeepYt(\n address indexed caller,\n address indexed market,\n address indexed token,\n address receiver,\n uint256 netTokenIn,\n uint256 netLpOut,\n uint256 netYtOut,\n uint256 netSyMintPy,\n uint256 netSyInterm\n );\n\n event RemoveLiquidityDualSyAndPt(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n uint256 netLpToRemove,\n uint256 netPtOut,\n uint256 netSyOut\n );\n\n event RemoveLiquidityDualTokenAndPt(\n address indexed caller,\n address indexed market,\n address indexed tokenOut,\n address receiver,\n uint256 netLpToRemove,\n uint256 netPtOut,\n uint256 netTokenOut,\n uint256 netSyInterm\n );\n\n event RemoveLiquiditySinglePt(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n uint256 netLpToRemove,\n uint256 netPtOut\n );\n\n event RemoveLiquiditySingleSy(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n uint256 netLpToRemove,\n uint256 netSyOut\n );\n\n event RemoveLiquiditySingleToken(\n address indexed caller,\n address indexed market,\n address indexed token,\n address receiver,\n uint256 netLpToRemove,\n uint256 netTokenOut,\n uint256 netSyInterm\n );\n\n function addLiquidityDualTokenAndPt(\n address receiver,\n address market,\n TokenInput calldata input,\n uint256 netPtDesired,\n uint256 minLpOut\n ) external payable returns (uint256 netLpOut, uint256 netPtUsed, uint256 netSyInterm);\n\n function addLiquidityDualSyAndPt(\n address receiver,\n address market,\n uint256 netSyDesired,\n uint256 netPtDesired,\n uint256 minLpOut\n ) external returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed);\n\n function addLiquiditySinglePt(\n address receiver,\n address market,\n uint256 netPtIn,\n uint256 minLpOut,\n ApproxParams calldata guessPtSwapToSy,\n LimitOrderData calldata limit\n ) external returns (uint256 netLpOut, uint256 netSyFee);\n\n function addLiquiditySingleToken(\n address receiver,\n address market,\n uint256 minLpOut,\n ApproxParams calldata guessPtReceivedFromSy,\n TokenInput calldata input,\n LimitOrderData calldata limit\n ) external payable returns (uint256 netLpOut, uint256 netSyFee, uint256 netSyInterm);\n\n function addLiquiditySingleSy(\n address receiver,\n address market,\n uint256 netSyIn,\n uint256 minLpOut,\n ApproxParams calldata guessPtReceivedFromSy,\n LimitOrderData calldata limit\n ) external returns (uint256 netLpOut, uint256 netSyFee);\n\n function addLiquiditySingleTokenKeepYt(\n address receiver,\n address market,\n uint256 minLpOut,\n uint256 minYtOut,\n TokenInput calldata input\n )\n external\n payable\n returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyMintPy, uint256 netSyInterm);\n\n function addLiquiditySingleSyKeepYt(\n address receiver,\n address market,\n uint256 netSyIn,\n uint256 minLpOut,\n uint256 minYtOut\n ) external returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyMintPy);\n\n function removeLiquidityDualTokenAndPt(\n address receiver,\n address market,\n uint256 netLpToRemove,\n TokenOutput calldata output,\n uint256 minPtOut\n ) external returns (uint256 netTokenOut, uint256 netPtOut, uint256 netSyInterm);\n\n function removeLiquidityDualSyAndPt(\n address receiver,\n address market,\n uint256 netLpToRemove,\n uint256 minSyOut,\n uint256 minPtOut\n ) external returns (uint256 netSyOut, uint256 netPtOut);\n\n function removeLiquiditySinglePt(\n address receiver,\n address market,\n uint256 netLpToRemove,\n uint256 minPtOut,\n ApproxParams calldata guessPtReceivedFromSy,\n LimitOrderData calldata limit\n ) external returns (uint256 netPtOut, uint256 netSyFee);\n\n function removeLiquiditySingleToken(\n address receiver,\n address market,\n uint256 netLpToRemove,\n TokenOutput calldata output,\n LimitOrderData calldata limit\n ) external returns (uint256 netTokenOut, uint256 netSyFee, uint256 netSyInterm);\n\n function removeLiquiditySingleSy(\n address receiver,\n address market,\n uint256 netLpToRemove,\n uint256 minSyOut,\n LimitOrderData calldata limit\n ) external returns (uint256 netSyOut, uint256 netSyFee);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPActionCallbackV3.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"./IPLimitRouter.sol\";\nimport \"./IPMarketSwapCallback.sol\";\n\ninterface IPActionCallbackV3 is IPMarketSwapCallback, IPLimitRouterCallback {}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPActionMiscV3.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"./IPAllActionTypeV3.sol\";\nimport {ApproxParams} from \"./router/base/IMarketApproxLib.sol\";\n\n/*\n *******************************************************************************************************************\n *******************************************************************************************************************\n * NOTICE *\n * Refer to https://docs.pendle.finance/Developers/Contracts/PendleRouter for more information on\n * TokenInput, TokenOutput, ApproxParams, LimitOrderData\n * It's recommended to use Pendle's Hosted SDK to generate the params\n *******************************************************************************************************************\n *******************************************************************************************************************\n */\n\ninterface IPActionMiscV3 {\n struct Call3 {\n bool allowFailure;\n bytes callData;\n }\n\n struct Result {\n bool success;\n bytes returnData;\n }\n\n event MintSyFromToken(\n address indexed caller,\n address indexed tokenIn,\n address indexed SY,\n address receiver,\n uint256 netTokenIn,\n uint256 netSyOut\n );\n\n event RedeemSyToToken(\n address indexed caller,\n address indexed tokenOut,\n address indexed SY,\n address receiver,\n uint256 netSyIn,\n uint256 netTokenOut\n );\n\n event MintPyFromSy(\n address indexed caller,\n address indexed receiver,\n address indexed YT,\n uint256 netSyIn,\n uint256 netPyOut\n );\n\n event RedeemPyToSy(\n address indexed caller,\n address indexed receiver,\n address indexed YT,\n uint256 netPyIn,\n uint256 netSyOut\n );\n\n event MintPyFromToken(\n address indexed caller,\n address indexed tokenIn,\n address indexed YT,\n address receiver,\n uint256 netTokenIn,\n uint256 netPyOut,\n uint256 netSyInterm\n );\n\n event RedeemPyToToken(\n address indexed caller,\n address indexed tokenOut,\n address indexed YT,\n address receiver,\n uint256 netPyIn,\n uint256 netTokenOut,\n uint256 netSyInterm\n );\n\n function mintSyFromToken(\n address receiver,\n address SY,\n uint256 minSyOut,\n TokenInput calldata input\n ) external payable returns (uint256 netSyOut);\n\n function redeemSyToToken(\n address receiver,\n address SY,\n uint256 netSyIn,\n TokenOutput calldata output\n ) external returns (uint256 netTokenOut);\n\n function mintPyFromToken(\n address receiver,\n address YT,\n uint256 minPyOut,\n TokenInput calldata input\n ) external payable returns (uint256 netPyOut, uint256 netSyInterm);\n\n function redeemPyToToken(\n address receiver,\n address YT,\n uint256 netPyIn,\n TokenOutput calldata output\n ) external returns (uint256 netTokenOut, uint256 netSyInterm);\n\n function mintPyFromSy(\n address receiver,\n address YT,\n uint256 netSyIn,\n uint256 minPyOut\n ) external returns (uint256 netPyOut);\n\n function redeemPyToSy(\n address receiver,\n address YT,\n uint256 netPyIn,\n uint256 minSyOut\n ) external returns (uint256 netSyOut);\n\n function redeemDueInterestAndRewards(\n address user,\n address[] calldata sys,\n address[] calldata yts,\n address[] calldata markets\n ) external;\n\n function swapTokenToToken(\n address receiver,\n uint256 minTokenOut,\n TokenInput calldata inp\n ) external payable returns (uint256 netTokenOut);\n\n function swapTokenToTokenViaSy(\n address receiver,\n address SY,\n TokenInput calldata input,\n address tokenRedeemSy,\n uint256 minTokenOut\n ) external payable returns (uint256 netTokenOut, uint256 netSyInterm);\n\n function boostMarkets(address[] memory markets) external;\n\n function multicall(Call3[] calldata calls) external payable returns (Result[] memory res);\n\n function simulate(address target, bytes calldata data) external payable;\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPActionSwapPTV3.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"./IPAllActionTypeV3.sol\";\nimport {ApproxParams} from \"./router/base/IMarketApproxLib.sol\";\n\n/*\n *******************************************************************************************************************\n *******************************************************************************************************************\n * NOTICE *\n * Refer to https://docs.pendle.finance/Developers/Contracts/PendleRouter for more information on\n * TokenInput, TokenOutput, ApproxParams, LimitOrderData\n * It's recommended to use Pendle's Hosted SDK to generate the params\n *******************************************************************************************************************\n *******************************************************************************************************************\n */\n\ninterface IPActionSwapPTV3 {\n event SwapPtAndSy(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n int256 netPtToAccount,\n int256 netSyToAccount\n );\n\n event SwapPtAndToken(\n address indexed caller,\n address indexed market,\n address indexed token,\n address receiver,\n int256 netPtToAccount,\n int256 netTokenToAccount,\n uint256 netSyInterm\n );\n\n function swapExactTokenForPt(\n address receiver,\n address market,\n uint256 minPtOut,\n ApproxParams calldata guessPtOut,\n TokenInput calldata input,\n LimitOrderData calldata limit\n ) external payable returns (uint256 netPtOut, uint256 netSyFee, uint256 netSyInterm);\n\n function swapExactSyForPt(\n address receiver,\n address market,\n uint256 exactSyIn,\n uint256 minPtOut,\n ApproxParams calldata guessPtOut,\n LimitOrderData calldata limit\n ) external returns (uint256 netPtOut, uint256 netSyFee);\n\n function swapExactPtForToken(\n address receiver,\n address market,\n uint256 exactPtIn,\n TokenOutput calldata output,\n LimitOrderData calldata limit\n ) external returns (uint256 netTokenOut, uint256 netSyFee, uint256 netSyInterm);\n\n function swapExactPtForSy(\n address receiver,\n address market,\n uint256 exactPtIn,\n uint256 minSyOut,\n LimitOrderData calldata limit\n ) external returns (uint256 netSyOut, uint256 netSyFee);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPActionSwapYTV3.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"./IPAllActionTypeV3.sol\";\nimport {ApproxParams} from \"./router/base/IMarketApproxLib.sol\";\n\n/*\n *******************************************************************************************************************\n *******************************************************************************************************************\n * NOTICE *\n * Refer to https://docs.pendle.finance/Developers/Contracts/PendleRouter for more information on\n * TokenInput, TokenOutput, ApproxParams, LimitOrderData\n * It's recommended to use Pendle's Hosted SDK to generate the params\n *******************************************************************************************************************\n *******************************************************************************************************************\n */\n\ninterface IPActionSwapYTV3 {\n event SwapYtAndSy(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n int256 netYtToAccount,\n int256 netSyToAccount\n );\n\n event SwapYtAndToken(\n address indexed caller,\n address indexed market,\n address indexed token,\n address receiver,\n int256 netYtToAccount,\n int256 netTokenToAccount,\n uint256 netSyInterm\n );\n\n event SwapPtAndYt(\n address indexed caller,\n address indexed market,\n address indexed receiver,\n int256 netPtToAccount,\n int256 netYtToAccount\n );\n\n function swapExactTokenForYt(\n address receiver,\n address market,\n uint256 minYtOut,\n ApproxParams calldata guessYtOut,\n TokenInput calldata input,\n LimitOrderData calldata limit\n ) external payable returns (uint256 netYtOut, uint256 netSyFee, uint256 netSyInterm);\n\n function swapExactSyForYt(\n address receiver,\n address market,\n uint256 exactSyIn,\n uint256 minYtOut,\n ApproxParams calldata guessYtOut,\n LimitOrderData calldata limit\n ) external returns (uint256 netYtOut, uint256 netSyFee);\n\n function swapExactYtForToken(\n address receiver,\n address market,\n uint256 exactYtIn,\n TokenOutput calldata output,\n LimitOrderData calldata limit\n ) external returns (uint256 netTokenOut, uint256 netSyFee, uint256 netSyInterm);\n\n function swapExactYtForSy(\n address receiver,\n address market,\n uint256 exactYtIn,\n uint256 minSyOut,\n LimitOrderData calldata limit\n ) external returns (uint256 netSyOut, uint256 netSyFee);\n\n function swapExactPtForYt(\n address receiver,\n address market,\n uint256 exactPtIn,\n uint256 minYtOut,\n ApproxParams calldata guessTotalPtToSwap\n ) external returns (uint256 netYtOut, uint256 netSyFee);\n\n function swapExactYtForPt(\n address receiver,\n address market,\n uint256 exactYtIn,\n uint256 minPtOut,\n ApproxParams calldata guessTotalPtFromSwap\n ) external returns (uint256 netPtOut, uint256 netSyFee);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPAllActionTypeV3.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"./IPLimitRouter.sol\";\nimport \"./router/swap-aggregator/IPSwapAggregator.sol\";\n\n/*\n *******************************************************************************************************************\n *******************************************************************************************************************\n * NOTICE *\n * Refer to https://docs.pendle.finance/Developers/Contracts/PendleRouter for more information on\n * TokenInput, TokenOutput, ApproxParams, LimitOrderData\n * It's recommended to use Pendle's Hosted SDK to generate the params\n *******************************************************************************************************************\n *******************************************************************************************************************\n */\n\nstruct TokenInput {\n // TOKEN DATA\n address tokenIn;\n uint256 netTokenIn;\n address tokenMintSy;\n // AGGREGATOR DATA\n address pendleSwap;\n SwapData swapData;\n}\n\nstruct TokenOutput {\n // TOKEN DATA\n address tokenOut;\n uint256 minTokenOut;\n address tokenRedeemSy;\n // AGGREGATOR DATA\n address pendleSwap;\n SwapData swapData;\n}\n\nstruct LimitOrderData {\n address limitRouter;\n uint256 epsSkipMarket; // only used for swap operations, will be ignored otherwise\n FillOrderParams[] normalFills;\n FillOrderParams[] flashFills;\n bytes optData;\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPAllActionV3.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"./IDiamondLoupe.sol\";\nimport \"./IPActionAddRemoveLiqV3.sol\";\nimport \"./IPActionCallbackV3.sol\";\nimport \"./IPActionMiscV3.sol\";\nimport \"./IPActionSwapPTV3.sol\";\nimport \"./IPActionSwapYTV3.sol\";\n\ninterface IPAllActionV3 is\n IPActionAddRemoveLiqV3,\n IPActionSwapPTV3,\n IPActionSwapYTV3,\n IPActionMiscV3,\n IPActionCallbackV3,\n IDiamondLoupe\n{}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPGauge.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IPGauge {\n function totalActiveSupply() external view returns (uint256);\n\n function activeBalance(address user) external view returns (uint256);\n\n // only available for newer factories. please check the verified contracts\n event RedeemRewards(address indexed user, uint256[] rewardsOut);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPInterestManagerYT.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IPInterestManagerYT {\n event CollectInterestFee(uint256 amountInterestFee);\n\n function userInterest(\n address user\n ) external view returns (uint128 lastPYIndex, uint128 accruedInterest);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPLimitRouter.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n// import \"../core/StandardizedYield/PYIndex.sol\"; // commented out unused import\n\ninterface IPLimitOrderType {\n enum OrderType {\n SY_FOR_PT,\n PT_FOR_SY,\n SY_FOR_YT,\n YT_FOR_SY\n }\n\n // Fixed-size order part with core information\n struct StaticOrder {\n uint256 salt;\n uint256 expiry;\n uint256 nonce;\n OrderType orderType;\n address token;\n address YT;\n address maker;\n address receiver;\n uint256 makingAmount;\n uint256 lnImpliedRate;\n uint256 failSafeRate;\n }\n\n struct FillResults {\n uint256 totalMaking;\n uint256 totalTaking;\n uint256 totalFee;\n uint256 totalNotionalVolume;\n uint256[] netMakings;\n uint256[] netTakings;\n uint256[] netFees;\n uint256[] notionalVolumes;\n }\n}\n\nstruct Order {\n uint256 salt;\n uint256 expiry;\n uint256 nonce;\n IPLimitOrderType.OrderType orderType;\n address token;\n address YT;\n address maker;\n address receiver;\n uint256 makingAmount;\n uint256 lnImpliedRate;\n uint256 failSafeRate;\n bytes permit;\n}\n\nstruct FillOrderParams {\n Order order;\n bytes signature;\n uint256 makingAmount;\n}\n\ninterface IPLimitRouterCallback is IPLimitOrderType {\n function limitRouterCallback(\n uint256 actualMaking,\n uint256 actualTaking,\n uint256 totalFee,\n bytes memory data\n ) external returns (bytes memory);\n}\n\ninterface IPLimitRouter is IPLimitOrderType {\n struct OrderStatus {\n uint128 filledAmount;\n uint128 remaining;\n }\n\n event OrderCanceled(address indexed maker, bytes32 indexed orderHash);\n\n event OrderFilledV2(\n bytes32 indexed orderHash,\n OrderType indexed orderType,\n address indexed YT,\n address token,\n uint256 netInputFromMaker,\n uint256 netOutputToMaker,\n uint256 feeAmount,\n uint256 notionalVolume,\n address maker,\n address taker\n );\n\n // @dev actualMaking, actualTaking are in the SY form\n function fill(\n FillOrderParams[] memory params,\n address receiver,\n uint256 maxTaking,\n bytes calldata optData,\n bytes calldata callback\n )\n external\n returns (\n uint256 actualMaking,\n uint256 actualTaking,\n uint256 totalFee,\n bytes memory callbackReturn\n );\n\n function feeRecipient() external view returns (address);\n\n function hashOrder(Order memory order) external view returns (bytes32);\n\n function cancelSingle(Order calldata order) external;\n\n function cancelBatch(Order[] calldata orders) external;\n\n function orderStatusesRaw(\n bytes32[] memory orderHashes\n ) external view returns (uint256[] memory remainingsRaw, uint256[] memory filledAmounts);\n\n function orderStatuses(\n bytes32[] memory orderHashes\n ) external view returns (uint256[] memory remainings, uint256[] memory filledAmounts);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function simulate(address target, bytes calldata data) external payable;\n\n /* --- Deprecated events --- */\n\n // deprecate on 7/1/2024, prior to official launch\n event OrderFilled(\n bytes32 indexed orderHash,\n OrderType indexed orderType,\n address indexed YT,\n address token,\n uint256 netInputFromMaker,\n uint256 netOutputToMaker,\n uint256 feeAmount,\n uint256 notionalVolume\n );\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPMarket.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\nimport \"./core/Market/IMarketMathCore.sol\";\nimport \"./IPGauge.sol\";\nimport \"./IPPrincipalToken.sol\";\nimport \"./IPYieldToken.sol\";\nimport \"./IStandardizedYield.sol\";\n\ninterface IPMarket is IERC20Metadata, IPGauge {\n event Mint(address indexed receiver, uint256 netLpMinted, uint256 netSyUsed, uint256 netPtUsed);\n\n event Burn(\n address indexed receiverSy,\n address indexed receiverPt,\n uint256 netLpBurned,\n uint256 netSyOut,\n uint256 netPtOut\n );\n\n event Swap(\n address indexed caller,\n address indexed receiver,\n int256 netPtOut,\n int256 netSyOut,\n uint256 netSyFee,\n uint256 netSyToReserve\n );\n\n event UpdateImpliedRate(uint256 indexed timestamp, uint256 lnLastImpliedRate);\n\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n function mint(\n address receiver,\n uint256 netSyDesired,\n uint256 netPtDesired\n ) external returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed);\n\n function burn(\n address receiverSy,\n address receiverPt,\n uint256 netLpToBurn\n ) external returns (uint256 netSyOut, uint256 netPtOut);\n\n function swapExactPtForSy(\n address receiver,\n uint256 exactPtIn,\n bytes calldata data\n ) external returns (uint256 netSyOut, uint256 netSyFee);\n\n function swapSyForExactPt(\n address receiver,\n uint256 exactPtOut,\n bytes calldata data\n ) external returns (uint256 netSyIn, uint256 netSyFee);\n\n function redeemRewards(address user) external returns (uint256[] memory);\n\n function readState(address router) external view returns (MarketState memory market);\n\n function observe(\n uint32[] memory secondsAgos\n ) external view returns (uint216[] memory lnImpliedRateCumulative);\n\n function increaseObservationsCardinalityNext(uint16 cardinalityNext) external;\n\n function readTokens()\n external\n view\n returns (IStandardizedYield _SY, IPPrincipalToken _PT, IPYieldToken _YT);\n\n function getRewardTokens() external view returns (address[] memory);\n\n function isExpired() external view returns (bool);\n\n function expiry() external view returns (uint256);\n\n function observations(\n uint256 index\n )\n external\n view\n returns (uint32 blockTimestamp, uint216 lnImpliedRateCumulative, bool initialized);\n\n function _storage()\n external\n view\n returns (\n int128 totalPt,\n int128 totalSy,\n uint96 lastLnImpliedRate,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext\n );\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPMarketSwapCallback.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IPMarketSwapCallback {\n function swapCallback(int256 ptToAccount, int256 syToAccount, bytes calldata data) external;\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPPrincipalToken.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\ninterface IPPrincipalToken is IERC20Metadata {\n function burnByYT(address user, uint256 amount) external;\n\n function mintByYT(address user, uint256 amount) external;\n\n function initialize(address _YT) external;\n\n function SY() external view returns (address);\n\n function YT() external view returns (address);\n\n function factory() external view returns (address);\n\n function expiry() external view returns (uint256);\n\n function isExpired() external view returns (bool);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IPYieldToken.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"./IPInterestManagerYT.sol\";\nimport \"./IRewardManager.sol\";\n\ninterface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT {\n event NewInterestIndex(uint256 indexed newIndex);\n\n event Mint(\n address indexed caller,\n address indexed receiverPT,\n address indexed receiverYT,\n uint256 amountSyToMint,\n uint256 amountPYOut\n );\n\n event Burn(\n address indexed caller,\n address indexed receiver,\n uint256 amountPYToRedeem,\n uint256 amountSyOut\n );\n\n event RedeemRewards(address indexed user, uint256[] amountRewardsOut);\n\n event RedeemInterest(address indexed user, uint256 interestOut);\n\n event CollectRewardFee(address indexed rewardToken, uint256 amountRewardFee);\n\n function mintPY(address receiverPT, address receiverYT) external returns (uint256 amountPYOut);\n\n function redeemPY(address receiver) external returns (uint256 amountSyOut);\n\n function redeemPYMulti(\n address[] calldata receivers,\n uint256[] calldata amountPYToRedeems\n ) external returns (uint256[] memory amountSyOuts);\n\n function redeemDueInterestAndRewards(\n address user,\n bool redeemInterest,\n bool redeemRewards\n ) external returns (uint256 interestOut, uint256[] memory rewardsOut);\n\n function rewardIndexesCurrent() external returns (uint256[] memory);\n\n function pyIndexCurrent() external returns (uint256);\n\n function pyIndexStored() external view returns (uint256);\n\n function getRewardTokens() external view returns (address[] memory);\n\n function SY() external view returns (address);\n\n function PT() external view returns (address);\n\n function factory() external view returns (address);\n\n function expiry() external view returns (uint256);\n\n function isExpired() external view returns (bool);\n\n function doCacheIndexSameBlock() external view returns (bool);\n\n function pyIndexLastUpdatedBlock() external view returns (uint128);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IRewardManager.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IRewardManager {\n function userReward(\n address token,\n address user\n ) external view returns (uint128 index, uint128 accrued);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/IStandardizedYield.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n/*\n * MIT License\n * ===========\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n */\n\npragma solidity ^0.8.0;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\ninterface IStandardizedYield is IERC20Metadata {\n /// @dev Emitted when any base tokens is deposited to mint shares\n event Deposit(\n address indexed caller,\n address indexed receiver,\n address indexed tokenIn,\n uint256 amountDeposited,\n uint256 amountSyOut\n );\n\n /// @dev Emitted when any shares are redeemed for base tokens\n event Redeem(\n address indexed caller,\n address indexed receiver,\n address indexed tokenOut,\n uint256 amountSyToRedeem,\n uint256 amountTokenOut\n );\n\n /// @dev check `assetInfo()` for more information\n enum AssetType {\n TOKEN,\n LIQUIDITY\n }\n\n /// @dev Emitted when (`user`) claims their rewards\n event ClaimRewards(address indexed user, address[] rewardTokens, uint256[] rewardAmounts);\n\n /**\n * @notice mints an amount of shares by depositing a base token.\n * @param receiver shares recipient address\n * @param tokenIn address of the base tokens to mint shares\n * @param amountTokenToDeposit amount of base tokens to be transferred from (`msg.sender`)\n * @param minSharesOut reverts if amount of shares minted is lower than this\n * @return amountSharesOut amount of shares minted\n * @dev Emits a {Deposit} event\n *\n * Requirements:\n * - (`tokenIn`) must be a valid base token.\n */\n function deposit(\n address receiver,\n address tokenIn,\n uint256 amountTokenToDeposit,\n uint256 minSharesOut\n ) external payable returns (uint256 amountSharesOut);\n\n /**\n * @notice redeems an amount of base tokens by burning some shares\n * @param receiver recipient address\n * @param amountSharesToRedeem amount of shares to be burned\n * @param tokenOut address of the base token to be redeemed\n * @param minTokenOut reverts if amount of base token redeemed is lower than this\n * @param burnFromInternalBalance if true, burns from balance of `address(this)`, otherwise burns from `msg.sender`\n * @return amountTokenOut amount of base tokens redeemed\n * @dev Emits a {Redeem} event\n *\n * Requirements:\n * - (`tokenOut`) must be a valid base token.\n */\n function redeem(\n address receiver,\n uint256 amountSharesToRedeem,\n address tokenOut,\n uint256 minTokenOut,\n bool burnFromInternalBalance\n ) external returns (uint256 amountTokenOut);\n\n /**\n * @notice exchangeRate * syBalance / 1e18 must return the asset balance of the account\n * @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of sy\n he can mint must be X * exchangeRate / 1e18\n * @dev SYUtils's assetToSy & syToAsset should be used instead of raw multiplication\n & division\n */\n function exchangeRate() external view returns (uint256 res);\n\n /**\n * @notice claims reward for (`user`)\n * @param user the user receiving their rewards\n * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`\n * @dev\n * Emits a `ClaimRewards` event\n * See {getRewardTokens} for list of reward tokens\n */\n function claimRewards(address user) external returns (uint256[] memory rewardAmounts);\n\n /**\n * @notice get the amount of unclaimed rewards for (`user`)\n * @param user the user to check for\n * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`\n */\n function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts);\n\n function rewardIndexesCurrent() external returns (uint256[] memory indexes);\n\n function rewardIndexesStored() external view returns (uint256[] memory indexes);\n\n /**\n * @notice returns the list of reward token addresses\n */\n function getRewardTokens() external view returns (address[] memory);\n\n /**\n * @notice returns the address of the underlying yield token\n */\n function yieldToken() external view returns (address);\n\n /**\n * @notice returns all tokens that can mint this SY\n */\n function getTokensIn() external view returns (address[] memory res);\n\n /**\n * @notice returns all tokens that can be redeemed by this SY\n */\n function getTokensOut() external view returns (address[] memory res);\n\n function isValidTokenIn(address token) external view returns (bool);\n\n function isValidTokenOut(address token) external view returns (bool);\n\n function previewDeposit(\n address tokenIn,\n uint256 amountTokenToDeposit\n ) external view returns (uint256 amountSharesOut);\n\n function previewRedeem(\n address tokenOut,\n uint256 amountSharesToRedeem\n ) external view returns (uint256 amountTokenOut);\n\n /**\n * @notice This function contains information to interpret what the asset is\n * @return assetType the type of the asset (0 for ERC20 tokens, 1 for AMM liquidity tokens,\n 2 for bridged yield bearing tokens like wstETH, rETH on Arbi whose the underlying asset doesn't exist on the chain)\n * @return assetAddress the address of the asset\n * @return assetDecimals the decimals of the asset\n */\n function assetInfo()\n external\n view\n returns (AssetType assetType, address assetAddress, uint8 assetDecimals);\n}\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/router/base/IMarketApproxLib.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nstruct ApproxParams {\n uint256 guessMin;\n uint256 guessMax;\n uint256 guessOffchain; // pass 0 in to skip this variable\n uint256 maxIteration; // every iteration, the diff between guessMin and guessMax will be divided by 2\n uint256 eps; // the max eps between the returned result & the correct result, base 1e18. Normally this number will be set\n // to 1e15 (1e18/1000 = 0.1%)\n}\n\n// The following library was truncated because it required additional unnecessary imports.\n// Also changed file name from MarketApproxLib.sol to IMarketApproxLib.sol\n"
},
"contracts/interfaces/accountAbstraction/compliance/pendle/router/swap-aggregator/IPSwapAggregator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nstruct SwapData {\n SwapType swapType;\n address extRouter;\n bytes extCalldata;\n bool needScale;\n}\n\nenum SwapType {\n NONE,\n KYBERSWAP,\n ONE_INCH,\n // ETH_WETH not used in Aggregator\n ETH_WETH\n}\n\ninterface IPSwapAggregator {\n function swap(address tokenIn, uint256 amountIn, SwapData calldata swapData) external payable;\n}\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/ILiquidityPoolsRepository.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/* solhint-disable no-unused-import */\nimport {\n Status,\n TokenIsNotSupported\n} from \"contracts/interfaces/accountAbstraction/compliance/IWhitelistingController.sol\";\nimport {AlreadyUpToDate} from \"contracts/interfaces/base/CommonErrors.sol\";\n/* solhint-enable no-unused-import */\n\n/**\n * @notice Error indicating that the pool ID was not found.\n * @param encodedPool The encoded pool data that was searched for.\n */\nerror PoolIdNotFound(bytes encodedPool);\n\n/**\n * @notice Error indicating that the pool does not exist.\n * @param poolId The unique identifier of the pool that was searched for.\n */\nerror PoolIsNotSupported(uint256 poolId);\n\n/**\n * @notice Error indicating that the pool is suspended.\n * @param poolId The unique identifier of the pool that is suspended.\n */\nerror PoolIsSuspended(uint256 poolId);\n\n/**\n * @title ILiquidityPoolsRepository\n * @notice Interface for managing liquidity pools and their support status.\n */\ninterface ILiquidityPoolsRepository {\n /**\n * @notice Update the support status of a liquidity pool.\n * @param _encodedPool The encoded pool data.\n * @param _supported Whether the pool is supported or not.\n * @return poolId_ The unique identifier of the pool.\n * @dev Reverts with a [`PoolIdNotFound()`](/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol/error.PoolIdNotFound.html)\n * error if the pool does not exist.\n */\n function updatePoolSupport(\n bytes calldata _encodedPool,\n bool _supported\n ) external returns (uint256 poolId_);\n\n /**\n * @notice Get the status of a specific pool.\n * @param _poolId The unique identifier of the pool.\n * @return status The status of the pool.\n * @dev Reverts with a [`PoolIsNotSupported()`](/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol/error.PoolIsNotSupported.html)\n * error if the pool does not exist.\n */\n function getPoolStatus(uint256 _poolId) external returns (Status status);\n\n /**\n * @notice Get the unique identifier (pool ID) of a specific pool.\n * @param _encodedPool The encoded pool data.\n * @return poolId_ The unique identifier of the pool.\n * @dev Reverts with a [`PoolIsNotSupported()`](/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol/error.PoolIsNotSupported.html)\n * error if the pool does not exist.\n */\n function getPoolId(bytes calldata _encodedPool) external view returns (uint256 poolId_);\n}\n"
},
"contracts/interfaces/accountAbstraction/interpreter/adapters/index.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IDecreasePositionEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/IDecreasePositionEvaluator.sol\";\nimport {\n IExchangeEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/IExchangeEvaluator.sol\";\nimport {\n IIncreasePositionEvaluator\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/IIncreasePositionEvaluator.sol\";\nimport {\n AlreadyUpToDate,\n ILiquidityPoolsRepository,\n PoolIdNotFound,\n PoolIsNotSupported,\n PoolIsSuspended,\n Status,\n TokenIsNotSupported\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/ILiquidityPoolsRepository.sol\";\nimport {\n PositionDescriptor\n} from \"contracts/interfaces/accountAbstraction/interpreter/adapters/PositionDescriptor.sol\";\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/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/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/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/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": {}
}
}}
|
1 | 20,290,253 |
14a71ff49fc0088e4a6e2533322598619cc875a94327197b0fa35ca81dcbd4e7
|
e57e717bdbf97c75a3b6316acbdf52a9d1103a3903f9971a739a7c2a5b4b98eb
|
be49bd130e126a917ddb5fabf7cdeb6dd9887f40
|
84654be796dad370032391d5479f8f1fd9ddd14e
|
bb467c30ae35357a9308c91d6b5d2715ef233b12
|
604080600a3d393df3fe73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
|
73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
| |
1 | 20,290,257 |
0d853e1cc043f54a637489f259fbd53cb3bc428a59d9cb6484e2fe8c7fda639f
|
db773bb31386e116a97fc251345f51203f255d743d26c41d53ea23534932efb0
|
07ca54b301deca9c8bc9af4e4cd6a87531018031
|
07042134d4dc295cbf3ab08a4a0eff847a528171
|
591f0c5702776de20d55c86ee46a88f920f41578
|
608060405234801561001057600080fd5b5060405161020538038061020583398101604081905261002f916101d4565b8060005b604051636312ab1360e11b8152600481018290526000906001600160a01b0384169063c625562690602401602060405180830381865afa15801561007b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061009f91906101d4565b6001600160a01b0316146101475761013f82600019846001600160a01b031663c6255626856040518263ffffffff1660e01b81526004016100e291815260200190565b602060405180830381865afa1580156100ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012391906101d4565b6001600160a01b031661014a60201b610009179092919060201c565b600101610033565b33ff5b600060405163095ea7b360e01b81526001600160a01b0384166004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806101ce5760405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b604482015260640160405180910390fd5b50505050565b6000602082840312156101e657600080fd5b81516001600160a01b03811681146101fd57600080fd5b939250505056fe00000000000000000000000007042134d4dc295cbf3ab08a4a0eff847a528171
| ||
1 | 20,290,258 |
b17aff2cde7a43a9848617497b25c7a370356390f050956a3a953819e0c44fb0
|
71b1614c5512cc659514f0fb73973d3629e11ccc74f5e88b00dea623a408b303
|
afb73d5cdbb46780b72ec5b15c143b6bda322e5f
|
afb73d5cdbb46780b72ec5b15c143b6bda322e5f
|
05b65502f3a18391927ffced33d623004bf5933b
|
6080604052601760055560176006555f6007555f60085560176009556017600a556017600b555f600c556009600a62000039919062000330565b6200004a906401f4add40062000347565b600d556200005b6009600a62000330565b6200006c906401f4add40062000347565b600e556200007d6009600a62000330565b6200008d9063fa56ea0062000347565b600f556200009e6009600a62000330565b620000af906401f4add40062000347565b6010556012805461ffff60a81b191690555f6013819055601455348015620000d5575f80fd5b505f80546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600480546001600160a01b03191633179055620001366009600a62000330565b62000147906461f313f88062000347565b305f908152600160208190526040822092909255600390620001705f546001600160a01b031690565b6001600160a01b03908116825260208083019390935260409182015f908120805495151560ff199687161790553080825260039094528281208054861660019081179091556004549092168152918220805490941617909255907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef620001f96009600a62000330565b6200020a906461f313f88062000347565b60405190815260200160405180910390a362000361565b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156200027557815f190482111562000259576200025962000221565b808516156200026757918102915b93841c93908002906200023a565b509250929050565b5f826200028d575060016200032a565b816200029b57505f6200032a565b8160018114620002b45760028114620002bf57620002df565b60019150506200032a565b60ff841115620002d357620002d362000221565b50506001821b6200032a565b5060208310610133831016604e8410600b841016171562000304575081810a6200032a565b62000310838362000235565b805f190482111562000326576200032662000221565b0290505b92915050565b5f6200034060ff8416836200027d565b9392505050565b80820281158282048414176200032a576200032a62000221565b611942806200036f5f395ff3fe60806040526004361061011e575f3560e01c80637d1db4a51161009d578063a9059cbb11610062578063a9059cbb1461031b578063bf474bed1461033a578063c9567bf91461034f578063dd62ed3e14610357578063ec1f3f631461039b575f80fd5b80637d1db4a51461027e5780638cd4426d146102935780638da5cb5b146102b25780638f9a55c0146102d857806395d89b41146102ed575f80fd5b8063313ce567116100e3578063313ce567146101f157806351bc3c851461020c578063622565891461022257806370a0823114610236578063715018a61461026a575f80fd5b806306fdde0314610129578063095ea7b31461016c5780630faee56f1461019b57806318160ddd146101be57806323b872dd146101d2575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b506040805180820190915260098152684d696e69205065706560b81b60208201525b6040516101639190611504565b60405180910390f35b348015610177575f80fd5b5061018b610186366004611567565b6103ba565b6040519015158152602001610163565b3480156101a6575f80fd5b506101b060105481565b604051908152602001610163565b3480156101c9575f80fd5b506101b06103d0565b3480156101dd575f80fd5b5061018b6101ec366004611591565b6103f1565b3480156101fc575f80fd5b5060405160098152602001610163565b348015610217575f80fd5b50610220610458565b005b34801561022d575f80fd5b506102206104c0565b348015610241575f80fd5b506101b06102503660046115cf565b6001600160a01b03165f9081526001602052604090205490565b348015610275575f80fd5b5061022061057d565b348015610289575f80fd5b506101b0600d5481565b34801561029e575f80fd5b506102206102ad366004611567565b6105ee565b3480156102bd575f80fd5b505f546040516001600160a01b039091168152602001610163565b3480156102e3575f80fd5b506101b0600e5481565b3480156102f8575f80fd5b50604080518082019091526006815265454c5341504f60d01b6020820152610156565b348015610326575f80fd5b5061018b610335366004611567565b61070e565b348015610345575f80fd5b506101b0600f5481565b61022061071a565b348015610362575f80fd5b506101b06103713660046115ea565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b3480156103a6575f80fd5b506102206103b5366004611621565b610ac4565b5f6103c6338484610ae8565b5060015b92915050565b5f6103dd6009600a61172c565b6103ec906461f313f88061173a565b905090565b5f6103fd848484610c0b565b61044e8433610449856040518060600160405280602881526020016118e5602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611180565b610ae8565b5060019392505050565b6004546001600160a01b0316336001600160a01b031614610477575f80fd5b305f90815260016020526040902054801580159061049e5750601254600160b01b900460ff165b156104ac576104ac816111b8565b4780156104bc576104bc81611328565b5050565b5f546001600160a01b031633146104f25760405162461bcd60e51b81526004016104e990611751565b60405180910390fd5b6104fe6009600a61172c565b61050d906461f313f88061173a565b600d5561051c6009600a61172c565b61052b906461f313f88061173a565b600e557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf61055b6009600a61172c565b61056a906461f313f88061173a565b60405190815260200160405180910390a1565b5f546001600160a01b031633146105a65760405162461bcd60e51b81526004016104e990611751565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b6004546001600160a01b0316336001600160a01b03161461060d575f80fd5b6040516370a0823160e01b81523060048201525f9061068e906064906106889085906001600160a01b038816906370a0823190602401602060405180830381865afa15801561065e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106829190611786565b9061135f565b906113e4565b6004805460405163a9059cbb60e01b81526001600160a01b0391821692810192909252602482018390529192509084169063a9059cbb906044016020604051808303815f875af11580156106e4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610708919061179d565b50505050565b5f6103c6338484610c0b565b5f546001600160a01b031633146107435760405162461bcd60e51b81526004016104e990611751565b601254600160a01b900460ff161561079d5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104e9565b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107e79030906107d86009600a61172c565b610449906461f313f88061173a565b60115f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610837573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061085b91906117bc565b6001600160a01b031663c9c653963060115f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108de91906117bc565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af1158015610928573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061094c91906117bc565b601280546001600160a01b039283166001600160a01b03199091161790556011541663f305d7193430610993816001600160a01b03165f9081526001602052604090205490565b5f806109a65f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a0c573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610a3191906117d7565b505060125460115460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610a86573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aaa919061179d565b506012805462ff00ff60a01b19166201000160a01b179055565b6004546001600160a01b0316336001600160a01b031614610ae3575f80fd5b600855565b6001600160a01b038316610b4a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104e9565b6001600160a01b038216610bab5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104e9565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c6f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104e9565b6001600160a01b038216610cd15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104e9565b5f8111610d325760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104e9565b5f80546001600160a01b03858116911614801590610d5d57505f546001600160a01b03848116911614155b8015610d7757506004546001600160a01b03848116911614155b1561104357610da26064610688600954600c5411610d9757600554610d9b565b6007545b859061135f565b6012549091506001600160a01b038581169116148015610dd057506011546001600160a01b03848116911614155b8015610df457506001600160a01b0383165f9081526003602052604090205460ff16155b15610eda57600d54821115610e4b5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104e9565b600e5482610e6d856001600160a01b03165f9081526001602052604090205490565b610e779190611802565b1115610ec55760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104e9565b600c8054905f610ed483611815565b91905055505b6012546001600160a01b038481169116148015610f0057506001600160a01b0384163014155b15610f2d57610f2a6064610688600a54600c5411610f2057600654610d9b565b600854859061135f565b90505b305f90815260016020526040902054601254600160a81b900460ff16158015610f6357506012546001600160a01b038581169116145b8015610f785750601254600160b01b900460ff165b8015610f855750600f5481115b8015610f945750600b54600c54115b1561104157601454431115610fa8575f6013555b600360135410610ffa5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104e9565b6110176110128461100d84601054611425565b611425565b6111b8565b4780156110275761102747611328565b60138054905f61103683611815565b909155505043601455505b505b80156110bb57305f908152600160205260409020546110629082611439565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906110b29085815260200190565b60405180910390a35b6001600160a01b0384165f908152600160205260409020546110dd9083611497565b6001600160a01b0385165f908152600160205260409020556111206111028383611497565b6001600160a01b0385165f9081526001602052604090205490611439565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6111698585611497565b60405190815260200160405180910390a350505050565b5f81848411156111a35760405162461bcd60e51b81526004016104e99190611504565b505f6111af848661182d565b95945050505050565b6012805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f815181106111fe576111fe611840565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611255573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061127991906117bc565b8160018151811061128c5761128c611840565b6001600160a01b0392831660209182029290920101526011546112b29130911684610ae8565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac947906112ea9085905f90869030904290600401611854565b5f604051808303815f87803b158015611301575f80fd5b505af1158015611313573d5f803e3d5ffd5b50506012805460ff60a81b1916905550505050565b6004546040516001600160a01b039091169082156108fc029083905f818181858888f193505050501580156104bc573d5f803e3d5ffd5b5f825f0361136e57505f6103ca565b5f611379838561173a565b90508261138685836118c5565b146113dd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104e9565b9392505050565b5f6113dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114d8565b5f81831161143357826113dd565b50919050565b5f806114458385611802565b9050838110156113dd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104e9565b5f6113dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611180565b5f81836114f85760405162461bcd60e51b81526004016104e99190611504565b505f6111af84866118c5565b5f602080835283518060208501525f5b8181101561153057858101830151858201604001528201611514565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611564575f80fd5b50565b5f8060408385031215611578575f80fd5b823561158381611550565b946020939093013593505050565b5f805f606084860312156115a3575f80fd5b83356115ae81611550565b925060208401356115be81611550565b929592945050506040919091013590565b5f602082840312156115df575f80fd5b81356113dd81611550565b5f80604083850312156115fb575f80fd5b823561160681611550565b9150602083013561161681611550565b809150509250929050565b5f60208284031215611631575f80fd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b600181815b8085111561168657815f190482111561166c5761166c611638565b8085161561167957918102915b93841c9390800290611651565b509250929050565b5f8261169c575060016103ca565b816116a857505f6103ca565b81600181146116be57600281146116c8576116e4565b60019150506103ca565b60ff8411156116d9576116d9611638565b50506001821b6103ca565b5060208310610133831016604e8410600b8410161715611707575081810a6103ca565b611711838361164c565b805f190482111561172457611724611638565b029392505050565b5f6113dd60ff84168361168e565b80820281158282048414176103ca576103ca611638565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b5f60208284031215611796575f80fd5b5051919050565b5f602082840312156117ad575f80fd5b815180151581146113dd575f80fd5b5f602082840312156117cc575f80fd5b81516113dd81611550565b5f805f606084860312156117e9575f80fd5b8351925060208401519150604084015190509250925092565b808201808211156103ca576103ca611638565b5f6001820161182657611826611638565b5060010190565b818103818111156103ca576103ca611638565b634e487b7160e01b5f52603260045260245ffd5b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b818110156118a45784516001600160a01b03168352938301939183019160010161187f565b50506001600160a01b03969096166060850152505050608001529392505050565b5f826118df57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201f978345a8a6765456e873364854251fac49229e3efba385f9a8b94b54f772c364736f6c63430008170033
|
60806040526004361061011e575f3560e01c80637d1db4a51161009d578063a9059cbb11610062578063a9059cbb1461031b578063bf474bed1461033a578063c9567bf91461034f578063dd62ed3e14610357578063ec1f3f631461039b575f80fd5b80637d1db4a51461027e5780638cd4426d146102935780638da5cb5b146102b25780638f9a55c0146102d857806395d89b41146102ed575f80fd5b8063313ce567116100e3578063313ce567146101f157806351bc3c851461020c578063622565891461022257806370a0823114610236578063715018a61461026a575f80fd5b806306fdde0314610129578063095ea7b31461016c5780630faee56f1461019b57806318160ddd146101be57806323b872dd146101d2575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b506040805180820190915260098152684d696e69205065706560b81b60208201525b6040516101639190611504565b60405180910390f35b348015610177575f80fd5b5061018b610186366004611567565b6103ba565b6040519015158152602001610163565b3480156101a6575f80fd5b506101b060105481565b604051908152602001610163565b3480156101c9575f80fd5b506101b06103d0565b3480156101dd575f80fd5b5061018b6101ec366004611591565b6103f1565b3480156101fc575f80fd5b5060405160098152602001610163565b348015610217575f80fd5b50610220610458565b005b34801561022d575f80fd5b506102206104c0565b348015610241575f80fd5b506101b06102503660046115cf565b6001600160a01b03165f9081526001602052604090205490565b348015610275575f80fd5b5061022061057d565b348015610289575f80fd5b506101b0600d5481565b34801561029e575f80fd5b506102206102ad366004611567565b6105ee565b3480156102bd575f80fd5b505f546040516001600160a01b039091168152602001610163565b3480156102e3575f80fd5b506101b0600e5481565b3480156102f8575f80fd5b50604080518082019091526006815265454c5341504f60d01b6020820152610156565b348015610326575f80fd5b5061018b610335366004611567565b61070e565b348015610345575f80fd5b506101b0600f5481565b61022061071a565b348015610362575f80fd5b506101b06103713660046115ea565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b3480156103a6575f80fd5b506102206103b5366004611621565b610ac4565b5f6103c6338484610ae8565b5060015b92915050565b5f6103dd6009600a61172c565b6103ec906461f313f88061173a565b905090565b5f6103fd848484610c0b565b61044e8433610449856040518060600160405280602881526020016118e5602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611180565b610ae8565b5060019392505050565b6004546001600160a01b0316336001600160a01b031614610477575f80fd5b305f90815260016020526040902054801580159061049e5750601254600160b01b900460ff165b156104ac576104ac816111b8565b4780156104bc576104bc81611328565b5050565b5f546001600160a01b031633146104f25760405162461bcd60e51b81526004016104e990611751565b60405180910390fd5b6104fe6009600a61172c565b61050d906461f313f88061173a565b600d5561051c6009600a61172c565b61052b906461f313f88061173a565b600e557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf61055b6009600a61172c565b61056a906461f313f88061173a565b60405190815260200160405180910390a1565b5f546001600160a01b031633146105a65760405162461bcd60e51b81526004016104e990611751565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b6004546001600160a01b0316336001600160a01b03161461060d575f80fd5b6040516370a0823160e01b81523060048201525f9061068e906064906106889085906001600160a01b038816906370a0823190602401602060405180830381865afa15801561065e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106829190611786565b9061135f565b906113e4565b6004805460405163a9059cbb60e01b81526001600160a01b0391821692810192909252602482018390529192509084169063a9059cbb906044016020604051808303815f875af11580156106e4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610708919061179d565b50505050565b5f6103c6338484610c0b565b5f546001600160a01b031633146107435760405162461bcd60e51b81526004016104e990611751565b601254600160a01b900460ff161561079d5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104e9565b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107e79030906107d86009600a61172c565b610449906461f313f88061173a565b60115f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610837573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061085b91906117bc565b6001600160a01b031663c9c653963060115f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108de91906117bc565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af1158015610928573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061094c91906117bc565b601280546001600160a01b039283166001600160a01b03199091161790556011541663f305d7193430610993816001600160a01b03165f9081526001602052604090205490565b5f806109a65f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a0c573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610a3191906117d7565b505060125460115460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610a86573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aaa919061179d565b506012805462ff00ff60a01b19166201000160a01b179055565b6004546001600160a01b0316336001600160a01b031614610ae3575f80fd5b600855565b6001600160a01b038316610b4a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104e9565b6001600160a01b038216610bab5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104e9565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c6f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104e9565b6001600160a01b038216610cd15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104e9565b5f8111610d325760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104e9565b5f80546001600160a01b03858116911614801590610d5d57505f546001600160a01b03848116911614155b8015610d7757506004546001600160a01b03848116911614155b1561104357610da26064610688600954600c5411610d9757600554610d9b565b6007545b859061135f565b6012549091506001600160a01b038581169116148015610dd057506011546001600160a01b03848116911614155b8015610df457506001600160a01b0383165f9081526003602052604090205460ff16155b15610eda57600d54821115610e4b5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104e9565b600e5482610e6d856001600160a01b03165f9081526001602052604090205490565b610e779190611802565b1115610ec55760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104e9565b600c8054905f610ed483611815565b91905055505b6012546001600160a01b038481169116148015610f0057506001600160a01b0384163014155b15610f2d57610f2a6064610688600a54600c5411610f2057600654610d9b565b600854859061135f565b90505b305f90815260016020526040902054601254600160a81b900460ff16158015610f6357506012546001600160a01b038581169116145b8015610f785750601254600160b01b900460ff165b8015610f855750600f5481115b8015610f945750600b54600c54115b1561104157601454431115610fa8575f6013555b600360135410610ffa5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104e9565b6110176110128461100d84601054611425565b611425565b6111b8565b4780156110275761102747611328565b60138054905f61103683611815565b909155505043601455505b505b80156110bb57305f908152600160205260409020546110629082611439565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906110b29085815260200190565b60405180910390a35b6001600160a01b0384165f908152600160205260409020546110dd9083611497565b6001600160a01b0385165f908152600160205260409020556111206111028383611497565b6001600160a01b0385165f9081526001602052604090205490611439565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6111698585611497565b60405190815260200160405180910390a350505050565b5f81848411156111a35760405162461bcd60e51b81526004016104e99190611504565b505f6111af848661182d565b95945050505050565b6012805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f815181106111fe576111fe611840565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611255573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061127991906117bc565b8160018151811061128c5761128c611840565b6001600160a01b0392831660209182029290920101526011546112b29130911684610ae8565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac947906112ea9085905f90869030904290600401611854565b5f604051808303815f87803b158015611301575f80fd5b505af1158015611313573d5f803e3d5ffd5b50506012805460ff60a81b1916905550505050565b6004546040516001600160a01b039091169082156108fc029083905f818181858888f193505050501580156104bc573d5f803e3d5ffd5b5f825f0361136e57505f6103ca565b5f611379838561173a565b90508261138685836118c5565b146113dd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104e9565b9392505050565b5f6113dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114d8565b5f81831161143357826113dd565b50919050565b5f806114458385611802565b9050838110156113dd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104e9565b5f6113dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611180565b5f81836114f85760405162461bcd60e51b81526004016104e99190611504565b505f6111af84866118c5565b5f602080835283518060208501525f5b8181101561153057858101830151858201604001528201611514565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611564575f80fd5b50565b5f8060408385031215611578575f80fd5b823561158381611550565b946020939093013593505050565b5f805f606084860312156115a3575f80fd5b83356115ae81611550565b925060208401356115be81611550565b929592945050506040919091013590565b5f602082840312156115df575f80fd5b81356113dd81611550565b5f80604083850312156115fb575f80fd5b823561160681611550565b9150602083013561161681611550565b809150509250929050565b5f60208284031215611631575f80fd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b600181815b8085111561168657815f190482111561166c5761166c611638565b8085161561167957918102915b93841c9390800290611651565b509250929050565b5f8261169c575060016103ca565b816116a857505f6103ca565b81600181146116be57600281146116c8576116e4565b60019150506103ca565b60ff8411156116d9576116d9611638565b50506001821b6103ca565b5060208310610133831016604e8410600b8410161715611707575081810a6103ca565b611711838361164c565b805f190482111561172457611724611638565b029392505050565b5f6113dd60ff84168361168e565b80820281158282048414176103ca576103ca611638565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b5f60208284031215611796575f80fd5b5051919050565b5f602082840312156117ad575f80fd5b815180151581146113dd575f80fd5b5f602082840312156117cc575f80fd5b81516113dd81611550565b5f805f606084860312156117e9575f80fd5b8351925060208401519150604084015190509250925092565b808201808211156103ca576103ca611638565b5f6001820161182657611826611638565b5060010190565b818103818111156103ca576103ca611638565b634e487b7160e01b5f52603260045260245ffd5b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b818110156118a45784516001600160a01b03168352938301939183019160010161187f565b50506001600160a01b03969096166060850152505050608001529392505050565b5f826118df57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201f978345a8a6765456e873364854251fac49229e3efba385f9a8b94b54f772c364736f6c63430008170033
| |
1 | 20,290,258 |
b17aff2cde7a43a9848617497b25c7a370356390f050956a3a953819e0c44fb0
|
abfdfc14d22fd5607dbdff0e6b4139e77082c9fca8a7a65d319c1dfb3783cedd
|
4667c25ac779bc56ce09edab36d65432749b64be
|
ffa397285ce46fb78c588a9e993286aac68c37cd
|
c55cc114b8c43b9f84cc3b26e3d3f71a5e37bf99
|
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
|
pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
}
|
1 | 20,290,258 |
b17aff2cde7a43a9848617497b25c7a370356390f050956a3a953819e0c44fb0
|
56f98100de9f6de107551dcecc52cb4004dd8d1a910160f0b82e7eafa3b517d3
|
b1d7319206f816b2c0025f2022a23c7a1db622fd
|
b1d7319206f816b2c0025f2022a23c7a1db622fd
|
b7d889ad4f03407a389312c95208fd0c4cd6c9a9
|
608060405234801561000f575f80fd5b5060405161052d38038061052d833981810160405281019061003191906100d5565b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610100565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a48261007b565b9050919050565b6100b48161009a565b81146100be575f80fd5b50565b5f815190506100cf816100ab565b92915050565b5f602082840312156100ea576100e9610077565b5b5f6100f7848285016100c1565b91505092915050565b6104208061010d5f395ff3fe608060405260043610610028575f3560e01c8063019009371461002c5780638381f58a1461005c575b5f80fd5b61004660048036038101906100419190610221565b610086565b60405161005391906102b4565b60405180910390f35b348015610067575f80fd5b5061007061013b565b60405161007d91906102e5565b60405180910390f35b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010d90610358565b60405180910390fd5b5f80815480929190610127906103a3565b91905055505f545f1b905095945050505050565b5f5481565b5f80fd5b5f80fd5b5f819050919050565b61015a81610148565b8114610164575f80fd5b50565b5f8135905061017581610151565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b61019f8161017b565b81146101a9575f80fd5b50565b5f813590506101ba81610196565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126101e1576101e06101c0565b5b8235905067ffffffffffffffff8111156101fe576101fd6101c4565b5b60208301915083600182028301111561021a576102196101c8565b5b9250929050565b5f805f805f6080868803121561023a57610239610140565b5b5f61024788828901610167565b9550506020610258888289016101ac565b945050604061026988828901610167565b935050606086013567ffffffffffffffff81111561028a57610289610144565b5b610296888289016101cc565b92509250509295509295909350565b6102ae81610148565b82525050565b5f6020820190506102c75f8301846102a5565b92915050565b5f819050919050565b6102df816102cd565b82525050565b5f6020820190506102f85f8301846102d6565b92915050565b5f82825260208201905092915050565b7f756e617574686f72697a656400000000000000000000000000000000000000005f82015250565b5f610342600c836102fe565b915061034d8261030e565b602082019050919050565b5f6020820190508181035f83015261036f81610336565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6103ad826102cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103df576103de610376565b5b60018201905091905056fea2646970667358221220b95cccf60d5810b7cc788ba892ff4f587e098006baed2065c9ed4073a069f8f364736f6c634300081a0033000000000000000000000000000000007f56768de3133034fa730a909003a165
|
608060405260043610610028575f3560e01c8063019009371461002c5780638381f58a1461005c575b5f80fd5b61004660048036038101906100419190610221565b610086565b60405161005391906102b4565b60405180910390f35b348015610067575f80fd5b5061007061013b565b60405161007d91906102e5565b60405180910390f35b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010d90610358565b60405180910390fd5b5f80815480929190610127906103a3565b91905055505f545f1b905095945050505050565b5f5481565b5f80fd5b5f80fd5b5f819050919050565b61015a81610148565b8114610164575f80fd5b50565b5f8135905061017581610151565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b61019f8161017b565b81146101a9575f80fd5b50565b5f813590506101ba81610196565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126101e1576101e06101c0565b5b8235905067ffffffffffffffff8111156101fe576101fd6101c4565b5b60208301915083600182028301111561021a576102196101c8565b5b9250929050565b5f805f805f6080868803121561023a57610239610140565b5b5f61024788828901610167565b9550506020610258888289016101ac565b945050604061026988828901610167565b935050606086013567ffffffffffffffff81111561028a57610289610144565b5b610296888289016101cc565b92509250509295509295909350565b6102ae81610148565b82525050565b5f6020820190506102c75f8301846102a5565b92915050565b5f819050919050565b6102df816102cd565b82525050565b5f6020820190506102f85f8301846102d6565b92915050565b5f82825260208201905092915050565b7f756e617574686f72697a656400000000000000000000000000000000000000005f82015250565b5f610342600c836102fe565b915061034d8261030e565b602082019050919050565b5f6020820190508181035f83015261036f81610336565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6103ad826102cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103df576103de610376565b5b60018201905091905056fea2646970667358221220b95cccf60d5810b7cc788ba892ff4f587e098006baed2065c9ed4073a069f8f364736f6c634300081a0033
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
092e225fee66c094b9204eba57b2540355b7c7c9
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
08423bc8317f0ba3c863d0429057e04999de3484
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
c8650bb42b20c6404e56c9e45e6eecf28ad568e4
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
3cdacd9bf7411b27ca0778544d117000d5b44370
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
f18f4860bf3f083a8c859f6274b2f44f5cf807e9
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
2f1c4ae0c30ffe93324768ada3be9db3d363f1ab
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
4292f8f1859936cf75909e18c46e7c361230b389
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
2bffb1bfe35761d7b00adcf88753a25677a64b8d
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
a6ca5e135c2dd3cac82da34d318cbd751d1b2304
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
6bfa82e0795d97d06df1ef5c728d57762d569f50
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
04935b4ca86166b99a64a080157b85859a80cb22
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
f5b186541685a7b147728770a6d66d2e2b47b5d7
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
de8aca9c67865ee5eff2c985a4171c8a5847fe23
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
6db18dea0b1ee00ffc5b7d42994da9212e02d908
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
b28e85886be3ab7014f5b716e4846d8d727cf67d
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
2b88c26c06e6e40390501332adaac6f51cb4bf4f
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
479fc2a8d15e3c7fdab8239d936c26d1682ab106
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
7afa856d0fa7a6744bc7c289c4ae21ea4f3635ee
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
c66d2acbf075bcb231339a16645655da1d581dba
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
eab333e96c41f899fb83437454e5f1635ff11208
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
37127c59706364904e1ec953399f7dbf471a4df1
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
538a02244704b6e31b4c0036d070dca377ea8ef9
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
01e7c389badd5f13a9e1c0394924576f7914d1a3
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
92bca53c13fd92612b93da6bf4f265f17e937b08
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
09966f1e9367e77171ef9f556478f7e3de314672
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
f9c59203c56cac96d8f7a1284f0ad8118ef15bf8
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
5a38c578de29212c8f6509b7b2f669c9f4053760
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
a50ac652c92cdd95683a18a2f8f296300aa287ae
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
a49a62c35ff0d0a47ee611fc1fa98460dd316009
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
11524dff700e8851549daf96a797915d1989b019
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
325655bca739046af6a10858f36371c427a6e2d8
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
261b40fde78e16d40b618c206869acdb8418f8d9
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
0025ce545e4c34b4c40221dbfb73bc01b19add44
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
9dd8fd86af9389e6dc2732ba148bcc8231ccf714
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
124e617e59d66420cb9a3d5271ffca5d146ca9cf
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
59aedf64a7662e6a5ba328ecf20d3139755928ed
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
17e8768d56778be28aa0255fb6e7b8852133ff2e
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
4fd9e9efd709d22b7271da223acd4d6722023474
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
4bcdd8cd0acef95eb0abf73dabe061c7a0abb9d3
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
533653d8659f2b4bd312f5c8988c738dc98edd0b
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
2fb8957bcada58a49ff3ae443eb35d5b53e4fac6
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
9ac69fabc8ad63aad4aab18f9acbc398d988f4f6
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
09312d624181af553c320c107859e4894d51deae
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
69e4a70fc81beb34312ec0d45644696de677237f
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
0012fbf6660451d31432dfb7d5beed792c8e2d94
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
77b1aff8def761f2183b06f1daf0fa77d030966a
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
7625b3f20f2c0e120e63a22a46590fbc8aa4a516
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
28b29c2a9ec2407c0ecd716a580276f0553f6c4c
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
ce8172c4c4b7551fcd3bf2e8f01a1d0d7ace640c
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
39da8a4b93b9be3954a062db423296f2fcc5ad55
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
850f7b596541ed6a7e03b9f0af6263fb06957d6e
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
9d42266a0908f2d50ffd0f9c378411a60023b487
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
bc755103dc0d8c53f8e2681976614bdcef0fac45
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
79eebcad21e189508177e6c5a9ffbc4e85566f2a
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
4dbada763bf795889a196dfe853f187c23dc2bff
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
c15dc9a250eef8b0e051f13ca80313f283ffca16
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
1012440fcb6ca5573e0788e3ff7d3c470a8e33f3
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
2b54ea23ce835d4dbd5b11ba0057656cd78a166a
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
77d26116d816d038c5f66a85aa5683b31c0683f9
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
7d11611009b920a5d2db5cb03e1ad98f15996b81
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
2e0df7c6eb1869e7d5ef93dbaed844ffe639b5fe
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
8426288badb2d0523cdda701395d716ff04fc2fd
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
3448eef19cead822c80795b9fa6a7e93307343cc
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
4eda5b099783bb6a05f12a1171e956e6185baf44
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
4782b6959d77b1e0c2b7d00bfaf1f667cae6615a
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
51377a7294ebcd5cc44a8e5a45b075f002654286
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,260 |
1d773b8c788553e8b7a070d2aeaa91c7b4b34179b2d9b4f5616ca562e5f6c8bd
|
14aaf9dc67853561035911f2786a1924cb65a1b83f220a004c3179dc8af4e847
|
7b0409c81c03885fa3919cefeab7162539c6f362
|
42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794
|
fa7e7d1e1c4bd394c96c5c6408792ae3cbeb6fce
|
3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,261 |
baf32be284d724c97a1281601c3731886599f57055c3a6eab840c9013456c41e
|
0e3fb34dd79feecd69e48b99628f429a3eae65c81b19d2abc6df7b3ab38b1828
|
afb73d5cdbb46780b72ec5b15c143b6bda322e5f
|
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
|
ee0721d68b8ede707ee2e088ef9e68f12c4911d2
|
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,263 |
22ec87db4327d347d46619fe51a1e67f7898d4da89b1f60cd5e66d57189ac411
|
d572f49354c2881eaf2e15766bd621311fce0e98114eee3ce8f39161d5db1c61
|
bbb014a8196ec46604bca105e86b0ecd6ffb563f
|
bbb014a8196ec46604bca105e86b0ecd6ffb563f
|
a1e7cbd763891468dbbd29dc2f03ba7228d19ebc
|
60806040523480156200001157600080fd5b5060405162006aa138038062006aa1833981810160405281019062000037919062000977565b610230600c8190555084600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160006003808111156200009c576200009b620009ff565b5b6003811115620000b157620000b0620009ff565b5b815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360016000806003811115620001185762000117620009ff565b5b60038111156200012d576200012c620009ff565b5b815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826001600060016003811115620001955762000194620009ff565b5b6003811115620001aa57620001a9620009ff565b5b815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200020b6000801b33620003b460201b60201c565b62000243604051602001620002209062000a89565b6040516020818303038152906040528051906020012033620003ca60201b60201c565b6200027b604051602001620002589062000af0565b6040516020818303038152906040528051906020012033620003ca60201b60201c565b620002b6604051602001620002909062000a89565b604051602081830303815290604052805190602001206000801b6200041360201b60201c565b620002f1604051602001620002cb9062000af0565b604051602081830303815290604052805190602001206000801b6200041360201b60201c565b6a0422ca8b0a00a425000000600a819055506200033b604051602001620003189062000a89565b6040516020818303038152906040528051906020012082620003ca60201b60201c565b6006819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506365926056600b81905550505050505062000e9b565b620003c682826200047660201b60201c565b5050565b620003db826200056760201b60201c565b620003fc81620003f06200058660201b60201c565b6200058e60201b60201c565b6200040e83836200047660201b60201c565b505050565b600062000426836200056760201b60201c565b905081600080858152602001908152602001600020600101819055508181847fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff60405160405180910390a4505050565b6200048882826200064860201b60201c565b6200056357600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550620005086200058660201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000806000838152602001908152602001600020600101549050919050565b600033905090565b620005a082826200064860201b60201c565b6200064457620005ce8173ffffffffffffffffffffffffffffffffffffffff166014620006b260201b60201c565b620005e48360001c6020620006b260201b60201c565b604051602001620005f792919062000c15565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200063b919062000cba565b60405180910390fd5b5050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b606060006002836002620006c7919062000d17565b620006d3919062000d62565b67ffffffffffffffff811115620006ef57620006ee62000d9d565b5b6040519080825280601f01601f191660200182016040528015620007225781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106200075d576200075c62000dcc565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110620007c457620007c362000dcc565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600262000806919062000d17565b62000812919062000d62565b90505b6001811115620008bc577f3031323334353637383961626364656600000000000000000000000000000000600f86166010811062000858576200085762000dcc565b5b1a60f81b82828151811062000872576200087162000dcc565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080620008b49062000dfb565b905062000815565b506000841462000903576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620008fa9062000e79565b60405180910390fd5b8091505092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200093f8262000912565b9050919050565b620009518162000932565b81146200095d57600080fd5b50565b600081519050620009718162000946565b92915050565b600080600080600060a086880312156200099657620009956200090d565b5b6000620009a68882890162000960565b9550506020620009b98882890162000960565b9450506040620009cc8882890162000960565b9350506060620009df8882890162000960565b9250506080620009f28882890162000960565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600081905092915050565b7f526566696e657279000000000000000000000000000000000000000000000000600082015250565b600062000a7160088362000a2e565b915062000a7e8262000a39565b600882019050919050565b600062000a968262000a62565b9150819050919050565b7f53756241646d696e000000000000000000000000000000000000000000000000600082015250565b600062000ad860088362000a2e565b915062000ae58262000aa0565b600882019050919050565b600062000afd8262000ac9565b9150819050919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b600062000b3f60178362000a2e565b915062000b4c8262000b07565b601782019050919050565b600081519050919050565b60005b8381101562000b8257808201518184015260208101905062000b65565b60008484015250505050565b600062000b9b8262000b57565b62000ba7818562000a2e565b935062000bb981856020860162000b62565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600062000bfd60118362000a2e565b915062000c0a8262000bc5565b601182019050919050565b600062000c228262000b30565b915062000c30828562000b8e565b915062000c3d8262000bee565b915062000c4b828462000b8e565b91508190509392505050565b600082825260208201905092915050565b6000601f19601f8301169050919050565b600062000c868262000b57565b62000c92818562000c57565b935062000ca481856020860162000b62565b62000caf8162000c68565b840191505092915050565b6000602082019050818103600083015262000cd6818462000c79565b905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000d248262000cde565b915062000d318362000cde565b925082820262000d418162000cde565b9150828204841483151762000d5b5762000d5a62000ce8565b5b5092915050565b600062000d6f8262000cde565b915062000d7c8362000cde565b925082820190508082111562000d975762000d9662000ce8565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600062000e088262000cde565b91506000820362000e1e5762000e1d62000ce8565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b600062000e6160208362000c57565b915062000e6e8262000e29565b602082019050919050565b6000602082019050818103600083015262000e948162000e52565b9050919050565b615bf68062000eab6000396000f3fe6080604052600436106102305760003560e01c80638538142b1161012e578063bed7e1d8116100ab578063ce47d69a1161006f578063ce47d69a1461080e578063d547741f14610825578063da60fe8f1461084e578063f4651d5714610879578063f962a757146108a257610230565b8063bed7e1d814610751578063c1f1608b14610768578063c2c77c6614610791578063ca13d367146107ba578063cb315ef4146107e357610230565b8063a217fddf116100f2578063a217fddf14610687578063af6a909e146106b2578063b5440c31146106bc578063b5f522f7146106e5578063b9c4eb431461072857610230565b80638538142b146105a2578063853828b6146105df5780638a559fe3146105f657806391d148541461061f5780639af1d35a1461065c57610230565b80633887645b116101bc5780636e164b71116101805780636e164b71146104bd578063709334f3146104fa57806378dacee1146105255780637a8b69191461054e5780637da441c31461057757610230565b80633887645b146103da57806346cc599e146104055780634bb1ba82146104425780634ce58f151461046b5780635079399c1461049457610230565b8063211130361161020357806321113036146102df578063248a9ca3146103205780632f2ff15d1461035d57806336568abe146103865780633700cefb146103af57610230565b806301ffc9a714610235578063049c5c49146102725780630979f888146102895780630b97bc86146102b4575b600080fd5b34801561024157600080fd5b5061025c60048036038101906102579190613ead565b6108df565b6040516102699190613ef5565b60405180910390f35b34801561027e57600080fd5b50610287610959565b005b34801561029557600080fd5b5061029e610a30565b6040516102ab9190613f29565b60405180910390f35b3480156102c057600080fd5b506102c9610a36565b6040516102d69190613f29565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190613f70565b610a3c565b604051610317959493929190613f9d565b60405180910390f35b34801561032c57600080fd5b5061034760048036038101906103429190614026565b610a72565b6040516103549190614062565b60405180910390f35b34801561036957600080fd5b50610384600480360381019061037f91906140db565b610a91565b005b34801561039257600080fd5b506103ad60048036038101906103a891906140db565b610aba565b005b3480156103bb57600080fd5b506103c4610b3d565b6040516103d191906141d6565b60405180910390f35b3480156103e657600080fd5b506103ef610c47565b6040516103fc9190613f29565b60405180910390f35b34801561041157600080fd5b5061042c600480360381019061042791906141f1565b610c54565b6040516104399190613ef5565b60405180910390f35b34801561044e57600080fd5b5061046960048036038101906104649190613f70565b610c74565b005b34801561047757600080fd5b50610492600480360381019061048d9190614243565b610e26565b005b3480156104a057600080fd5b506104bb60048036038101906104b69190614597565b611040565b005b3480156104c957600080fd5b506104e460048036038101906104df9190613f70565b6113a7565b6040516104f19190614631565b60405180910390f35b34801561050657600080fd5b5061050f6113e6565b60405161051c9190613f29565b60405180910390f35b34801561053157600080fd5b5061054c60048036038101906105479190613f70565b6113ec565b005b34801561055a57600080fd5b50610575600480360381019061057091906141f1565b611485565b005b34801561058357600080fd5b5061058c611515565b6040516105999190614631565b60405180910390f35b3480156105ae57600080fd5b506105c960048036038101906105c49190613f70565b61153b565b6040516105d69190614631565b60405180910390f35b3480156105eb57600080fd5b506105f461157a565b005b34801561060257600080fd5b5061061d60048036038101906106189190613f70565b611b03565b005b34801561062b57600080fd5b50610646600480360381019061064191906140db565b611b8e565b6040516106539190613ef5565b60405180910390f35b34801561066857600080fd5b50610671611bf8565b60405161067e9190613f29565b60405180910390f35b34801561069357600080fd5b5061069c611bfe565b6040516106a99190614062565b60405180910390f35b6106ba611c05565b005b3480156106c857600080fd5b506106e360048036038101906106de9190614678565b611d46565b005b3480156106f157600080fd5b5061070c60048036038101906107079190613f70565b6121a3565b60405161071f97969594939291906146f3565b60405180910390f35b34801561073457600080fd5b5061074f600480360381019061074a91906141f1565b61221f565b005b34801561075d57600080fd5b506107666122ff565b005b34801561077457600080fd5b5061078f600480360381019061078a91906141f1565b6123d6565b005b34801561079d57600080fd5b506107b860048036038101906107b391906141f1565b612453565b005b3480156107c657600080fd5b506107e160048036038101906107dc9190614825565b612533565b005b3480156107ef57600080fd5b506107f8612719565b6040516108059190613f29565b60405180910390f35b34801561081a57600080fd5b50610823612726565b005b34801561083157600080fd5b5061084c600480360381019061084791906140db565b61277c565b005b34801561085a57600080fd5b506108636127a5565b6040516108709190613f29565b60405180910390f35b34801561088557600080fd5b506108a0600480360381019061089b91906141f1565b6127ab565b005b3480156108ae57600080fd5b506108c960048036038101906108c491906148ff565b612828565b6040516108d69190614631565b60405180910390f35b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061095257506109518261285b565b5b9050919050565b6109666000801b33611b8e565b8061099b575061099a60405160200161097e90614983565b6040516020818303038152906040528051906020012033611b8e565b5b6109da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d1906149f5565b60405180910390fd5b60006008600060016002546109ef9190614a44565b815260200190815260200160002090508060050160009054906101000a900460ff16158160050160006101000a81548160ff02191690831515021790555050565b60035481565b600b5481565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b6000806000838152602001908152602001600020600101549050919050565b610a9a82610a72565b610aab81610aa66128c5565b6128cd565b610ab5838361296a565b505050565b610ac26128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2690614aea565b60405180910390fd5b610b398282612a4a565b5050565b610b45613d9a565b610b4d613d9a565b600060025403610b605780915050610c44565b600860006001600254610b739190614a44565b81526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509150505b90565b6000600680549050905090565b60056020528060005260406000206000915054906101000a900460ff1681565b610c816000801b33611b8e565b80610cb65750610cb5604051602001610c9990614983565b6040516020818303038152906040528051906020012033611b8e565b5b610cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cec906149f5565b60405180910390fd5b610cfe81612b2b565b610d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3490614b56565b60405180910390fd5b6000600860006001600254610d529190614a44565b815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610dc393929190614b76565b6020604051808303816000875af1158015610de2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e069190614bc2565b5081816003016000828254610e1b9190614bef565b925050819055505050565b6000612710600c5484610e399190614c23565b610e439190614c94565b83610e4e9190614a44565b905060016000836003811115610e6757610e66614cc5565b5b6003811115610e7957610e78614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401610ee493929190614b76565b6020604051808303816000875af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f279190614bc2565b506000600860006001600254610f3d9190614a44565b81526020019081526020016000209050611015816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b61101e57600080fd5b61103a84848360050160019054906101000a900460ff16612d87565b50505050565b61104d6000801b33611b8e565b80611082575061108160405160200161106590614983565b6040516020818303038152906040528051906020012033611b8e565b5b6110c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b8906149f5565b60405180910390fd5b600083511180156110d3575080518351145b611112576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110990614d40565b60405180910390fd5b81600181111561112557611124614cc5565b5b6000600181111561113957611138614cc5565b5b0361125c5760005b83518110156112565760016005600086848151811061116357611162614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508381815181106111cf576111ce614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460003385858151811061122457611223614d60565b5b602002602001015160405161123b93929190614e45565b60405180910390a2808061124e90614e83565b915050611141565b506113a2565b81600181111561126f5761126e614cc5565b5b60018081111561128257611281614cc5565b5b036113a15760005b835181101561139f576000600560008684815181106112ac576112ab614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555083818151811061131857611317614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460013385858151811061136d5761136c614d60565b5b602002602001015160405161138493929190614e45565b60405180910390a2808061139790614e83565b91505061128a565b505b5b505050565b600781815481106113b757600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6113f96000801b33611b8e565b611438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142f90614f17565b60405180910390fd5b6000811161147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147290614f83565b60405180910390fd5b80600c8190555050565b6114926000801b33611b8e565b6114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614f17565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6006818154811061154b57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6115876000801b33611b8e565b6115c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bd90614f17565b60405180910390fd5b600160006003808111156115dd576115dc614cc5565b5b60038111156115ef576115ee614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336001600060038081111561165157611650614cc5565b5b600381111561166357611662614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116ca9190614631565b602060405180830381865afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b9190614fb8565b6040518363ffffffff1660e01b8152600401611728929190614fe5565b6020604051808303816000875af1158015611747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176b9190614bc2565b506001600080600381111561178357611782614cc5565b5b600381111561179557611794614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160008060038111156117f7576117f6614cc5565b5b600381111561180957611808614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016118709190614631565b602060405180830381865afa15801561188d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b19190614fb8565b6040518363ffffffff1660e01b81526004016118ce929190614fe5565b6020604051808303816000875af11580156118ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119119190614bc2565b50600160006001600381111561192a57611929614cc5565b5b600381111561193c5761193b614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160006001600381111561199f5761199e614cc5565b5b60038111156119b1576119b0614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611a189190614631565b602060405180830381865afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a599190614fb8565b6040518363ffffffff1660e01b8152600401611a76929190614fe5565b6020604051808303816000875af1158015611a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab99190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611b00573d6000803e3d6000fd5b50565b611b106000801b33611b8e565b80611b455750611b44604051602001611b2890614983565b6040516020818303038152906040528051906020012033611b8e565b5b611b84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7b906149f5565b60405180910390fd5b80600a8190555050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600c5481565b6000801b81565b6000612710600c5434611c189190614c23565b611c229190614c94565b34611c2d9190614a44565b90506000600860006001600254611c449190614a44565b81526020019081526020016000209050611d1c816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b611d2557600080fd5b611d428260028360050160019054906101000a900460ff16612d87565b5050565b611d536000801b33611b8e565b80611d885750611d87604051602001611d6b90614983565b6040516020818303038152906040528051906020012033611b8e565b5b611dc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbe906149f5565b60405180910390fd5b611dd082612b2b565b611e0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0690614b56565b60405180910390fd5b600060035411611e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4b9061505a565b60405180910390fd5b600060025414611f6a57611f69600860006001600254611e749190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860006001600254611eb99190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611f239190614631565b602060405180830381865afa158015611f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f649190614fb8565b613306565b5b60006008600060025481526020019081526020016000209050858160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084816001018190555083816002018190555082816003018190555060018160050160006101000a81548160ff021916908315150217905550818160050160016101000a81548160ff0219169083151502179055506301e13380600b5461202c9190614bef565b816001015411156120405761203f613385565b5b61204861338e565b6120506135dc565b8461205b9190614bef565b111561209c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612093906150c6565b60405180910390fd5b8060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b81526004016120fd93929190614b76565b6020604051808303816000875af115801561211c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121409190614bc2565b506002547fef6707848cac12824ef51fe16d76a210e3558daae9d1a56675945774d2c1ca9a878787878760405161217b9594939291906150e6565b60405180910390a26002600081548092919061219690614e83565b9190505550505050505050565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040154908060050160009054906101000a900460ff16908060050160019054906101000a900460ff16905087565b61222c6000801b33611b8e565b61226b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226290614f17565b60405180910390fd5b61229960405160200161227d90614983565b6040516020818303038152906040528051906020012082610a91565b6007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61230c6000801b33611b8e565b80612341575061234060405160200161232490614983565b6040516020818303038152906040528051906020012033611b8e565b5b612380576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612377906149f5565b60405180910390fd5b60006008600060016002546123959190614a44565b815260200190815260200160002090508060050160019054906101000a900460ff16158160050160016101000a81548160ff02191690831515021790555050565b6123e36000801b33611b8e565b612422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241990614f17565b60405180910390fd5b61245060405160200161243490615185565b604051602081830303815290604052805190602001208261277c565b50565b6124606000801b33611b8e565b61249f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161249690614f17565b60405180910390fd5b6124cd6040516020016124b190615185565b6040516020818303038152906040528051906020012082610a91565b6006819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61256160405160200161254590615185565b6040516020818303038152906040528051906020012033611b8e565b6125a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612597906151e6565b60405180910390fd5b600082511180156125b2575060008151115b6125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890615252565b60405180910390fd5b6000600960006003548152602001908152602001600020905087816000018190555086816001018190555085816003018190555084816004018190555083816002018190555060005b83518110156126f65761264b613df1565b83828151811061265e5761265d614d60565b5b602002602001015181602001818152505084828151811061268257612681614d60565b5b602002602001015181600001819052508260050181908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000190816126d5919061547e565b506020820151816001015550505080806126ee90614e83565b91505061263a565b506003600081548092919061270a90614e83565b91905055505050505050505050565b6000600780549050905090565b6127336000801b33611b8e565b612772576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276990614f17565b60405180910390fd5b61277a613385565b565b61278582610a72565b612796816127916128c5565b6128cd565b6127a08383612a4a565b505050565b600a5481565b6127b86000801b33611b8e565b6127f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ee90614f17565b60405180910390fd5b61282560405160200161280990614983565b604051602081830303815290604052805190602001208261277c565b50565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b6128d78282611b8e565b612966576128fc8173ffffffffffffffffffffffffffffffffffffffff1660146136f0565b61290a8360001c60206136f0565b60405160200161291b929190615619565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161295d9190615653565b60405180910390fd5b5050565b6129748282611b8e565b612a4657600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506129eb6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b612a548282611b8e565b15612b2757600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612acc6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060025403612b67576001915050612d19565b6000805b600254811015612c7f576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509050600b54816020015110612c6b57806060015183612c689190614bef565b92505b508080612c7790614e83565b915050612b6b565b508381612c8c9190614bef565b90506000612d0d8373ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d029190614fb8565b600a5460128061392c565b90508082111593505050505b919050565b60008160c00151612d325760019050612d82565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690505b919050565b600083118015612d9957506000600254115b612dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dcf906156c1565b60405180910390fd5b6000600860006001600254612ded9190614a44565b8152602001908152602001600020905080600101544210158015612e15575080600201544211155b612e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4b9061572d565b60405180910390fd5b8060050160009054906101000a900460ff16612ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e9c90615799565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000846003811115612ee157612ee0614cc5565b5b60006003811115612ef557612ef4614cc5565b5b03612f7d57612f768273ffffffffffffffffffffffffffffffffffffffff1663d8f1d7ea6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6c9190614fb8565b876006601261392c565b9050613187565b846003811115612f9057612f8f614cc5565b5b60016003811115612fa457612fa3614cc5565b5b0361302c576130258273ffffffffffffffffffffffffffffffffffffffff1663b77d2a1d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301b9190614fb8565b876006601261392c565b9050613186565b84600381111561303f5761303e614cc5565b5b60038081111561305257613051614cc5565b5b036130da576130d38273ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c99190614fb8565b876006601261392c565b9050613185565b8460038111156130ed576130ec614cc5565b5b6002600381111561310157613100614cc5565b5b03613184576131818273ffffffffffffffffffffffffffffffffffffffff1663027480e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015613154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131789190614fb8565b8760128061392c565b90505b5b5b5b6000613192826139b1565b9050818460040160008282546131a89190614bef565b925050819055508360030154846004015411156131fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131f190615805565b60405180910390fd5b8360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401613259929190614fe5565b6020604051808303816000875af1158015613278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329c9190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff167f9c0381305bbf7da8ed16753de32983d70bbb06100f82ff8a8b6f1d598cd4525d87898589866000015187602001516040516132f59695949392919061586d565b60405180910390a250505050505050565b60008111156133815760008290508073ffffffffffffffffffffffffffffffffffffffff166342966c68836040518263ffffffff1660e01b815260040161334d9190613f29565b600060405180830381600087803b15801561336757600080fd5b505af115801561337b573d6000803e3d6000fd5b50505050505b5050565b42600b81905550565b600080600354116133d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133cb90615921565b60405180910390fd5b60006133de613e0b565b60005b6003548110156135a757600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b8282101561352e5783829060005260206000209060020201604051806040016040529081600082018054613493906152a1565b80601f01602080910402602001604051908101604052809291908181526020018280546134bf906152a1565b801561350c5780601f106134e15761010080835404028352916020019161350c565b820191906000526020600020905b8154815290600101906020018083116134ef57829003601f168201915b5050505050815260200160018201548152505081526020019060010190613460565b5050505081525050915060008260a00151905060005b815181101561359257600082828151811061356257613561614d60565b5b6020026020010151905080602001518661357c9190614bef565b955050808061358a90614e83565b915050613544565b5050808061359f90614e83565b9150506133e1565b506064670de0b6b3a7640000612710846135c19190614c23565b6135cb9190614c23565b6135d59190614c94565b9250505090565b60008060005b6002548110156136e8576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff16151515158152505090508060800151836136d29190614bef565b92505080806136e090614e83565b9150506135e2565b508091505090565b6060600060028360026137039190614c23565b61370d9190614bef565b67ffffffffffffffff81111561372657613725614299565b5b6040519080825280601f01601f1916602001820160405280156137585781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106137905761378f614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106137f4576137f3614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026138349190614c23565b61383e9190614bef565b90505b60018111156138de577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106138805761387f614d60565b5b1a60f81b82828151811061389757613896614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806138d790615941565b9050613841565b5060008414613922576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613919906159b6565b60405180910390fd5b8091505092915050565b600080828411156139615782846139439190614a44565b600a61394f9190615b09565b8561395a9190614c94565b9050613987565b838361396d9190614a44565b600a6139799190615b09565b856139849190614c23565b90505b8581670de0b6b3a764000061399c9190614c23565b6139a69190614c94565b915050949350505050565b6139b9613df1565b60006003541180156139cd57506000600254115b613a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a0390615ba0565b60405180910390fd5b6000613a16613e0b565b60005b600354811015613c4c57600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b82821015613b665783829060005260206000209060020201604051806040016040529081600082018054613acb906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613af7906152a1565b8015613b445780601f10613b1957610100808354040283529160200191613b44565b820191906000526020600020905b815481529060010190602001808311613b2757829003601f168201915b5050505050815260200160018201548152505081526020019060010190613a98565b5050505081525050915060008260a00151905060005b8151811015613c37576000828281518110613b9a57613b99614d60565b5b60200260200101519050806020015186613bb49190614bef565b95506064670de0b6b3a764000061271088613bcf9190614c23565b613bd99190614c23565b613be39190614c94565b88613bec6135dc565b613bf69190614bef565b11613c2357828281518110613c0e57613c0d614d60565b5b60200260200101519650505050505050613d95565b508080613c2f90614e83565b915050613b7c565b50508080613c4490614e83565b915050613a19565b506000600960006001600354613c629190614a44565b8152602001908152602001600020600501805480602002602001604051908101604052809291908181526020016000905b82821015613d615783829060005260206000209060020201604051806040016040529081600082018054613cc6906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613cf2906152a1565b8015613d3f5780601f10613d1457610100808354040283529160200191613d3f565b820191906000526020600020905b815481529060010190602001808311613d2257829003601f168201915b5050505050815260200160018201548152505081526020019060010190613c93565b5050505090508060018251613d769190614a44565b81518110613d8757613d86614d60565b5b602002602001015193505050505b919050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b604051806040016040528060608152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613e8a81613e55565b8114613e9557600080fd5b50565b600081359050613ea781613e81565b92915050565b600060208284031215613ec357613ec2613e4b565b5b6000613ed184828501613e98565b91505092915050565b60008115159050919050565b613eef81613eda565b82525050565b6000602082019050613f0a6000830184613ee6565b92915050565b6000819050919050565b613f2381613f10565b82525050565b6000602082019050613f3e6000830184613f1a565b92915050565b613f4d81613f10565b8114613f5857600080fd5b50565b600081359050613f6a81613f44565b92915050565b600060208284031215613f8657613f85613e4b565b5b6000613f9484828501613f5b565b91505092915050565b600060a082019050613fb26000830188613f1a565b613fbf6020830187613f1a565b613fcc6040830186613f1a565b613fd96060830185613f1a565b613fe66080830184613f1a565b9695505050505050565b6000819050919050565b61400381613ff0565b811461400e57600080fd5b50565b60008135905061402081613ffa565b92915050565b60006020828403121561403c5761403b613e4b565b5b600061404a84828501614011565b91505092915050565b61405c81613ff0565b82525050565b60006020820190506140776000830184614053565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006140a88261407d565b9050919050565b6140b88161409d565b81146140c357600080fd5b50565b6000813590506140d5816140af565b92915050565b600080604083850312156140f2576140f1613e4b565b5b600061410085828601614011565b9250506020614111858286016140c6565b9150509250929050565b6141248161409d565b82525050565b61413381613f10565b82525050565b61414281613eda565b82525050565b60e08201600082015161415e600085018261411b565b506020820151614171602085018261412a565b506040820151614184604085018261412a565b506060820151614197606085018261412a565b5060808201516141aa608085018261412a565b5060a08201516141bd60a0850182614139565b5060c08201516141d060c0850182614139565b50505050565b600060e0820190506141eb6000830184614148565b92915050565b60006020828403121561420757614206613e4b565b5b6000614215848285016140c6565b91505092915050565b6004811061422b57600080fd5b50565b60008135905061423d8161421e565b92915050565b6000806040838503121561425a57614259613e4b565b5b600061426885828601613f5b565b92505060206142798582860161422e565b9150509250929050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6142d182614288565b810181811067ffffffffffffffff821117156142f0576142ef614299565b5b80604052505050565b6000614303613e41565b905061430f82826142c8565b919050565b600067ffffffffffffffff82111561432f5761432e614299565b5b602082029050602081019050919050565b600080fd5b600061435861435384614314565b6142f9565b9050808382526020820190506020840283018581111561437b5761437a614340565b5b835b818110156143a4578061439088826140c6565b84526020840193505060208101905061437d565b5050509392505050565b600082601f8301126143c3576143c2614283565b5b81356143d3848260208601614345565b91505092915050565b600281106143e957600080fd5b50565b6000813590506143fb816143dc565b92915050565b600067ffffffffffffffff82111561441c5761441b614299565b5b602082029050602081019050919050565b600080fd5b600067ffffffffffffffff82111561444d5761444c614299565b5b61445682614288565b9050602081019050919050565b82818337600083830152505050565b600061448561448084614432565b6142f9565b9050828152602081018484840111156144a1576144a061442d565b5b6144ac848285614463565b509392505050565b600082601f8301126144c9576144c8614283565b5b81356144d9848260208601614472565b91505092915050565b60006144f56144f084614401565b6142f9565b9050808382526020820190506020840283018581111561451857614517614340565b5b835b8181101561455f57803567ffffffffffffffff81111561453d5761453c614283565b5b80860161454a89826144b4565b8552602085019450505060208101905061451a565b5050509392505050565b600082601f83011261457e5761457d614283565b5b813561458e8482602086016144e2565b91505092915050565b6000806000606084860312156145b0576145af613e4b565b5b600084013567ffffffffffffffff8111156145ce576145cd613e50565b5b6145da868287016143ae565b93505060206145eb868287016143ec565b925050604084013567ffffffffffffffff81111561460c5761460b613e50565b5b61461886828701614569565b9150509250925092565b61462b8161409d565b82525050565b60006020820190506146466000830184614622565b92915050565b61465581613eda565b811461466057600080fd5b50565b6000813590506146728161464c565b92915050565b600080600080600060a0868803121561469457614693613e4b565b5b60006146a2888289016140c6565b95505060206146b388828901613f5b565b94505060406146c488828901613f5b565b93505060606146d588828901613f5b565b92505060806146e688828901614663565b9150509295509295909350565b600060e082019050614708600083018a614622565b6147156020830189613f1a565b6147226040830188613f1a565b61472f6060830187613f1a565b61473c6080830186613f1a565b61474960a0830185613ee6565b61475660c0830184613ee6565b98975050505050505050565b600067ffffffffffffffff82111561477d5761477c614299565b5b602082029050602081019050919050565b60006147a161479c84614762565b6142f9565b905080838252602082019050602084028301858111156147c4576147c3614340565b5b835b818110156147ed57806147d98882613f5b565b8452602084019350506020810190506147c6565b5050509392505050565b600082601f83011261480c5761480b614283565b5b813561481c84826020860161478e565b91505092915050565b600080600080600080600060e0888a03121561484457614843613e4b565b5b60006148528a828b01613f5b565b97505060206148638a828b01613f5b565b96505060406148748a828b01613f5b565b95505060606148858a828b01613f5b565b94505060806148968a828b01613f5b565b93505060a088013567ffffffffffffffff8111156148b7576148b6613e50565b5b6148c38a828b01614569565b92505060c088013567ffffffffffffffff8111156148e4576148e3613e50565b5b6148f08a828b016147f7565b91505092959891949750929550565b60006020828403121561491557614914613e4b565b5b60006149238482850161422e565b91505092915050565b600081905092915050565b7f53756241646d696e000000000000000000000000000000000000000000000000600082015250565b600061496d60088361492c565b915061497882614937565b600882019050919050565b600061498e82614960565b9150819050919050565b600082825260208201905092915050565b7f4f41000000000000000000000000000000000000000000000000000000000000600082015250565b60006149df600283614998565b91506149ea826149a9565b602082019050919050565b60006020820190508181036000830152614a0e816149d2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614a4f82613f10565b9150614a5a83613f10565b9250828203905081811115614a7257614a71614a15565b5b92915050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000614ad4602f83614998565b9150614adf82614a78565b604082019050919050565b60006020820190508181036000830152614b0381614ac7565b9050919050565b7f4541000000000000000000000000000000000000000000000000000000000000600082015250565b6000614b40600283614998565b9150614b4b82614b0a565b602082019050919050565b60006020820190508181036000830152614b6f81614b33565b9050919050565b6000606082019050614b8b6000830186614622565b614b986020830185614622565b614ba56040830184613f1a565b949350505050565b600081519050614bbc8161464c565b92915050565b600060208284031215614bd857614bd7613e4b565b5b6000614be684828501614bad565b91505092915050565b6000614bfa82613f10565b9150614c0583613f10565b9250828201905080821115614c1d57614c1c614a15565b5b92915050565b6000614c2e82613f10565b9150614c3983613f10565b9250828202614c4781613f10565b91508282048414831517614c5e57614c5d614a15565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614c9f82613f10565b9150614caa83613f10565b925082614cba57614cb9614c65565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6c656e677468206d69736d617463680000000000000000000000000000000000600082015250565b6000614d2a600f83614998565b9150614d3582614cf4565b602082019050919050565b60006020820190508181036000830152614d5981614d1d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60028110614da057614d9f614cc5565b5b50565b6000819050614db182614d8f565b919050565b6000614dc182614da3565b9050919050565b614dd181614db6565b82525050565b600081519050919050565b60005b83811015614e00578082015181840152602081019050614de5565b60008484015250505050565b6000614e1782614dd7565b614e218185614998565b9350614e31818560208601614de2565b614e3a81614288565b840191505092915050565b6000606082019050614e5a6000830186614dc8565b614e676020830185614622565b8181036040830152614e798184614e0c565b9050949350505050565b6000614e8e82613f10565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614ec057614ebf614a15565b5b600182019050919050565b7f4f4f000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f01600283614998565b9150614f0c82614ecb565b602082019050919050565b60006020820190508181036000830152614f3081614ef4565b9050919050565b7f4956000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f6d600283614998565b9150614f7882614f37565b602082019050919050565b60006020820190508181036000830152614f9c81614f60565b9050919050565b600081519050614fb281613f44565b92915050565b600060208284031215614fce57614fcd613e4b565b5b6000614fdc84828501614fa3565b91505092915050565b6000604082019050614ffa6000830185614622565b6150076020830184613f1a565b9392505050565b7f5245000000000000000000000000000000000000000000000000000000000000600082015250565b6000615044600283614998565b915061504f8261500e565b602082019050919050565b6000602082019050818103600083015261507381615037565b9050919050565b7f4e47420000000000000000000000000000000000000000000000000000000000600082015250565b60006150b0600383614998565b91506150bb8261507a565b602082019050919050565b600060208201905081810360008301526150df816150a3565b9050919050565b600060a0820190506150fb6000830188614622565b6151086020830187613f1a565b6151156040830186613f1a565b6151226060830185613f1a565b61512f6080830184613ee6565b9695505050505050565b7f526566696e657279000000000000000000000000000000000000000000000000600082015250565b600061516f60088361492c565b915061517a82615139565b600882019050919050565b600061519082615162565b9150819050919050565b7f4f52000000000000000000000000000000000000000000000000000000000000600082015250565b60006151d0600283614998565b91506151db8261519a565b602082019050919050565b600060208201905081810360008301526151ff816151c3565b9050919050565b7f696e76616c696420696e70757400000000000000000000000000000000000000600082015250565b600061523c600d83614998565b915061524782615206565b602082019050919050565b6000602082019050818103600083015261526b8161522f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806152b957607f821691505b6020821081036152cc576152cb615272565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026153347fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826152f7565b61533e86836152f7565b95508019841693508086168417925050509392505050565b6000819050919050565b600061537b61537661537184613f10565b615356565b613f10565b9050919050565b6000819050919050565b61539583615360565b6153a96153a182615382565b848454615304565b825550505050565b600090565b6153be6153b1565b6153c981848461538c565b505050565b5b818110156153ed576153e26000826153b6565b6001810190506153cf565b5050565b601f82111561543257615403816152d2565b61540c846152e7565b8101602085101561541b578190505b61542f615427856152e7565b8301826153ce565b50505b505050565b600082821c905092915050565b600061545560001984600802615437565b1980831691505092915050565b600061546e8383615444565b9150826002028217905092915050565b61548782614dd7565b67ffffffffffffffff8111156154a05761549f614299565b5b6154aa82546152a1565b6154b58282856153f1565b600060209050601f8311600181146154e857600084156154d6578287015190505b6154e08582615462565b865550615548565b601f1984166154f6866152d2565b60005b8281101561551e578489015182556001820191506020850194506020810190506154f9565b8683101561553b5784890151615537601f891682615444565b8355505b6001600288020188555050505b505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b600061558660178361492c565b915061559182615550565b601782019050919050565b60006155a782614dd7565b6155b1818561492c565b93506155c1818560208601614de2565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061560360118361492c565b915061560e826155cd565b601182019050919050565b600061562482615579565b9150615630828561559c565b915061563b826155f6565b9150615647828461559c565b91508190509392505050565b6000602082019050818103600083015261566d8184614e0c565b905092915050565b7f4731000000000000000000000000000000000000000000000000000000000000600082015250565b60006156ab600283614998565b91506156b682615675565b602082019050919050565b600060208201905081810360008301526156da8161569e565b9050919050565b7f4732000000000000000000000000000000000000000000000000000000000000600082015250565b6000615717600283614998565b9150615722826156e1565b602082019050919050565b600060208201905081810360008301526157468161570a565b9050919050565b7f53616c6520496e61637469766500000000000000000000000000000000000000600082015250565b6000615783600d83614998565b915061578e8261574d565b602082019050919050565b600060208201905081810360008301526157b281615776565b9050919050565b7f4733000000000000000000000000000000000000000000000000000000000000600082015250565b60006157ef600283614998565b91506157fa826157b9565b602082019050919050565b6000602082019050818103600083015261581e816157e2565b9050919050565b6004811061583657615835614cc5565b5b50565b600081905061584782615825565b919050565b600061585782615839565b9050919050565b6158678161584c565b82525050565b600060c082019050615882600083018961585e565b61588f6020830188613f1a565b61589c6040830187613f1a565b6158a96060830186613ee6565b81810360808301526158bb8185614e0c565b90506158ca60a0830184613f1a565b979650505050505050565b7f52434d0000000000000000000000000000000000000000000000000000000000600082015250565b600061590b600383614998565b9150615916826158d5565b602082019050919050565b6000602082019050818103600083015261593a816158fe565b9050919050565b600061594c82613f10565b91506000820361595f5761595e614a15565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006159a0602083614998565b91506159ab8261596a565b602082019050919050565b600060208201905081810360008301526159cf81615993565b9050919050565b60008160011c9050919050565b6000808291508390505b6001851115615a2d57808604811115615a0957615a08614a15565b5b6001851615615a185780820291505b8081029050615a26856159d6565b94506159ed565b94509492505050565b600082615a465760019050615b02565b81615a545760009050615b02565b8160018114615a6a5760028114615a7457615aa3565b6001915050615b02565b60ff841115615a8657615a85614a15565b5b8360020a915084821115615a9d57615a9c614a15565b5b50615b02565b5060208310610133831016604e8410600b8410161715615ad85782820a905083811115615ad357615ad2614a15565b5b615b02565b615ae584848460016159e3565b92509050818404811115615afc57615afb614a15565b5b81810290505b9392505050565b6000615b1482613f10565b9150615b1f83613f10565b9250615b4c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484615a36565b905092915050565b7f5243534d00000000000000000000000000000000000000000000000000000000600082015250565b6000615b8a600483614998565b9150615b9582615b54565b602082019050919050565b60006020820190508181036000830152615bb981615b7d565b905091905056fea264697066735822122012e99c1746e11b45cad42797333841eff1992625e60f6013682643997bfb84f864736f6c63430008130033000000000000000000000000041b522ec77d4f4ffaefed196913fb7a60352575000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000001abaea1f7c830bd89acc67ec4af516284b1bc33c0000000000000000000000007ca0128701b0fbbe5f75aa9a750c8738d683b69c
|
6080604052600436106102305760003560e01c80638538142b1161012e578063bed7e1d8116100ab578063ce47d69a1161006f578063ce47d69a1461080e578063d547741f14610825578063da60fe8f1461084e578063f4651d5714610879578063f962a757146108a257610230565b8063bed7e1d814610751578063c1f1608b14610768578063c2c77c6614610791578063ca13d367146107ba578063cb315ef4146107e357610230565b8063a217fddf116100f2578063a217fddf14610687578063af6a909e146106b2578063b5440c31146106bc578063b5f522f7146106e5578063b9c4eb431461072857610230565b80638538142b146105a2578063853828b6146105df5780638a559fe3146105f657806391d148541461061f5780639af1d35a1461065c57610230565b80633887645b116101bc5780636e164b71116101805780636e164b71146104bd578063709334f3146104fa57806378dacee1146105255780637a8b69191461054e5780637da441c31461057757610230565b80633887645b146103da57806346cc599e146104055780634bb1ba82146104425780634ce58f151461046b5780635079399c1461049457610230565b8063211130361161020357806321113036146102df578063248a9ca3146103205780632f2ff15d1461035d57806336568abe146103865780633700cefb146103af57610230565b806301ffc9a714610235578063049c5c49146102725780630979f888146102895780630b97bc86146102b4575b600080fd5b34801561024157600080fd5b5061025c60048036038101906102579190613ead565b6108df565b6040516102699190613ef5565b60405180910390f35b34801561027e57600080fd5b50610287610959565b005b34801561029557600080fd5b5061029e610a30565b6040516102ab9190613f29565b60405180910390f35b3480156102c057600080fd5b506102c9610a36565b6040516102d69190613f29565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190613f70565b610a3c565b604051610317959493929190613f9d565b60405180910390f35b34801561032c57600080fd5b5061034760048036038101906103429190614026565b610a72565b6040516103549190614062565b60405180910390f35b34801561036957600080fd5b50610384600480360381019061037f91906140db565b610a91565b005b34801561039257600080fd5b506103ad60048036038101906103a891906140db565b610aba565b005b3480156103bb57600080fd5b506103c4610b3d565b6040516103d191906141d6565b60405180910390f35b3480156103e657600080fd5b506103ef610c47565b6040516103fc9190613f29565b60405180910390f35b34801561041157600080fd5b5061042c600480360381019061042791906141f1565b610c54565b6040516104399190613ef5565b60405180910390f35b34801561044e57600080fd5b5061046960048036038101906104649190613f70565b610c74565b005b34801561047757600080fd5b50610492600480360381019061048d9190614243565b610e26565b005b3480156104a057600080fd5b506104bb60048036038101906104b69190614597565b611040565b005b3480156104c957600080fd5b506104e460048036038101906104df9190613f70565b6113a7565b6040516104f19190614631565b60405180910390f35b34801561050657600080fd5b5061050f6113e6565b60405161051c9190613f29565b60405180910390f35b34801561053157600080fd5b5061054c60048036038101906105479190613f70565b6113ec565b005b34801561055a57600080fd5b50610575600480360381019061057091906141f1565b611485565b005b34801561058357600080fd5b5061058c611515565b6040516105999190614631565b60405180910390f35b3480156105ae57600080fd5b506105c960048036038101906105c49190613f70565b61153b565b6040516105d69190614631565b60405180910390f35b3480156105eb57600080fd5b506105f461157a565b005b34801561060257600080fd5b5061061d60048036038101906106189190613f70565b611b03565b005b34801561062b57600080fd5b50610646600480360381019061064191906140db565b611b8e565b6040516106539190613ef5565b60405180910390f35b34801561066857600080fd5b50610671611bf8565b60405161067e9190613f29565b60405180910390f35b34801561069357600080fd5b5061069c611bfe565b6040516106a99190614062565b60405180910390f35b6106ba611c05565b005b3480156106c857600080fd5b506106e360048036038101906106de9190614678565b611d46565b005b3480156106f157600080fd5b5061070c60048036038101906107079190613f70565b6121a3565b60405161071f97969594939291906146f3565b60405180910390f35b34801561073457600080fd5b5061074f600480360381019061074a91906141f1565b61221f565b005b34801561075d57600080fd5b506107666122ff565b005b34801561077457600080fd5b5061078f600480360381019061078a91906141f1565b6123d6565b005b34801561079d57600080fd5b506107b860048036038101906107b391906141f1565b612453565b005b3480156107c657600080fd5b506107e160048036038101906107dc9190614825565b612533565b005b3480156107ef57600080fd5b506107f8612719565b6040516108059190613f29565b60405180910390f35b34801561081a57600080fd5b50610823612726565b005b34801561083157600080fd5b5061084c600480360381019061084791906140db565b61277c565b005b34801561085a57600080fd5b506108636127a5565b6040516108709190613f29565b60405180910390f35b34801561088557600080fd5b506108a0600480360381019061089b91906141f1565b6127ab565b005b3480156108ae57600080fd5b506108c960048036038101906108c491906148ff565b612828565b6040516108d69190614631565b60405180910390f35b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061095257506109518261285b565b5b9050919050565b6109666000801b33611b8e565b8061099b575061099a60405160200161097e90614983565b6040516020818303038152906040528051906020012033611b8e565b5b6109da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d1906149f5565b60405180910390fd5b60006008600060016002546109ef9190614a44565b815260200190815260200160002090508060050160009054906101000a900460ff16158160050160006101000a81548160ff02191690831515021790555050565b60035481565b600b5481565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b6000806000838152602001908152602001600020600101549050919050565b610a9a82610a72565b610aab81610aa66128c5565b6128cd565b610ab5838361296a565b505050565b610ac26128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2690614aea565b60405180910390fd5b610b398282612a4a565b5050565b610b45613d9a565b610b4d613d9a565b600060025403610b605780915050610c44565b600860006001600254610b739190614a44565b81526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509150505b90565b6000600680549050905090565b60056020528060005260406000206000915054906101000a900460ff1681565b610c816000801b33611b8e565b80610cb65750610cb5604051602001610c9990614983565b6040516020818303038152906040528051906020012033611b8e565b5b610cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cec906149f5565b60405180910390fd5b610cfe81612b2b565b610d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3490614b56565b60405180910390fd5b6000600860006001600254610d529190614a44565b815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610dc393929190614b76565b6020604051808303816000875af1158015610de2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e069190614bc2565b5081816003016000828254610e1b9190614bef565b925050819055505050565b6000612710600c5484610e399190614c23565b610e439190614c94565b83610e4e9190614a44565b905060016000836003811115610e6757610e66614cc5565b5b6003811115610e7957610e78614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401610ee493929190614b76565b6020604051808303816000875af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f279190614bc2565b506000600860006001600254610f3d9190614a44565b81526020019081526020016000209050611015816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b61101e57600080fd5b61103a84848360050160019054906101000a900460ff16612d87565b50505050565b61104d6000801b33611b8e565b80611082575061108160405160200161106590614983565b6040516020818303038152906040528051906020012033611b8e565b5b6110c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b8906149f5565b60405180910390fd5b600083511180156110d3575080518351145b611112576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110990614d40565b60405180910390fd5b81600181111561112557611124614cc5565b5b6000600181111561113957611138614cc5565b5b0361125c5760005b83518110156112565760016005600086848151811061116357611162614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508381815181106111cf576111ce614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460003385858151811061122457611223614d60565b5b602002602001015160405161123b93929190614e45565b60405180910390a2808061124e90614e83565b915050611141565b506113a2565b81600181111561126f5761126e614cc5565b5b60018081111561128257611281614cc5565b5b036113a15760005b835181101561139f576000600560008684815181106112ac576112ab614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555083818151811061131857611317614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460013385858151811061136d5761136c614d60565b5b602002602001015160405161138493929190614e45565b60405180910390a2808061139790614e83565b91505061128a565b505b5b505050565b600781815481106113b757600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6113f96000801b33611b8e565b611438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142f90614f17565b60405180910390fd5b6000811161147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147290614f83565b60405180910390fd5b80600c8190555050565b6114926000801b33611b8e565b6114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614f17565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6006818154811061154b57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6115876000801b33611b8e565b6115c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bd90614f17565b60405180910390fd5b600160006003808111156115dd576115dc614cc5565b5b60038111156115ef576115ee614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336001600060038081111561165157611650614cc5565b5b600381111561166357611662614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116ca9190614631565b602060405180830381865afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b9190614fb8565b6040518363ffffffff1660e01b8152600401611728929190614fe5565b6020604051808303816000875af1158015611747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176b9190614bc2565b506001600080600381111561178357611782614cc5565b5b600381111561179557611794614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160008060038111156117f7576117f6614cc5565b5b600381111561180957611808614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016118709190614631565b602060405180830381865afa15801561188d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b19190614fb8565b6040518363ffffffff1660e01b81526004016118ce929190614fe5565b6020604051808303816000875af11580156118ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119119190614bc2565b50600160006001600381111561192a57611929614cc5565b5b600381111561193c5761193b614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160006001600381111561199f5761199e614cc5565b5b60038111156119b1576119b0614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611a189190614631565b602060405180830381865afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a599190614fb8565b6040518363ffffffff1660e01b8152600401611a76929190614fe5565b6020604051808303816000875af1158015611a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab99190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611b00573d6000803e3d6000fd5b50565b611b106000801b33611b8e565b80611b455750611b44604051602001611b2890614983565b6040516020818303038152906040528051906020012033611b8e565b5b611b84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7b906149f5565b60405180910390fd5b80600a8190555050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600c5481565b6000801b81565b6000612710600c5434611c189190614c23565b611c229190614c94565b34611c2d9190614a44565b90506000600860006001600254611c449190614a44565b81526020019081526020016000209050611d1c816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b611d2557600080fd5b611d428260028360050160019054906101000a900460ff16612d87565b5050565b611d536000801b33611b8e565b80611d885750611d87604051602001611d6b90614983565b6040516020818303038152906040528051906020012033611b8e565b5b611dc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbe906149f5565b60405180910390fd5b611dd082612b2b565b611e0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0690614b56565b60405180910390fd5b600060035411611e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4b9061505a565b60405180910390fd5b600060025414611f6a57611f69600860006001600254611e749190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860006001600254611eb99190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611f239190614631565b602060405180830381865afa158015611f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f649190614fb8565b613306565b5b60006008600060025481526020019081526020016000209050858160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084816001018190555083816002018190555082816003018190555060018160050160006101000a81548160ff021916908315150217905550818160050160016101000a81548160ff0219169083151502179055506301e13380600b5461202c9190614bef565b816001015411156120405761203f613385565b5b61204861338e565b6120506135dc565b8461205b9190614bef565b111561209c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612093906150c6565b60405180910390fd5b8060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b81526004016120fd93929190614b76565b6020604051808303816000875af115801561211c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121409190614bc2565b506002547fef6707848cac12824ef51fe16d76a210e3558daae9d1a56675945774d2c1ca9a878787878760405161217b9594939291906150e6565b60405180910390a26002600081548092919061219690614e83565b9190505550505050505050565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040154908060050160009054906101000a900460ff16908060050160019054906101000a900460ff16905087565b61222c6000801b33611b8e565b61226b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226290614f17565b60405180910390fd5b61229960405160200161227d90614983565b6040516020818303038152906040528051906020012082610a91565b6007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61230c6000801b33611b8e565b80612341575061234060405160200161232490614983565b6040516020818303038152906040528051906020012033611b8e565b5b612380576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612377906149f5565b60405180910390fd5b60006008600060016002546123959190614a44565b815260200190815260200160002090508060050160019054906101000a900460ff16158160050160016101000a81548160ff02191690831515021790555050565b6123e36000801b33611b8e565b612422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241990614f17565b60405180910390fd5b61245060405160200161243490615185565b604051602081830303815290604052805190602001208261277c565b50565b6124606000801b33611b8e565b61249f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161249690614f17565b60405180910390fd5b6124cd6040516020016124b190615185565b6040516020818303038152906040528051906020012082610a91565b6006819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61256160405160200161254590615185565b6040516020818303038152906040528051906020012033611b8e565b6125a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612597906151e6565b60405180910390fd5b600082511180156125b2575060008151115b6125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890615252565b60405180910390fd5b6000600960006003548152602001908152602001600020905087816000018190555086816001018190555085816003018190555084816004018190555083816002018190555060005b83518110156126f65761264b613df1565b83828151811061265e5761265d614d60565b5b602002602001015181602001818152505084828151811061268257612681614d60565b5b602002602001015181600001819052508260050181908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000190816126d5919061547e565b506020820151816001015550505080806126ee90614e83565b91505061263a565b506003600081548092919061270a90614e83565b91905055505050505050505050565b6000600780549050905090565b6127336000801b33611b8e565b612772576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276990614f17565b60405180910390fd5b61277a613385565b565b61278582610a72565b612796816127916128c5565b6128cd565b6127a08383612a4a565b505050565b600a5481565b6127b86000801b33611b8e565b6127f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ee90614f17565b60405180910390fd5b61282560405160200161280990614983565b604051602081830303815290604052805190602001208261277c565b50565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b6128d78282611b8e565b612966576128fc8173ffffffffffffffffffffffffffffffffffffffff1660146136f0565b61290a8360001c60206136f0565b60405160200161291b929190615619565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161295d9190615653565b60405180910390fd5b5050565b6129748282611b8e565b612a4657600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506129eb6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b612a548282611b8e565b15612b2757600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612acc6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060025403612b67576001915050612d19565b6000805b600254811015612c7f576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509050600b54816020015110612c6b57806060015183612c689190614bef565b92505b508080612c7790614e83565b915050612b6b565b508381612c8c9190614bef565b90506000612d0d8373ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d029190614fb8565b600a5460128061392c565b90508082111593505050505b919050565b60008160c00151612d325760019050612d82565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690505b919050565b600083118015612d9957506000600254115b612dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dcf906156c1565b60405180910390fd5b6000600860006001600254612ded9190614a44565b8152602001908152602001600020905080600101544210158015612e15575080600201544211155b612e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4b9061572d565b60405180910390fd5b8060050160009054906101000a900460ff16612ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e9c90615799565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000846003811115612ee157612ee0614cc5565b5b60006003811115612ef557612ef4614cc5565b5b03612f7d57612f768273ffffffffffffffffffffffffffffffffffffffff1663d8f1d7ea6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6c9190614fb8565b876006601261392c565b9050613187565b846003811115612f9057612f8f614cc5565b5b60016003811115612fa457612fa3614cc5565b5b0361302c576130258273ffffffffffffffffffffffffffffffffffffffff1663b77d2a1d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301b9190614fb8565b876006601261392c565b9050613186565b84600381111561303f5761303e614cc5565b5b60038081111561305257613051614cc5565b5b036130da576130d38273ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c99190614fb8565b876006601261392c565b9050613185565b8460038111156130ed576130ec614cc5565b5b6002600381111561310157613100614cc5565b5b03613184576131818273ffffffffffffffffffffffffffffffffffffffff1663027480e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015613154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131789190614fb8565b8760128061392c565b90505b5b5b5b6000613192826139b1565b9050818460040160008282546131a89190614bef565b925050819055508360030154846004015411156131fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131f190615805565b60405180910390fd5b8360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401613259929190614fe5565b6020604051808303816000875af1158015613278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329c9190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff167f9c0381305bbf7da8ed16753de32983d70bbb06100f82ff8a8b6f1d598cd4525d87898589866000015187602001516040516132f59695949392919061586d565b60405180910390a250505050505050565b60008111156133815760008290508073ffffffffffffffffffffffffffffffffffffffff166342966c68836040518263ffffffff1660e01b815260040161334d9190613f29565b600060405180830381600087803b15801561336757600080fd5b505af115801561337b573d6000803e3d6000fd5b50505050505b5050565b42600b81905550565b600080600354116133d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133cb90615921565b60405180910390fd5b60006133de613e0b565b60005b6003548110156135a757600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b8282101561352e5783829060005260206000209060020201604051806040016040529081600082018054613493906152a1565b80601f01602080910402602001604051908101604052809291908181526020018280546134bf906152a1565b801561350c5780601f106134e15761010080835404028352916020019161350c565b820191906000526020600020905b8154815290600101906020018083116134ef57829003601f168201915b5050505050815260200160018201548152505081526020019060010190613460565b5050505081525050915060008260a00151905060005b815181101561359257600082828151811061356257613561614d60565b5b6020026020010151905080602001518661357c9190614bef565b955050808061358a90614e83565b915050613544565b5050808061359f90614e83565b9150506133e1565b506064670de0b6b3a7640000612710846135c19190614c23565b6135cb9190614c23565b6135d59190614c94565b9250505090565b60008060005b6002548110156136e8576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff16151515158152505090508060800151836136d29190614bef565b92505080806136e090614e83565b9150506135e2565b508091505090565b6060600060028360026137039190614c23565b61370d9190614bef565b67ffffffffffffffff81111561372657613725614299565b5b6040519080825280601f01601f1916602001820160405280156137585781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106137905761378f614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106137f4576137f3614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026138349190614c23565b61383e9190614bef565b90505b60018111156138de577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106138805761387f614d60565b5b1a60f81b82828151811061389757613896614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806138d790615941565b9050613841565b5060008414613922576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613919906159b6565b60405180910390fd5b8091505092915050565b600080828411156139615782846139439190614a44565b600a61394f9190615b09565b8561395a9190614c94565b9050613987565b838361396d9190614a44565b600a6139799190615b09565b856139849190614c23565b90505b8581670de0b6b3a764000061399c9190614c23565b6139a69190614c94565b915050949350505050565b6139b9613df1565b60006003541180156139cd57506000600254115b613a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a0390615ba0565b60405180910390fd5b6000613a16613e0b565b60005b600354811015613c4c57600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b82821015613b665783829060005260206000209060020201604051806040016040529081600082018054613acb906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613af7906152a1565b8015613b445780601f10613b1957610100808354040283529160200191613b44565b820191906000526020600020905b815481529060010190602001808311613b2757829003601f168201915b5050505050815260200160018201548152505081526020019060010190613a98565b5050505081525050915060008260a00151905060005b8151811015613c37576000828281518110613b9a57613b99614d60565b5b60200260200101519050806020015186613bb49190614bef565b95506064670de0b6b3a764000061271088613bcf9190614c23565b613bd99190614c23565b613be39190614c94565b88613bec6135dc565b613bf69190614bef565b11613c2357828281518110613c0e57613c0d614d60565b5b60200260200101519650505050505050613d95565b508080613c2f90614e83565b915050613b7c565b50508080613c4490614e83565b915050613a19565b506000600960006001600354613c629190614a44565b8152602001908152602001600020600501805480602002602001604051908101604052809291908181526020016000905b82821015613d615783829060005260206000209060020201604051806040016040529081600082018054613cc6906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613cf2906152a1565b8015613d3f5780601f10613d1457610100808354040283529160200191613d3f565b820191906000526020600020905b815481529060010190602001808311613d2257829003601f168201915b5050505050815260200160018201548152505081526020019060010190613c93565b5050505090508060018251613d769190614a44565b81518110613d8757613d86614d60565b5b602002602001015193505050505b919050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b604051806040016040528060608152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613e8a81613e55565b8114613e9557600080fd5b50565b600081359050613ea781613e81565b92915050565b600060208284031215613ec357613ec2613e4b565b5b6000613ed184828501613e98565b91505092915050565b60008115159050919050565b613eef81613eda565b82525050565b6000602082019050613f0a6000830184613ee6565b92915050565b6000819050919050565b613f2381613f10565b82525050565b6000602082019050613f3e6000830184613f1a565b92915050565b613f4d81613f10565b8114613f5857600080fd5b50565b600081359050613f6a81613f44565b92915050565b600060208284031215613f8657613f85613e4b565b5b6000613f9484828501613f5b565b91505092915050565b600060a082019050613fb26000830188613f1a565b613fbf6020830187613f1a565b613fcc6040830186613f1a565b613fd96060830185613f1a565b613fe66080830184613f1a565b9695505050505050565b6000819050919050565b61400381613ff0565b811461400e57600080fd5b50565b60008135905061402081613ffa565b92915050565b60006020828403121561403c5761403b613e4b565b5b600061404a84828501614011565b91505092915050565b61405c81613ff0565b82525050565b60006020820190506140776000830184614053565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006140a88261407d565b9050919050565b6140b88161409d565b81146140c357600080fd5b50565b6000813590506140d5816140af565b92915050565b600080604083850312156140f2576140f1613e4b565b5b600061410085828601614011565b9250506020614111858286016140c6565b9150509250929050565b6141248161409d565b82525050565b61413381613f10565b82525050565b61414281613eda565b82525050565b60e08201600082015161415e600085018261411b565b506020820151614171602085018261412a565b506040820151614184604085018261412a565b506060820151614197606085018261412a565b5060808201516141aa608085018261412a565b5060a08201516141bd60a0850182614139565b5060c08201516141d060c0850182614139565b50505050565b600060e0820190506141eb6000830184614148565b92915050565b60006020828403121561420757614206613e4b565b5b6000614215848285016140c6565b91505092915050565b6004811061422b57600080fd5b50565b60008135905061423d8161421e565b92915050565b6000806040838503121561425a57614259613e4b565b5b600061426885828601613f5b565b92505060206142798582860161422e565b9150509250929050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6142d182614288565b810181811067ffffffffffffffff821117156142f0576142ef614299565b5b80604052505050565b6000614303613e41565b905061430f82826142c8565b919050565b600067ffffffffffffffff82111561432f5761432e614299565b5b602082029050602081019050919050565b600080fd5b600061435861435384614314565b6142f9565b9050808382526020820190506020840283018581111561437b5761437a614340565b5b835b818110156143a4578061439088826140c6565b84526020840193505060208101905061437d565b5050509392505050565b600082601f8301126143c3576143c2614283565b5b81356143d3848260208601614345565b91505092915050565b600281106143e957600080fd5b50565b6000813590506143fb816143dc565b92915050565b600067ffffffffffffffff82111561441c5761441b614299565b5b602082029050602081019050919050565b600080fd5b600067ffffffffffffffff82111561444d5761444c614299565b5b61445682614288565b9050602081019050919050565b82818337600083830152505050565b600061448561448084614432565b6142f9565b9050828152602081018484840111156144a1576144a061442d565b5b6144ac848285614463565b509392505050565b600082601f8301126144c9576144c8614283565b5b81356144d9848260208601614472565b91505092915050565b60006144f56144f084614401565b6142f9565b9050808382526020820190506020840283018581111561451857614517614340565b5b835b8181101561455f57803567ffffffffffffffff81111561453d5761453c614283565b5b80860161454a89826144b4565b8552602085019450505060208101905061451a565b5050509392505050565b600082601f83011261457e5761457d614283565b5b813561458e8482602086016144e2565b91505092915050565b6000806000606084860312156145b0576145af613e4b565b5b600084013567ffffffffffffffff8111156145ce576145cd613e50565b5b6145da868287016143ae565b93505060206145eb868287016143ec565b925050604084013567ffffffffffffffff81111561460c5761460b613e50565b5b61461886828701614569565b9150509250925092565b61462b8161409d565b82525050565b60006020820190506146466000830184614622565b92915050565b61465581613eda565b811461466057600080fd5b50565b6000813590506146728161464c565b92915050565b600080600080600060a0868803121561469457614693613e4b565b5b60006146a2888289016140c6565b95505060206146b388828901613f5b565b94505060406146c488828901613f5b565b93505060606146d588828901613f5b565b92505060806146e688828901614663565b9150509295509295909350565b600060e082019050614708600083018a614622565b6147156020830189613f1a565b6147226040830188613f1a565b61472f6060830187613f1a565b61473c6080830186613f1a565b61474960a0830185613ee6565b61475660c0830184613ee6565b98975050505050505050565b600067ffffffffffffffff82111561477d5761477c614299565b5b602082029050602081019050919050565b60006147a161479c84614762565b6142f9565b905080838252602082019050602084028301858111156147c4576147c3614340565b5b835b818110156147ed57806147d98882613f5b565b8452602084019350506020810190506147c6565b5050509392505050565b600082601f83011261480c5761480b614283565b5b813561481c84826020860161478e565b91505092915050565b600080600080600080600060e0888a03121561484457614843613e4b565b5b60006148528a828b01613f5b565b97505060206148638a828b01613f5b565b96505060406148748a828b01613f5b565b95505060606148858a828b01613f5b565b94505060806148968a828b01613f5b565b93505060a088013567ffffffffffffffff8111156148b7576148b6613e50565b5b6148c38a828b01614569565b92505060c088013567ffffffffffffffff8111156148e4576148e3613e50565b5b6148f08a828b016147f7565b91505092959891949750929550565b60006020828403121561491557614914613e4b565b5b60006149238482850161422e565b91505092915050565b600081905092915050565b7f53756241646d696e000000000000000000000000000000000000000000000000600082015250565b600061496d60088361492c565b915061497882614937565b600882019050919050565b600061498e82614960565b9150819050919050565b600082825260208201905092915050565b7f4f41000000000000000000000000000000000000000000000000000000000000600082015250565b60006149df600283614998565b91506149ea826149a9565b602082019050919050565b60006020820190508181036000830152614a0e816149d2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614a4f82613f10565b9150614a5a83613f10565b9250828203905081811115614a7257614a71614a15565b5b92915050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000614ad4602f83614998565b9150614adf82614a78565b604082019050919050565b60006020820190508181036000830152614b0381614ac7565b9050919050565b7f4541000000000000000000000000000000000000000000000000000000000000600082015250565b6000614b40600283614998565b9150614b4b82614b0a565b602082019050919050565b60006020820190508181036000830152614b6f81614b33565b9050919050565b6000606082019050614b8b6000830186614622565b614b986020830185614622565b614ba56040830184613f1a565b949350505050565b600081519050614bbc8161464c565b92915050565b600060208284031215614bd857614bd7613e4b565b5b6000614be684828501614bad565b91505092915050565b6000614bfa82613f10565b9150614c0583613f10565b9250828201905080821115614c1d57614c1c614a15565b5b92915050565b6000614c2e82613f10565b9150614c3983613f10565b9250828202614c4781613f10565b91508282048414831517614c5e57614c5d614a15565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614c9f82613f10565b9150614caa83613f10565b925082614cba57614cb9614c65565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6c656e677468206d69736d617463680000000000000000000000000000000000600082015250565b6000614d2a600f83614998565b9150614d3582614cf4565b602082019050919050565b60006020820190508181036000830152614d5981614d1d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60028110614da057614d9f614cc5565b5b50565b6000819050614db182614d8f565b919050565b6000614dc182614da3565b9050919050565b614dd181614db6565b82525050565b600081519050919050565b60005b83811015614e00578082015181840152602081019050614de5565b60008484015250505050565b6000614e1782614dd7565b614e218185614998565b9350614e31818560208601614de2565b614e3a81614288565b840191505092915050565b6000606082019050614e5a6000830186614dc8565b614e676020830185614622565b8181036040830152614e798184614e0c565b9050949350505050565b6000614e8e82613f10565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614ec057614ebf614a15565b5b600182019050919050565b7f4f4f000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f01600283614998565b9150614f0c82614ecb565b602082019050919050565b60006020820190508181036000830152614f3081614ef4565b9050919050565b7f4956000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f6d600283614998565b9150614f7882614f37565b602082019050919050565b60006020820190508181036000830152614f9c81614f60565b9050919050565b600081519050614fb281613f44565b92915050565b600060208284031215614fce57614fcd613e4b565b5b6000614fdc84828501614fa3565b91505092915050565b6000604082019050614ffa6000830185614622565b6150076020830184613f1a565b9392505050565b7f5245000000000000000000000000000000000000000000000000000000000000600082015250565b6000615044600283614998565b915061504f8261500e565b602082019050919050565b6000602082019050818103600083015261507381615037565b9050919050565b7f4e47420000000000000000000000000000000000000000000000000000000000600082015250565b60006150b0600383614998565b91506150bb8261507a565b602082019050919050565b600060208201905081810360008301526150df816150a3565b9050919050565b600060a0820190506150fb6000830188614622565b6151086020830187613f1a565b6151156040830186613f1a565b6151226060830185613f1a565b61512f6080830184613ee6565b9695505050505050565b7f526566696e657279000000000000000000000000000000000000000000000000600082015250565b600061516f60088361492c565b915061517a82615139565b600882019050919050565b600061519082615162565b9150819050919050565b7f4f52000000000000000000000000000000000000000000000000000000000000600082015250565b60006151d0600283614998565b91506151db8261519a565b602082019050919050565b600060208201905081810360008301526151ff816151c3565b9050919050565b7f696e76616c696420696e70757400000000000000000000000000000000000000600082015250565b600061523c600d83614998565b915061524782615206565b602082019050919050565b6000602082019050818103600083015261526b8161522f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806152b957607f821691505b6020821081036152cc576152cb615272565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026153347fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826152f7565b61533e86836152f7565b95508019841693508086168417925050509392505050565b6000819050919050565b600061537b61537661537184613f10565b615356565b613f10565b9050919050565b6000819050919050565b61539583615360565b6153a96153a182615382565b848454615304565b825550505050565b600090565b6153be6153b1565b6153c981848461538c565b505050565b5b818110156153ed576153e26000826153b6565b6001810190506153cf565b5050565b601f82111561543257615403816152d2565b61540c846152e7565b8101602085101561541b578190505b61542f615427856152e7565b8301826153ce565b50505b505050565b600082821c905092915050565b600061545560001984600802615437565b1980831691505092915050565b600061546e8383615444565b9150826002028217905092915050565b61548782614dd7565b67ffffffffffffffff8111156154a05761549f614299565b5b6154aa82546152a1565b6154b58282856153f1565b600060209050601f8311600181146154e857600084156154d6578287015190505b6154e08582615462565b865550615548565b601f1984166154f6866152d2565b60005b8281101561551e578489015182556001820191506020850194506020810190506154f9565b8683101561553b5784890151615537601f891682615444565b8355505b6001600288020188555050505b505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b600061558660178361492c565b915061559182615550565b601782019050919050565b60006155a782614dd7565b6155b1818561492c565b93506155c1818560208601614de2565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061560360118361492c565b915061560e826155cd565b601182019050919050565b600061562482615579565b9150615630828561559c565b915061563b826155f6565b9150615647828461559c565b91508190509392505050565b6000602082019050818103600083015261566d8184614e0c565b905092915050565b7f4731000000000000000000000000000000000000000000000000000000000000600082015250565b60006156ab600283614998565b91506156b682615675565b602082019050919050565b600060208201905081810360008301526156da8161569e565b9050919050565b7f4732000000000000000000000000000000000000000000000000000000000000600082015250565b6000615717600283614998565b9150615722826156e1565b602082019050919050565b600060208201905081810360008301526157468161570a565b9050919050565b7f53616c6520496e61637469766500000000000000000000000000000000000000600082015250565b6000615783600d83614998565b915061578e8261574d565b602082019050919050565b600060208201905081810360008301526157b281615776565b9050919050565b7f4733000000000000000000000000000000000000000000000000000000000000600082015250565b60006157ef600283614998565b91506157fa826157b9565b602082019050919050565b6000602082019050818103600083015261581e816157e2565b9050919050565b6004811061583657615835614cc5565b5b50565b600081905061584782615825565b919050565b600061585782615839565b9050919050565b6158678161584c565b82525050565b600060c082019050615882600083018961585e565b61588f6020830188613f1a565b61589c6040830187613f1a565b6158a96060830186613ee6565b81810360808301526158bb8185614e0c565b90506158ca60a0830184613f1a565b979650505050505050565b7f52434d0000000000000000000000000000000000000000000000000000000000600082015250565b600061590b600383614998565b9150615916826158d5565b602082019050919050565b6000602082019050818103600083015261593a816158fe565b9050919050565b600061594c82613f10565b91506000820361595f5761595e614a15565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006159a0602083614998565b91506159ab8261596a565b602082019050919050565b600060208201905081810360008301526159cf81615993565b9050919050565b60008160011c9050919050565b6000808291508390505b6001851115615a2d57808604811115615a0957615a08614a15565b5b6001851615615a185780820291505b8081029050615a26856159d6565b94506159ed565b94509492505050565b600082615a465760019050615b02565b81615a545760009050615b02565b8160018114615a6a5760028114615a7457615aa3565b6001915050615b02565b60ff841115615a8657615a85614a15565b5b8360020a915084821115615a9d57615a9c614a15565b5b50615b02565b5060208310610133831016604e8410600b8410161715615ad85782820a905083811115615ad357615ad2614a15565b5b615b02565b615ae584848460016159e3565b92509050818404811115615afc57615afb614a15565b5b81810290505b9392505050565b6000615b1482613f10565b9150615b1f83613f10565b9250615b4c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484615a36565b905092915050565b7f5243534d00000000000000000000000000000000000000000000000000000000600082015250565b6000615b8a600483614998565b9150615b9582615b54565b602082019050919050565b60006020820190508181036000830152615bb981615b7d565b905091905056fea264697066735822122012e99c1746e11b45cad42797333841eff1992625e60f6013682643997bfb84f864736f6c63430008130033
| |
1 | 20,290,263 |
22ec87db4327d347d46619fe51a1e67f7898d4da89b1f60cd5e66d57189ac411
|
5c26f3f1f82d7e624a47f9a8bd178d730c2e7c633d5e8c68d8919cdae1ba29f1
|
806ceb343c457d770fe22b492212cf383c2f1f5f
|
a6b71e26c5e0845f74c812102ca7114b6a896ab2
|
5876cadb5c9dd477bf3e3a0f8116f60e3da0c5fe
|
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
|
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,264 |
e7a1e435fb6c615d163f89b72ee37f405d8dd7519f48bc9b2eb19e5b9109b614
|
0108f59135b10be2d7e68117c794ec9bbaeed1c25766f1edda79f512bd03974f
|
250c974b073e13f9ca677798aef589ad531e1f6f
|
bc1e043c8cc9033eceda964a479cdaeff62ce033
|
98a7ea0e18c6b336fd8af2485eea85b28f081d34
|
3d602d80600a3d3981f3363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,264 |
e7a1e435fb6c615d163f89b72ee37f405d8dd7519f48bc9b2eb19e5b9109b614
|
0108f59135b10be2d7e68117c794ec9bbaeed1c25766f1edda79f512bd03974f
|
250c974b073e13f9ca677798aef589ad531e1f6f
|
bc1e043c8cc9033eceda964a479cdaeff62ce033
|
57558cc57561002a51a66d97d1597260a05ea7bf
|
3d602d80600a3d3981f3363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,264 |
e7a1e435fb6c615d163f89b72ee37f405d8dd7519f48bc9b2eb19e5b9109b614
|
0108f59135b10be2d7e68117c794ec9bbaeed1c25766f1edda79f512bd03974f
|
250c974b073e13f9ca677798aef589ad531e1f6f
|
bc1e043c8cc9033eceda964a479cdaeff62ce033
|
06b33f1bff2ffe503b5e5e53b0bec7fe8ba6b0f2
|
3d602d80600a3d3981f3363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,264 |
e7a1e435fb6c615d163f89b72ee37f405d8dd7519f48bc9b2eb19e5b9109b614
|
0108f59135b10be2d7e68117c794ec9bbaeed1c25766f1edda79f512bd03974f
|
250c974b073e13f9ca677798aef589ad531e1f6f
|
bc1e043c8cc9033eceda964a479cdaeff62ce033
|
9964d5ea4201484ab3a2868c7ffd2d142dbb291c
|
3d602d80600a3d3981f3363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73260ed59e7af355aacda4033e9a9ce87c3f0528915af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,272 |
d31b6827d23aef6c839f142af381e27410cf6e0368f91be63c87bc8452479185
|
971cc9e549a1aced0ebc5436b38ac9fbb81de327389db2d3db18c732705efc09
|
205553b5542f0f6a805ef4d167c6b554daddff76
|
a6b71e26c5e0845f74c812102ca7114b6a896ab2
|
30d94fa2e26d43824f2522d38acd32b58683d2a5
|
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
|
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,273 |
840afd95a7081f0f79fdd76ba941eefce192bfabb7084ed8b3e93664569297bf
|
0a12978164116fa68a10d5e4b0ea371c4b399f9d8e2c2f59d4773cd4c516f070
|
f064f244ad7a2043ccbe638ad63b9eb8dbf73ef7
|
f064f244ad7a2043ccbe638ad63b9eb8dbf73ef7
|
584b3197627a93f18ea5d0ae3676a18b14d82d66
| |||
1 | 20,290,279 |
c82bdf5b30106b983b5373e8f35bf7b1620af94d0d097550099c0737555402e7
|
01dcafff8347b5861bd690ae5eaf05af1f16fa44f8a14cc76bb311588356b0fe
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
7a22aa6147be894d6e0c346594ab92a8067f5e3f
|
608060405234801561001057600080fd5b5061319a806100206000396000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c80635c975abb116100ee578063e268474711610097578063f6ed201711610071578063f6ed201714610418578063fbd1d25a1461042b578063fc0c546a14610473578063ff50abdc146104b857600080fd5b8063e2684747146103c2578063e63ab1e9146103e9578063e6400bbe1461041057600080fd5b8063b60f86de116100c8578063b60f86de14610389578063c5ebeaec1461039c578063d547741f146103af57600080fd5b80635c975abb146102f257806391d148541461031c578063a217fddf1461038157600080fd5b80631e83409a1161015b5780632f2ff15d116101355780632f2ff15d146102b157806336568abe146102c4578063413a0f4b146102d75780635c58ce87146102ea57600080fd5b80631e83409a14610253578063248a9ca31461026657806329028eaf146102a857600080fd5b80631794bb3c1161018c5780631794bb3c146102255780631d130935146102385780631d9b07831461024057600080fd5b806301ffc9a7146101b35780630e21750f146101db5780630e7b949e146101f0575b600080fd5b6101c66101c1366004612d02565b6104c0565b60405190151581526020015b60405180910390f35b6101ee6101e9366004612d68565b610559565b005b6102177f2344277e405079ec07749d374ba0b5862a4e45a6a05ac889dbb4a991c6f9354d81565b6040519081526020016101d2565b6101ee610233366004612d83565b6105c8565b6101c66108b2565b6101ee61024e366004612ddf565b6108e4565b6101ee610261366004612d68565b610a2b565b610217610274366004612e12565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b61021760095481565b6101ee6102bf366004612e2b565b610abd565b6101ee6102d2366004612e2b565b610b07565b6101ee6102e5366004612e4e565b610b65565b6101ee610c2e565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff166101c6565b6101c661032a366004612e2b565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b610217600081565b6101ee610397366004612e70565b610c63565b6101ee6103aa366004612e12565b610e20565b6101ee6103bd366004612e2b565b610f70565b6102177f9c60024347074fd9de2c1e36003080d22dbc76a41ef87444d21e361bcb39118e81565b6102177f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6101ee610fb4565b610217610426366004612d68565b610fe6565b610217610439366004612d68565b73ffffffffffffffffffffffffffffffffffffffff166000908152600360205260409020546fffffffffffffffffffffffffffffffff1690565b600a546104939073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d2565b600154610217565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061055357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600061056481610ff2565b61058e7f9c60024347074fd9de2c1e36003080d22dbc76a41ef87444d21e361bcb39118e83610ffc565b6105c4576040517fde5f46d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff166000811580156106135750825b905060008267ffffffffffffffff1660011480156106305750303b155b90508115801561063e575080155b15610675576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117855583156106d65784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b73ffffffffffffffffffffffffffffffffffffffff8816158061070d575073ffffffffffffffffffffffffffffffffffffffff8716155b15610744576040517f5e92482000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8560000361077e576040517ff1e4c27100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610786611124565b610791600032610ffc565b5061079d600033610ffc565b506107c87f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610ffc565b506107f37f2344277e405079ec07749d374ba0b5862a4e45a6a05ac889dbb4a991c6f9354d89610ffc565b506009869055600a805473ffffffffffffffffffffffffffffffffffffffff89167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600b80549091163317905583156108a85784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b60006108df7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff1690565b905090565b73ffffffffffffffffffffffffffffffffffffffff81166109025750335b336000908152600360205260409020546fffffffffffffffffffffffffffffffff9081169083161115610961576040517f5284b85f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61096d6000338461113e565b600061099c61097b336111f7565b610997906fffffffffffffffffffffffffffffffff8616612f25565b611261565b905080156109c857600a546109c89073ffffffffffffffffffffffffffffffffffffffff16838361132a565b6040516fffffffffffffffffffffffffffffffff8416815273ffffffffffffffffffffffffffffffffffffffff8316907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a2505050565b73ffffffffffffffffffffffffffffffffffffffff8116610a495750335b6000610a54336111f7565b9050610a5f81611261565b90508015610a8b57600a546105c49073ffffffffffffffffffffffffffffffffffffffff16838361132a565b6040517fb71ea17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610af781610ff2565b610b018383610ffc565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610b56576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b6082826113ab565b505050565b7f9c60024347074fd9de2c1e36003080d22dbc76a41ef87444d21e361bcb39118e610b8f81610ff2565b610bbf3330610b9e8587612f25565b600a5473ffffffffffffffffffffffffffffffffffffffff16929190611489565b600a54610be59060079073ffffffffffffffffffffffffffffffffffffffff16856114cf565b610bf0600083611518565b60408051848152602081018490527f734c0a295ca078fe3a51bc8053ef5c526c1cf299e96d3350fb54422c82b3790d910160405180910390a1505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610c5881610ff2565b610c6061172e565b50565b610c6b6117cb565b610d0933600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ca1e1656040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d009190612f38565b84918491611827565b610d3f576040517f8eac9a6e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954600154610d61906fffffffffffffffffffffffffffffffff8616612f25565b1115610d99576040517fc4c6ecd900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610da560003385611894565b600a54610ddc9073ffffffffffffffffffffffffffffffffffffffff1633306fffffffffffffffffffffffffffffffff8716611489565b6040516fffffffffffffffffffffffffffffffff8416815233907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c490602001610a1e565b7f2344277e405079ec07749d374ba0b5862a4e45a6a05ac889dbb4a991c6f9354d610e4a81610ff2565b600a546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa158015610eb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edc9190612f38565b821115610f15576040517f0acd1c1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a54610f399073ffffffffffffffffffffffffffffffffffffffff16338461132a565b6040518281527f69c0ed5a77051ba5f0c42418bb6db6d3f73884dea69811c50bf320298df6ca5c9060200160405180910390a15050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610faa81610ff2565b610b0183836113ab565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610fde81610ff2565b610c60611943565b600061055381836119bc565b610c608133611a7b565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff166111135760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556110af3390565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610553565b6000915050610553565b5092915050565b61112c611b27565b611134611b8e565b61113c611b96565b565b6111488383611ba6565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600384016020526040812080548392906111919084906fffffffffffffffffffffffffffffffff16612f51565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550806fffffffffffffffffffffffffffffffff168360010160008282546111ed9190612f7a565b9091555050505050565b60006112038183611d5a565b9050801561125c578173ffffffffffffffffffffffffffffffffffffffff167fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a8260405161125391815260200190565b60405180910390a25b919050565b600a546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600091829173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa1580156112d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f89190612f38565b9050828110156113205761131861130f8285612f7a565b60079033611dbf565b809150611324565b8291505b50919050565b60405173ffffffffffffffffffffffffffffffffffffffff838116602483015260448201839052610b6091859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611dfc565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff16156111135760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610553565b60405173ffffffffffffffffffffffffffffffffffffffff8481166024830152838116604483015260648201839052610b019186918216906323b872dd90608401611364565b6040805180820190915273ffffffffffffffffffffffffffffffffffffffff83168152602081018290525b6115048482611e92565b15610b01576115138482611eb6565b6114fa565b80600003611552576040517fb98dccc500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61155b82611ee7565b600282015468010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff166000036115bf576040517f3a44909f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81546002830154620100009091047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff169060009068010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff16611629670de0b6b3a764000085612f8d565b6116339190612fa4565b9050807dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660000361168f576040517fe1ee381700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8354819085906002906116c99084906201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16612fdf565b92506101000a8154817dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550610b018285611f9690919063ffffffff16565b61173661214c565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a150565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff161561113c576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600182016118395750600161188c565b611889858584611884876040805173ffffffffffffffffffffffffffffffffffffffff8316602082015260009101604051602081830303815290604052805190602001209050919050565b6121a7565b90505b949350505050565b61189e8383611ba6565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600384016020526040812080548392906118e79084906fffffffffffffffffffffffffffffffff16613016565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550806fffffffffffffffffffffffffffffffff168360010160008282546111ed9190612f25565b61194b6117cb565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336117a0565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020908152604080832080546001909101546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16845260048601909252909120547001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff16901561055357611a5883836121e1565b611a74906fffffffffffffffffffffffffffffffff1682612f25565b9392505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166105c4576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602481018390526044015b60405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661113c576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61113c611b27565b611b9e611b27565b61113c612224565b611baf82611ee7565b611bb98282612275565b611c21828273ffffffffffffffffffffffffffffffffffffffff1660009081526003820160209081526040808320600101546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168352600490930190522054151590565b15611cf1576000611c3283836121e1565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600385016020526040902080549192508291601090611c9490849070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16613016565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000816fffffffffffffffffffffffffffffffff161115611cef57611cef8383612407565b505b815473ffffffffffffffffffffffffffffffffffffffff91909116600090815260039092016020526040909120600101805461ffff1662010000928390047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16909202919091179055565b6000611d668383611ba6565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260039091016020526040902080546fffffffffffffffffffffffffffffffff80821690925570010000000000000000000000000000000090041690565b610b6060405180604001604052808373ffffffffffffffffffffffffffffffffffffffff168152602001848152508461254990919063ffffffff16565b6000611e1e73ffffffffffffffffffffffffffffffffffffffff8416836125b2565b90508051600014158015611e43575080806020019051810190611e41919061303f565b155b15610b60576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401611b1e565b600080611e9e846125c0565b15905080801561188c57505050602001511515919050565b6000611ec1836125d2565b9050816020015181600101541115611edd57610b608183612602565b610b608383612658565b611ef0816126c9565b600282018054600890611f2a90849068010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff16613061565b82546101009290920a77ffffffffffffffffffffffffffffffffffffffffffffffff8181021990931691909216919091021790555060020180547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000164267ffffffffffffffff16179055565b81546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168103611ff6576040517f26b2e43500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815460008281526004840160209081526040808320620100009094047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16909355600685019052908120546120499042612f7a565b835490915060009082906120849085906201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16612f7a565b61208e9190612f8d565b60008481526005860160205260409020549091506120ad908290612f25565b84547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff62010000918290048116600090815260058801602090815260408083209590955560028901805467ffffffffffffffff169055885493909304909116815260068701909152908120429055845461ffff1690859061212b83613092565b91906101000a81548161ffff021916908361ffff1602179055505050505050565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff1661113c576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600083156121d9578360051b8501855b803580851160051b948552602094851852604060002093018181106121b75750505b501492915050565b6000806121ee848461270e565b905060006121fc8585612810565b9050670de0b6b3a76400006122118284612f25565b61221b9190612fa4565b95945050505050565b61222c611b27565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020526040812060010190806122ac858486612920565b91509150818360010160088282829054906101000a900477ffffffffffffffffffffffffffffffffffffffffffffffff166122e79190613061565b82546101009290920a77ffffffffffffffffffffffffffffffffffffffffffffffff818102199093169190921691909102179055506001830180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff831617905561235c8585612a32565b1561240057612400858573ffffffffffffffffffffffffffffffffffffffff166000908152600382016020526040902060028101805467ffffffffffffffff42167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909116811782559254600190920180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff9093169290921790915555565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020908152604080832085546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16845260068601909252909120546001909101906124768142612f7a565b73ffffffffffffffffffffffffffffffffffffffff841660009081526003860160205260409020546124ba91906fffffffffffffffffffffffffffffffff16612f8d565b4267ffffffffffffffff1677ffffffffffffffffffffffffffffffffffffffffffffffff9190911668010000000000000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001617600183015550915482547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff9091161790915550565b6001918201805480840182556000918252602091829020835160029092020180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091178155910151910155565b6060611a7483836000612af2565b60006125cb82612bb5565b1592915050565b6000816001018260000154815481106125ed576125ed6130b3565b90600052602060002090600202019050919050565b806020015182600101600082825461261a9190612f7a565b909155505081546020820151825161264d9273ffffffffffffffffffffffffffffffffffffffff9182169291169061132a565b600060209091015250565b600061266383612bc8565b60408051808201909152815473ffffffffffffffffffffffffffffffffffffffff9081168083526001909301546020830181905285519294506126ab9392909116919061132a565b8060200151826020018181516126c19190612f7a565b905250505050565b600281015460009067ffffffffffffffff161561125c5760028201546000906126fc9067ffffffffffffffff1642612f7a565b9050808360010154611a749190612f8d565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020908152604080832060010180546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1680855260048701909352908320549091839061277f9083612f7a565b600184015490915060009067ffffffffffffffff1642146127a9576127a5878588612920565b5090505b600184015482906127e190839068010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff16613061565b77ffffffffffffffffffffffffffffffffffffffffffffffff166128059190612f8d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020526040812060019081018054909183916128529161ffff909116906130e2565b855461ffff918216911611905080156129185784547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff620100009182900481166000908152600588016020818152604080842054885496909604909416835260048a0181528383205483525290812054906128cb8284612f7a565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260038a016020526040902054909150612912906fffffffffffffffffffffffffffffffff1682612f8d565b95505050505b505092915050565b600182015473ffffffffffffffffffffffffffffffffffffffff82166000908152600385016020526040812054845486549293849367ffffffffffffffff909116926fffffffffffffffffffffffffffffffff169161ffff918216911614801561298a5750600082115b156129ad576129998242612f7a565b6129a39082612f8d565b9350429250612a28565b85546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600090815260048801602090815260408083205480845260068b01909252909120548084108015612a065750600083115b15612a2557612a158482612f7a565b612a1f9084612f8d565b95508094505b50505b5050935093915050565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260038401602081815260408084206001810180546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1686526004890184528286205480875260068a01855292862054600283015497875294909352549394919390929167ffffffffffffffff1690818314906fffffffffffffffffffffffffffffffff16158015612ae05750805b80612912575050159695505050505050565b606081471015612b30576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611b1e565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051612b5991906130fd565b60006040518083038185875af1925050503d8060008114612b96576040519150601f19603f3d011682016040523d82523d6000602084013e612b9b565b606091505b5091509150612bab868383612c31565b9695505050505050565b8054600182015460009161055391612f7a565b6000612bd3826125c0565b15612c0a576040517f63c3654900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81546001830190836000612c1d8361312c565b91905055815481106125ed576125ed6130b3565b606082612c4657612c4182612cc0565b611a74565b8151158015612c6a575073ffffffffffffffffffffffffffffffffffffffff84163b155b15612cb9576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401611b1e565b5080611a74565b805115612cd05780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612d1457600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611a7457600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461125c57600080fd5b600060208284031215612d7a57600080fd5b611a7482612d44565b600080600060608486031215612d9857600080fd5b612da184612d44565b9250612daf60208501612d44565b9150604084013590509250925092565b80356fffffffffffffffffffffffffffffffff8116811461125c57600080fd5b60008060408385031215612df257600080fd5b612dfb83612dbf565b9150612e0960208401612d44565b90509250929050565b600060208284031215612e2457600080fd5b5035919050565b60008060408385031215612e3e57600080fd5b82359150612e0960208401612d44565b60008060408385031215612e6157600080fd5b50508035926020909101359150565b600080600060408486031215612e8557600080fd5b612e8e84612dbf565b9250602084013567ffffffffffffffff80821115612eab57600080fd5b818601915086601f830112612ebf57600080fd5b813581811115612ece57600080fd5b8760208260051b8501011115612ee357600080fd5b6020830194508093505050509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561055357610553612ef6565b600060208284031215612f4a57600080fd5b5051919050565b6fffffffffffffffffffffffffffffffff82811682821603908082111561111d5761111d612ef6565b8181038181111561055357610553612ef6565b808202811582820484141761055357610553612ef6565b600082612fda577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81811683821601908082111561111d5761111d612ef6565b6fffffffffffffffffffffffffffffffff81811683821601908082111561111d5761111d612ef6565b60006020828403121561305157600080fd5b81518015158114611a7457600080fd5b77ffffffffffffffffffffffffffffffffffffffffffffffff81811683821601908082111561111d5761111d612ef6565b600061ffff8083168181036130a9576130a9612ef6565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b61ffff81811683821601908082111561111d5761111d612ef6565b6000825160005b8181101561311e5760208186018101518583015201613104565b506000920191825250919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361315d5761315d612ef6565b506001019056fea2646970667358221220531fd761d181c5cbf7c3204fb37b1e8f42d1c7765ba8b42b2e8d94486b539e3164736f6c63430008160033
|
608060405234801561001057600080fd5b50600436106101ae5760003560e01c80635c975abb116100ee578063e268474711610097578063f6ed201711610071578063f6ed201714610418578063fbd1d25a1461042b578063fc0c546a14610473578063ff50abdc146104b857600080fd5b8063e2684747146103c2578063e63ab1e9146103e9578063e6400bbe1461041057600080fd5b8063b60f86de116100c8578063b60f86de14610389578063c5ebeaec1461039c578063d547741f146103af57600080fd5b80635c975abb146102f257806391d148541461031c578063a217fddf1461038157600080fd5b80631e83409a1161015b5780632f2ff15d116101355780632f2ff15d146102b157806336568abe146102c4578063413a0f4b146102d75780635c58ce87146102ea57600080fd5b80631e83409a14610253578063248a9ca31461026657806329028eaf146102a857600080fd5b80631794bb3c1161018c5780631794bb3c146102255780631d130935146102385780631d9b07831461024057600080fd5b806301ffc9a7146101b35780630e21750f146101db5780630e7b949e146101f0575b600080fd5b6101c66101c1366004612d02565b6104c0565b60405190151581526020015b60405180910390f35b6101ee6101e9366004612d68565b610559565b005b6102177f2344277e405079ec07749d374ba0b5862a4e45a6a05ac889dbb4a991c6f9354d81565b6040519081526020016101d2565b6101ee610233366004612d83565b6105c8565b6101c66108b2565b6101ee61024e366004612ddf565b6108e4565b6101ee610261366004612d68565b610a2b565b610217610274366004612e12565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b61021760095481565b6101ee6102bf366004612e2b565b610abd565b6101ee6102d2366004612e2b565b610b07565b6101ee6102e5366004612e4e565b610b65565b6101ee610c2e565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff166101c6565b6101c661032a366004612e2b565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b610217600081565b6101ee610397366004612e70565b610c63565b6101ee6103aa366004612e12565b610e20565b6101ee6103bd366004612e2b565b610f70565b6102177f9c60024347074fd9de2c1e36003080d22dbc76a41ef87444d21e361bcb39118e81565b6102177f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6101ee610fb4565b610217610426366004612d68565b610fe6565b610217610439366004612d68565b73ffffffffffffffffffffffffffffffffffffffff166000908152600360205260409020546fffffffffffffffffffffffffffffffff1690565b600a546104939073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d2565b600154610217565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061055357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600061056481610ff2565b61058e7f9c60024347074fd9de2c1e36003080d22dbc76a41ef87444d21e361bcb39118e83610ffc565b6105c4576040517fde5f46d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff166000811580156106135750825b905060008267ffffffffffffffff1660011480156106305750303b155b90508115801561063e575080155b15610675576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117855583156106d65784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b73ffffffffffffffffffffffffffffffffffffffff8816158061070d575073ffffffffffffffffffffffffffffffffffffffff8716155b15610744576040517f5e92482000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8560000361077e576040517ff1e4c27100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610786611124565b610791600032610ffc565b5061079d600033610ffc565b506107c87f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610ffc565b506107f37f2344277e405079ec07749d374ba0b5862a4e45a6a05ac889dbb4a991c6f9354d89610ffc565b506009869055600a805473ffffffffffffffffffffffffffffffffffffffff89167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600b80549091163317905583156108a85784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b60006108df7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff1690565b905090565b73ffffffffffffffffffffffffffffffffffffffff81166109025750335b336000908152600360205260409020546fffffffffffffffffffffffffffffffff9081169083161115610961576040517f5284b85f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61096d6000338461113e565b600061099c61097b336111f7565b610997906fffffffffffffffffffffffffffffffff8616612f25565b611261565b905080156109c857600a546109c89073ffffffffffffffffffffffffffffffffffffffff16838361132a565b6040516fffffffffffffffffffffffffffffffff8416815273ffffffffffffffffffffffffffffffffffffffff8316907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a2505050565b73ffffffffffffffffffffffffffffffffffffffff8116610a495750335b6000610a54336111f7565b9050610a5f81611261565b90508015610a8b57600a546105c49073ffffffffffffffffffffffffffffffffffffffff16838361132a565b6040517fb71ea17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610af781610ff2565b610b018383610ffc565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610b56576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b6082826113ab565b505050565b7f9c60024347074fd9de2c1e36003080d22dbc76a41ef87444d21e361bcb39118e610b8f81610ff2565b610bbf3330610b9e8587612f25565b600a5473ffffffffffffffffffffffffffffffffffffffff16929190611489565b600a54610be59060079073ffffffffffffffffffffffffffffffffffffffff16856114cf565b610bf0600083611518565b60408051848152602081018490527f734c0a295ca078fe3a51bc8053ef5c526c1cf299e96d3350fb54422c82b3790d910160405180910390a1505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610c5881610ff2565b610c6061172e565b50565b610c6b6117cb565b610d0933600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ca1e1656040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d009190612f38565b84918491611827565b610d3f576040517f8eac9a6e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954600154610d61906fffffffffffffffffffffffffffffffff8616612f25565b1115610d99576040517fc4c6ecd900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610da560003385611894565b600a54610ddc9073ffffffffffffffffffffffffffffffffffffffff1633306fffffffffffffffffffffffffffffffff8716611489565b6040516fffffffffffffffffffffffffffffffff8416815233907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c490602001610a1e565b7f2344277e405079ec07749d374ba0b5862a4e45a6a05ac889dbb4a991c6f9354d610e4a81610ff2565b600a546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa158015610eb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edc9190612f38565b821115610f15576040517f0acd1c1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a54610f399073ffffffffffffffffffffffffffffffffffffffff16338461132a565b6040518281527f69c0ed5a77051ba5f0c42418bb6db6d3f73884dea69811c50bf320298df6ca5c9060200160405180910390a15050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610faa81610ff2565b610b0183836113ab565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610fde81610ff2565b610c60611943565b600061055381836119bc565b610c608133611a7b565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff166111135760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556110af3390565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610553565b6000915050610553565b5092915050565b61112c611b27565b611134611b8e565b61113c611b96565b565b6111488383611ba6565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600384016020526040812080548392906111919084906fffffffffffffffffffffffffffffffff16612f51565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550806fffffffffffffffffffffffffffffffff168360010160008282546111ed9190612f7a565b9091555050505050565b60006112038183611d5a565b9050801561125c578173ffffffffffffffffffffffffffffffffffffffff167fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a8260405161125391815260200190565b60405180910390a25b919050565b600a546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600091829173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa1580156112d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f89190612f38565b9050828110156113205761131861130f8285612f7a565b60079033611dbf565b809150611324565b8291505b50919050565b60405173ffffffffffffffffffffffffffffffffffffffff838116602483015260448201839052610b6091859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611dfc565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff16156111135760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610553565b60405173ffffffffffffffffffffffffffffffffffffffff8481166024830152838116604483015260648201839052610b019186918216906323b872dd90608401611364565b6040805180820190915273ffffffffffffffffffffffffffffffffffffffff83168152602081018290525b6115048482611e92565b15610b01576115138482611eb6565b6114fa565b80600003611552576040517fb98dccc500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61155b82611ee7565b600282015468010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff166000036115bf576040517f3a44909f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81546002830154620100009091047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff169060009068010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff16611629670de0b6b3a764000085612f8d565b6116339190612fa4565b9050807dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660000361168f576040517fe1ee381700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8354819085906002906116c99084906201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16612fdf565b92506101000a8154817dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550610b018285611f9690919063ffffffff16565b61173661214c565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a150565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff161561113c576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600182016118395750600161188c565b611889858584611884876040805173ffffffffffffffffffffffffffffffffffffffff8316602082015260009101604051602081830303815290604052805190602001209050919050565b6121a7565b90505b949350505050565b61189e8383611ba6565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600384016020526040812080548392906118e79084906fffffffffffffffffffffffffffffffff16613016565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550806fffffffffffffffffffffffffffffffff168360010160008282546111ed9190612f25565b61194b6117cb565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336117a0565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020908152604080832080546001909101546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16845260048601909252909120547001000000000000000000000000000000009091046fffffffffffffffffffffffffffffffff16901561055357611a5883836121e1565b611a74906fffffffffffffffffffffffffffffffff1682612f25565b9392505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166105c4576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602481018390526044015b60405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661113c576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61113c611b27565b611b9e611b27565b61113c612224565b611baf82611ee7565b611bb98282612275565b611c21828273ffffffffffffffffffffffffffffffffffffffff1660009081526003820160209081526040808320600101546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168352600490930190522054151590565b15611cf1576000611c3283836121e1565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600385016020526040902080549192508291601090611c9490849070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16613016565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000816fffffffffffffffffffffffffffffffff161115611cef57611cef8383612407565b505b815473ffffffffffffffffffffffffffffffffffffffff91909116600090815260039092016020526040909120600101805461ffff1662010000928390047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16909202919091179055565b6000611d668383611ba6565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260039091016020526040902080546fffffffffffffffffffffffffffffffff80821690925570010000000000000000000000000000000090041690565b610b6060405180604001604052808373ffffffffffffffffffffffffffffffffffffffff168152602001848152508461254990919063ffffffff16565b6000611e1e73ffffffffffffffffffffffffffffffffffffffff8416836125b2565b90508051600014158015611e43575080806020019051810190611e41919061303f565b155b15610b60576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401611b1e565b600080611e9e846125c0565b15905080801561188c57505050602001511515919050565b6000611ec1836125d2565b9050816020015181600101541115611edd57610b608183612602565b610b608383612658565b611ef0816126c9565b600282018054600890611f2a90849068010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff16613061565b82546101009290920a77ffffffffffffffffffffffffffffffffffffffffffffffff8181021990931691909216919091021790555060020180547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000164267ffffffffffffffff16179055565b81546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168103611ff6576040517f26b2e43500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815460008281526004840160209081526040808320620100009094047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16909355600685019052908120546120499042612f7a565b835490915060009082906120849085906201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16612f7a565b61208e9190612f8d565b60008481526005860160205260409020549091506120ad908290612f25565b84547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff62010000918290048116600090815260058801602090815260408083209590955560028901805467ffffffffffffffff169055885493909304909116815260068701909152908120429055845461ffff1690859061212b83613092565b91906101000a81548161ffff021916908361ffff1602179055505050505050565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff1661113c576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600083156121d9578360051b8501855b803580851160051b948552602094851852604060002093018181106121b75750505b501492915050565b6000806121ee848461270e565b905060006121fc8585612810565b9050670de0b6b3a76400006122118284612f25565b61221b9190612fa4565b95945050505050565b61222c611b27565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f0330080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020526040812060010190806122ac858486612920565b91509150818360010160088282829054906101000a900477ffffffffffffffffffffffffffffffffffffffffffffffff166122e79190613061565b82546101009290920a77ffffffffffffffffffffffffffffffffffffffffffffffff818102199093169190921691909102179055506001830180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff831617905561235c8585612a32565b1561240057612400858573ffffffffffffffffffffffffffffffffffffffff166000908152600382016020526040902060028101805467ffffffffffffffff42167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909116811782559254600190920180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff9093169290921790915555565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020908152604080832085546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16845260068601909252909120546001909101906124768142612f7a565b73ffffffffffffffffffffffffffffffffffffffff841660009081526003860160205260409020546124ba91906fffffffffffffffffffffffffffffffff16612f8d565b4267ffffffffffffffff1677ffffffffffffffffffffffffffffffffffffffffffffffff9190911668010000000000000000027fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001617600183015550915482547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff9091161790915550565b6001918201805480840182556000918252602091829020835160029092020180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091178155910151910155565b6060611a7483836000612af2565b60006125cb82612bb5565b1592915050565b6000816001018260000154815481106125ed576125ed6130b3565b90600052602060002090600202019050919050565b806020015182600101600082825461261a9190612f7a565b909155505081546020820151825161264d9273ffffffffffffffffffffffffffffffffffffffff9182169291169061132a565b600060209091015250565b600061266383612bc8565b60408051808201909152815473ffffffffffffffffffffffffffffffffffffffff9081168083526001909301546020830181905285519294506126ab9392909116919061132a565b8060200151826020018181516126c19190612f7a565b905250505050565b600281015460009067ffffffffffffffff161561125c5760028201546000906126fc9067ffffffffffffffff1642612f7a565b9050808360010154611a749190612f8d565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020908152604080832060010180546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1680855260048701909352908320549091839061277f9083612f7a565b600184015490915060009067ffffffffffffffff1642146127a9576127a5878588612920565b5090505b600184015482906127e190839068010000000000000000900477ffffffffffffffffffffffffffffffffffffffffffffffff16613061565b77ffffffffffffffffffffffffffffffffffffffffffffffff166128059190612f8d565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600383016020526040812060019081018054909183916128529161ffff909116906130e2565b855461ffff918216911611905080156129185784547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff620100009182900481166000908152600588016020818152604080842054885496909604909416835260048a0181528383205483525290812054906128cb8284612f7a565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260038a016020526040902054909150612912906fffffffffffffffffffffffffffffffff1682612f8d565b95505050505b505092915050565b600182015473ffffffffffffffffffffffffffffffffffffffff82166000908152600385016020526040812054845486549293849367ffffffffffffffff909116926fffffffffffffffffffffffffffffffff169161ffff918216911614801561298a5750600082115b156129ad576129998242612f7a565b6129a39082612f8d565b9350429250612a28565b85546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600090815260048801602090815260408083205480845260068b01909252909120548084108015612a065750600083115b15612a2557612a158482612f7a565b612a1f9084612f8d565b95508094505b50505b5050935093915050565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260038401602081815260408084206001810180546201000090047dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1686526004890184528286205480875260068a01855292862054600283015497875294909352549394919390929167ffffffffffffffff1690818314906fffffffffffffffffffffffffffffffff16158015612ae05750805b80612912575050159695505050505050565b606081471015612b30576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611b1e565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051612b5991906130fd565b60006040518083038185875af1925050503d8060008114612b96576040519150601f19603f3d011682016040523d82523d6000602084013e612b9b565b606091505b5091509150612bab868383612c31565b9695505050505050565b8054600182015460009161055391612f7a565b6000612bd3826125c0565b15612c0a576040517f63c3654900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81546001830190836000612c1d8361312c565b91905055815481106125ed576125ed6130b3565b606082612c4657612c4182612cc0565b611a74565b8151158015612c6a575073ffffffffffffffffffffffffffffffffffffffff84163b155b15612cb9576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401611b1e565b5080611a74565b805115612cd05780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612d1457600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611a7457600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461125c57600080fd5b600060208284031215612d7a57600080fd5b611a7482612d44565b600080600060608486031215612d9857600080fd5b612da184612d44565b9250612daf60208501612d44565b9150604084013590509250925092565b80356fffffffffffffffffffffffffffffffff8116811461125c57600080fd5b60008060408385031215612df257600080fd5b612dfb83612dbf565b9150612e0960208401612d44565b90509250929050565b600060208284031215612e2457600080fd5b5035919050565b60008060408385031215612e3e57600080fd5b82359150612e0960208401612d44565b60008060408385031215612e6157600080fd5b50508035926020909101359150565b600080600060408486031215612e8557600080fd5b612e8e84612dbf565b9250602084013567ffffffffffffffff80821115612eab57600080fd5b818601915086601f830112612ebf57600080fd5b813581811115612ece57600080fd5b8760208260051b8501011115612ee357600080fd5b6020830194508093505050509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561055357610553612ef6565b600060208284031215612f4a57600080fd5b5051919050565b6fffffffffffffffffffffffffffffffff82811682821603908082111561111d5761111d612ef6565b8181038181111561055357610553612ef6565b808202811582820484141761055357610553612ef6565b600082612fda577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81811683821601908082111561111d5761111d612ef6565b6fffffffffffffffffffffffffffffffff81811683821601908082111561111d5761111d612ef6565b60006020828403121561305157600080fd5b81518015158114611a7457600080fd5b77ffffffffffffffffffffffffffffffffffffffffffffffff81811683821601908082111561111d5761111d612ef6565b600061ffff8083168181036130a9576130a9612ef6565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b61ffff81811683821601908082111561111d5761111d612ef6565b6000825160005b8181101561311e5760208186018101518583015201613104565b506000920191825250919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361315d5761315d612ef6565b506001019056fea2646970667358221220531fd761d181c5cbf7c3204fb37b1e8f42d1c7765ba8b42b2e8d94486b539e3164736f6c63430008160033
|
{{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.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 \"@openzeppelin/contracts/access/IAccessControl.sol\";\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {ERC165Upgradeable} from \"../utils/introspection/ERC165Upgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {\n struct RoleData {\n mapping(address account => bool) hasRole;\n bytes32 adminRole;\n }\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n\n /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl\n struct AccessControlStorage {\n mapping(bytes32 role => RoleData) _roles;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.AccessControl\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;\n\n function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {\n assembly {\n $.slot := AccessControlStorageLocation\n }\n }\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 function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\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 AccessControlStorage storage $ = _getAccessControlStorage();\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 AccessControlStorage storage $ = _getAccessControlStorage();\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 AccessControlStorage storage $ = _getAccessControlStorage();\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 AccessControlStorage storage $ = _getAccessControlStorage();\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 AccessControlStorage storage $ = _getAccessControlStorage();\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-upgradeable/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 = 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-upgradeable/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\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 ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\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-upgradeable/utils/introspection/ERC165Upgradeable.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 \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165 {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\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-upgradeable/utils/PausableUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {\n /// @custom:storage-location erc7201:openzeppelin.storage.Pausable\n struct PausableStorage {\n bool _paused;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Pausable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;\n\n function _getPausableStorage() private pure returns (PausableStorage storage $) {\n assembly {\n $.slot := PausableStorageLocation\n }\n }\n\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 /**\n * @dev The operation failed because the contract is paused.\n */\n error EnforcedPause();\n\n /**\n * @dev The operation failed because the contract is not paused.\n */\n error ExpectedPause();\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n PausableStorage storage $ = _getPausableStorage();\n $._paused = false;\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 _requireNotPaused();\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 _requirePaused();\n _;\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 PausableStorage storage $ = _getPausableStorage();\n return $._paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n if (paused()) {\n revert EnforcedPause();\n }\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n if (!paused()) {\n revert ExpectedPause();\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 PausableStorage storage $ = _getPausableStorage();\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 PausableStorage storage $ = _getPausableStorage();\n $._paused = false;\n emit Unpaused(_msgSender());\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/interfaces/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\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/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"
},
"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/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/liquidityPool/Debt.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.22;\n\nimport {DebtManager} from \"contracts/liquidityManagement/liquidityPool/libraries/DebtManager.sol\";\n\n/**\n * @title PoolDebt\n * @notice This type of debt is created when a Liquidity Provider attempts to withdraw or claim funds\n * while the pool does not have enough tokens to fulfill the request immediately.\n * @notice Once created, this debt will be automatically settled by the [`IDispatcher`](/interfaces/marginEngine/IDispatcher.sol/interface.IDispatcher.html) during the next liquidation or closure.\n * @dev `creditor` The address of the liquidity provider.\n * @dev `amount` The amount of the debt.\n */\nstruct PoolDebt {\n address creditor;\n uint256 amount;\n}\n\nusing DebtManager for PoolDebt global;\n"
},
"contracts/interfaces/liquidityManagement/liquidityPool/IMerkleTreeWhitelist.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IMerkleTreeWhitelist {\n /**\n * @notice Sets the root hash of the Merkle tree used for on-chain proof verification.\n * @dev if `root` is `bytes32(type(uint256).max)`, Merkle Tree verification is disabled.\n * (see [`IPool.deposit()`](/interfaces/liquidityManagement/liquidityPool/IPool.sol/interface.IPool.html#deposit)).\n * @param root new hash root of the Merkle tree.\n */\n function setRoot(bytes32 root) external;\n\n /**\n * @notice Retrieves the current root hash of the Merkle tree used for on-chain proof verification.\n * @return root current hash root of the Merkle tree.\n */\n function getRoot() external view returns (bytes32 root);\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/interfaces/liquidityManagement/liquidityPool/IPoolInitializer.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IPoolInitializer {\n function initialize(\n address borrower,\n address token_,\n uint256 thresholdOnTotalDeposit_\n ) external;\n\n function setFund(address fund) external;\n}\n"
},
"contracts/interfaces/liquidityManagement/liquidityPool/ISuspendable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface ISuspendable {\n /**\n * @notice Forbids to make deposit to anyone. Only withdrawal will be possible\n * reverts if pool is suspended\n */\n function suspend() external;\n\n /**\n * @notice Allows to make both deposit and withdrawal\n * reverts if pool is not suspended\n */\n function unsuspend() external;\n\n function isSuspended() external view returns (bool);\n}\n"
},
"contracts/interfaces/liquidityManagement/liquidityPool/Queue.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.22;\n\nimport {PoolDebt} from \"contracts/interfaces/liquidityManagement/liquidityPool/Debt.sol\";\nimport {QueueLibrary} from \"contracts/liquidityManagement/liquidityPool/libraries/QueueLibrary.sol\";\n\n/**\n * @title Queue\n * @notice Represents a queue structure.\n * @dev `head` The index of the first element in the queue.\n * @dev `elements` An array of elements of type [`PoolDebt`](/interfaces/liquidityManagement/liquidityPool/Debt.sol/struct.PoolDebt.html).\n */\nstruct Queue {\n uint256 head;\n PoolDebt[] elements;\n}\n\n/**\n * @dev Error indicating that the queue is empty and no elements are available.\n */\nerror QueueIsEmpty();\n\nusing QueueLibrary for Queue global;\n"
},
"contracts/interfaces/liquidityManagement/liquidityPool/Staking.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {\n PositionManager\n} from \"contracts/liquidityManagement/liquidityPool/libraries/staking/PositionManager.sol\";\nimport {\n RewardsMath\n} from \"contracts/liquidityManagement/liquidityPool/libraries/staking/RewardsMath.sol\";\n\nuint256 constant DENOMINATOR = 1e18;\n\n/* solhint-disable var-name-mixedcase */\n\n/**\n * @title Staking\n * @notice TPSS is a token reward unit per staked token unit per staked time unit.\n * @dev For example, if TPSS is 2.5e-6 USDT per 1 USDT staked per second,\n * a user staking 200 USDT for 2 days will receive a reward of (200 * 2 * 86400 * 2.5e-6) USDT.\n * @dev `numberOfEpochs`: Slot 0, updated during distribution.\n * @dev `TPSS`: Slot 0, updated during distribution. Represents Token reward per staked token unit per staked time unit.\n * @dev `totalDeposited`: Slot 1, updated during deposit or withdrawal.\n * @dev `timeWhenVolumeWasLastUpdated`: Slot 2, updated during deposit, withdrawal, or distribution.\n * @dev `tokenVolume`: Slot 2, updated during deposit, withdrawal, or distribution.\n * @dev `users`: Mapping of addresses to User positions.\n * @dev `linkedListTPSS`: Mapping for epoch TPSS.\n * @dev `TPSS2TPS`: Mapping from TPSS to TPS in the epoch. \"Token Per Stake\" cannot be derived from \"Token Per Stake per Second\"\n * unless all epochs are equal in duration which is practically impossible. Thus to know TPS differences when calculating rewards\n * for the whole number of epochs, we must know boundaries in TPS, not TPSS.\n * @dev `epochStartTime`: Mapping for epoch start time.\n */\nstruct Staking {\n // 0 slot, updated on distribution\n uint16 numberOfEpochs;\n // solhint-disable-next-line var-name-mixedcase\n uint240 TPSS;\n // 1 slot, updated on deposit | withdraw\n uint256 totalDeposited;\n // 2 slot, updated on deposit | withdraw | distribution\n uint64 timeWhenVolumeWasLastUpdated;\n uint192 tokenVolume;\n mapping(address user => User position) users;\n mapping(uint256 previousEpochTPSS => uint256 nextEpochTPSS) linkedListTPSS;\n // solhint-disable-next-line var-name-mixedcase\n mapping(uint256 epochTPSS => uint256 epochTPS) TPSS2TPS;\n mapping(uint256 epochTPSS => uint256 epochStartTimestamp) epochStartTime;\n}\n\n/**\n * @title IncompleteEpoch\n * @notice Represents an incomplete epoch structure.\n * @dev `epochNum`: Slot 0, updated during deposit or withdrawal. Represents the epoch number.\n * @dev `TPSS`: Slot 0, updated during deposit or withdrawal. Represents the Token reward per staked token unit per staked time unit.\n * @dev `timeWhenUserVolumeWasLastUpdated`: Slot 1, updated during deposit or withdrawal.\n * @dev `volume`: Slot 1, updated during deposit or withdrawal. Represents the volume.\n */\nstruct IncompleteEpoch {\n uint16 epochNum;\n uint240 TPSS;\n uint64 timeWhenUserVolumeWasLastUpdated;\n uint192 volume;\n}\n\n/**\n * @title User\n * @notice Represents a user's staking information.\n * @dev `balance`: The user's staked token balance.\n * @dev `accumulatedRewards`: The total rewards accumulated by the user.\n * @dev `depositEpoch`: The [`IncompleteEpoch`](./struct.IncompleteEpoch.html) structure representing the user's deposit information.\n */\nstruct User {\n uint128 balance;\n uint128 accumulatedRewards;\n IncompleteEpoch depositEpoch;\n}\n\n/**\n * @notice Thrown when borrower tries to finish the\n * epoch by distributing the rewards, but epoch volume is zero.\n */\nerror TokenVolumeIsZero();\n\n/**\n * @notice Thrown when tried to finish the epoch with zero interest.\n */\nerror InterestMustBeGreaterThanZero();\n\n/**\n * @notice Thrown when tried to finish the epoch with insufficient\n * interest meaning after math the TPSS increment will be zero.\n */\nerror InterestInsufficient();\n\n/**\n * @notice If this error is thrown, then it means that there is missing\n * check on rewards != 0 somewhere in the code.\n */\nerror CannotStartNewEpochWithSameTPSS();\n\nusing {PositionManager.increasePosition, PositionManager.decreasePosition} for Staking global;\nusing {\n RewardsMath.updateUserRewards,\n RewardsMath.increaseInterest,\n RewardsMath.claimRewards,\n RewardsMath.getUserRewards\n} for Staking global;\n\n/* solhint-enable var-name-mixedcase */\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/liquidityManagement/liquidityPool/base/Suspendable.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {\n AccessControlUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\nimport {\n PausableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\";\nimport {\n ISuspendable\n} from \"contracts/interfaces/liquidityManagement/liquidityPool/ISuspendable.sol\";\n\ncontract Suspendable is ISuspendable, AccessControlUpgradeable, PausableUpgradeable {\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n function suspend() external override onlyRole(PAUSER_ROLE) {\n _pause();\n }\n\n function unsuspend() external override onlyRole(PAUSER_ROLE) {\n _unpause();\n }\n\n function isSuspended() external view override returns (bool) {\n return paused();\n }\n\n // solhint-disable-next-line func-name-mixedcase\n function __Suspendable_init() internal onlyInitializing {\n __AccessControl_init();\n __Pausable_init();\n }\n}\n"
},
"contracts/liquidityManagement/liquidityPool/libraries/DebtManager.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport {Asset} from \"contracts/interfaces/accountAbstraction/compliance/Asset.sol\";\nimport {PoolDebt} from \"contracts/interfaces/liquidityManagement/liquidityPool/Debt.sol\";\nimport {Queue} from \"contracts/interfaces/liquidityManagement/liquidityPool/Queue.sol\";\n\nlibrary DebtManager {\n using {canRepay, dequeueAndRepay} for Queue;\n using {partialRepay} for PoolDebt;\n using SafeERC20 for IERC20;\n\n function create(Queue storage self, uint256 amount, address creditor) internal {\n self.enqueue(PoolDebt(creditor, amount));\n }\n\n function tryRepay(Queue storage self, address token, uint256 amount) internal {\n Asset memory asset = Asset(token, amount);\n\n while (self.canRepay(asset)) {\n tryRepay(self, asset);\n }\n }\n\n function tryRepay(Queue storage self, Asset memory asset) private {\n PoolDebt storage debt = self.peek();\n\n if (debt.amount > asset.amount) debt.partialRepay(asset);\n else self.dequeueAndRepay(asset);\n }\n\n function partialRepay(PoolDebt storage self, Asset memory asset) private {\n self.amount -= asset.amount;\n IERC20(asset.token).safeTransfer(self.creditor, asset.amount);\n\n delete asset.amount;\n }\n\n function dequeueAndRepay(Queue storage self, Asset memory asset) private {\n PoolDebt memory debt = self.dequeue();\n IERC20(asset.token).safeTransfer(debt.creditor, debt.amount);\n\n asset.amount -= debt.amount;\n }\n\n function canRepay(Queue storage self, Asset memory asset) private view returns (bool) {\n bool debtExists = !self.isEmpty();\n return debtExists && asset.amount > 0;\n }\n}\n"
},
"contracts/liquidityManagement/liquidityPool/libraries/MerkleTreeRepository.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {MerkleProofLib} from \"solady/src/utils/MerkleProofLib.sol\";\n\nlibrary MerkleTreeRepository {\n bytes32 internal constant DISABLE_VERIFICATION = bytes32(type(uint256).max);\n bytes32 private constant ROOT_SLOT = keccak256(\"MerkleTreeRepository root slot V1\");\n\n function setRoot(bytes32 _newRoot) internal {\n bytes32 slot = ROOT_SLOT;\n assembly {\n sstore(slot, _newRoot)\n }\n }\n\n function getRoot() internal view returns (bytes32 root) {\n bytes32 slot = ROOT_SLOT;\n assembly {\n root := sload(slot)\n }\n }\n\n function verify(\n bytes32[] calldata _proof,\n address _leaf,\n bytes32 _root\n ) internal pure returns (bool) {\n if (_root == DISABLE_VERIFICATION) return true;\n else return MerkleProofLib.verifyCalldata(_proof, _root, computeLeaf(_leaf));\n }\n\n function computeLeaf(address _leaf) private pure returns (bytes32) {\n return keccak256(abi.encode(_leaf));\n }\n}\n"
},
"contracts/liquidityManagement/liquidityPool/libraries/QueueLibrary.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {PoolDebt} from \"contracts/interfaces/liquidityManagement/liquidityPool/Debt.sol\";\nimport {\n Queue,\n QueueIsEmpty\n} from \"contracts/interfaces/liquidityManagement/liquidityPool/Queue.sol\";\n\nlibrary QueueLibrary {\n function enqueue(Queue storage self, PoolDebt memory element) internal {\n self.elements.push(element);\n }\n\n function dequeue(Queue storage self) internal returns (PoolDebt storage result) {\n if (isEmpty(self)) revert QueueIsEmpty();\n result = self.elements[self.head++];\n }\n\n function peek(Queue storage self) internal view returns (PoolDebt storage) {\n return self.elements[self.head];\n }\n\n function getLength(Queue storage self) internal view returns (uint256) {\n return self.elements.length - self.head;\n }\n\n function isEmpty(Queue storage self) internal view returns (bool) {\n return getLength(self) == 0;\n }\n}\n"
},
"contracts/liquidityManagement/liquidityPool/libraries/staking/PositionManager.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {Staking} from \"contracts/interfaces/liquidityManagement/liquidityPool/Staking.sol\";\n\nlibrary PositionManager {\n function increasePosition(Staking storage self, address user, uint128 amount) internal {\n self.updateUserRewards(user);\n self.users[user].balance += amount;\n self.totalDeposited += amount;\n }\n\n function decreasePosition(Staking storage self, address user, uint128 amount) internal {\n self.updateUserRewards(user);\n self.users[user].balance -= amount;\n self.totalDeposited -= amount;\n }\n}\n"
},
"contracts/liquidityManagement/liquidityPool/libraries/staking/RewardsMath.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.22;\n\nimport {\n CannotStartNewEpochWithSameTPSS,\n DENOMINATOR,\n IncompleteEpoch,\n InterestInsufficient,\n InterestMustBeGreaterThanZero,\n Staking,\n TokenVolumeIsZero\n} from \"contracts/interfaces/liquidityManagement/liquidityPool/Staking.sol\";\n\n/* solhint-disable not-rely-on-time, ordering */\nlibrary RewardsMath {\n using {\n updateUserRewards,\n updateUserVolume,\n updateEpochVolume,\n calculateVolumeSinceLastUpdate,\n isEpochPassedSinceUserDeposited,\n startNewEpoch\n } for Staking;\n\n /*//////////////////////////////////////////////////////////////\n INTERNAL INTERFACE\n //////////////////////////////////////////////////////////////*/\n\n function updateUserRewards(Staking storage self, address user) internal {\n self.updateEpochVolume();\n self.updateUserVolume(user);\n\n if (self.isEpochPassedSinceUserDeposited(user)) {\n uint128 newReward = calculateNewUserRewards(self, user);\n\n self.users[user].accumulatedRewards += newReward;\n\n if (newReward > 0) setUserUFEStartingFromTheStartOfTheCurrentEpoch(self, user);\n }\n\n self.users[user].depositEpoch.TPSS = self.TPSS;\n }\n\n function increaseInterest(Staking storage self, uint256 amount) internal {\n if (amount == 0) revert InterestMustBeGreaterThanZero();\n\n self.updateEpochVolume();\n if (self.tokenVolume == 0) revert TokenVolumeIsZero();\n\n uint256 passingEpochTPSS = self.TPSS;\n uint240 incrementTPSS = uint240((amount * DENOMINATOR) / (self.tokenVolume));\n if (incrementTPSS == 0) revert InterestInsufficient();\n self.TPSS += incrementTPSS;\n self.startNewEpoch(passingEpochTPSS);\n }\n\n function claimRewards(Staking storage self, address user) internal returns (uint256 rewards_) {\n self.updateUserRewards(user);\n rewards_ = self.users[user].accumulatedRewards;\n\n self.users[user].accumulatedRewards = 0;\n }\n\n function getUserRewards(\n Staking storage self,\n address user\n ) internal view returns (uint256 rewards_) {\n rewards_ = self.users[user].accumulatedRewards;\n\n if (self.isEpochPassedSinceUserDeposited(user)) {\n rewards_ += calculateNewUserRewards(self, user);\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n PRIVATE METHODS\n //////////////////////////////////////////////////////////////*/\n\n function calculateNewUserRewards(\n Staking storage self,\n address user\n ) private view returns (uint128 newReward) {\n uint256 rewardForTheIncompleteEpoch = calculateUserRewardsForIncompleteFirstEpoch(\n self,\n user\n );\n\n uint256 rewardForTheRemainingEpochs = calculateUserRewardsForTheWholeNumberOfEpochs(\n self,\n user\n );\n\n newReward = uint128(\n (rewardForTheIncompleteEpoch + rewardForTheRemainingEpochs) / DENOMINATOR\n );\n }\n\n function isEpochPassedSinceUserDeposited(\n Staking storage self,\n address user\n ) private view returns (bool) {\n IncompleteEpoch storage depositEpoch = self.users[user].depositEpoch;\n\n uint256 nextTPSSFromUserDepositEpoch = self.linkedListTPSS[depositEpoch.TPSS];\n return nextTPSSFromUserDepositEpoch > 0;\n }\n\n function calculateUserRewardsForIncompleteFirstEpoch(\n Staking storage self,\n address user\n ) private view returns (uint256 _reward) {\n IncompleteEpoch storage depositEpoch = self.users[user].depositEpoch;\n\n uint256 nextEpochTPSS = self.linkedListTPSS[depositEpoch.TPSS];\n uint256 userFirstEpochTPSS = nextEpochTPSS - depositEpoch.TPSS;\n\n uint192 userVolume;\n if (depositEpoch.timeWhenUserVolumeWasLastUpdated != block.timestamp) {\n (userVolume, ) = calculateNewUserVolume(self, depositEpoch, user);\n }\n\n _reward = (depositEpoch.volume + userVolume) * userFirstEpochTPSS;\n }\n\n function calculateUserRewardsForTheWholeNumberOfEpochs(\n Staking storage self,\n address user\n ) private view returns (uint256 reward_) {\n IncompleteEpoch storage depositEpoch = self.users[user].depositEpoch;\n bool isUserStakedAtLeastOneWholeEpoch = self.numberOfEpochs > depositEpoch.epochNum + 1;\n\n if (isUserStakedAtLeastOneWholeEpoch) {\n uint256 lastDistributionTPS = self.TPSS2TPS[self.TPSS];\n // First whole epoch of the user begins at the distribution\n // for the epoch when he updated his position last time.\n uint256 userFirstWholeEpochTPS = self.TPSS2TPS[self.linkedListTPSS[depositEpoch.TPSS]];\n uint256 tps = lastDistributionTPS - userFirstWholeEpochTPS;\n // \"Token Per Stake\" means how many rewards is accrued by the 1 unit of position.\n reward_ = tps * self.users[user].balance;\n }\n }\n\n function startNewEpoch(Staking storage self, uint256 passingEpochTPSS) private {\n if (passingEpochTPSS == self.TPSS) revert CannotStartNewEpochWithSameTPSS();\n\n self.linkedListTPSS[passingEpochTPSS] = self.TPSS;\n\n uint256 passingEpochDuration = block.timestamp - self.epochStartTime[passingEpochTPSS];\n uint256 accruedTPS = (self.TPSS - passingEpochTPSS) * passingEpochDuration;\n self.TPSS2TPS[self.TPSS] = self.TPSS2TPS[passingEpochTPSS] + accruedTPS;\n\n self.tokenVolume = 0;\n self.epochStartTime[self.TPSS] = block.timestamp;\n self.numberOfEpochs++;\n }\n\n function updateEpochVolume(Staking storage self) private {\n self.tokenVolume += calculateVolumeSinceLastUpdate(self);\n self.timeWhenVolumeWasLastUpdated = uint64(block.timestamp);\n }\n\n function calculateVolumeSinceLastUpdate(\n Staking storage self\n ) private view returns (uint192 newEpochVolume) {\n if (self.timeWhenVolumeWasLastUpdated > 0) {\n uint256 timePassedFromLastUpdate = block.timestamp - self.timeWhenVolumeWasLastUpdated;\n newEpochVolume = uint192(self.totalDeposited * timePassedFromLastUpdate);\n }\n }\n\n function updateUserVolume(Staking storage self, address user) private {\n IncompleteEpoch storage depositEpoch = self.users[user].depositEpoch;\n\n (uint192 userVolume, uint64 userVolumeUpdateTime) = calculateNewUserVolume(\n self,\n depositEpoch,\n user\n );\n\n depositEpoch.volume += userVolume;\n depositEpoch.timeWhenUserVolumeWasLastUpdated = userVolumeUpdateTime;\n\n if (needToInitializeUserUFE(self, user)) {\n initializeUserUFE(self, user);\n }\n }\n\n function calculateNewUserVolume(\n Staking storage self,\n IncompleteEpoch storage depositEpoch,\n address user\n ) private view returns (uint192 userVolume, uint64 userVolumeUpdateTime) {\n uint256 timeWhenUserVolumeWasLastUpdated = depositEpoch.timeWhenUserVolumeWasLastUpdated;\n uint256 lastBalance = self.users[user].balance;\n\n // if epoch when user have changed his deposit == current epoch\n if (self.numberOfEpochs == depositEpoch.epochNum && timeWhenUserVolumeWasLastUpdated > 0) {\n userVolume = uint192(\n lastBalance * (block.timestamp - timeWhenUserVolumeWasLastUpdated)\n );\n userVolumeUpdateTime = uint64(block.timestamp);\n\n // if epoch when user have changed his deposit < current epoch\n } else {\n uint256 nextTPSSFromUserDepositEpoch = self.linkedListTPSS[depositEpoch.TPSS];\n uint256 epochEndTime = self.epochStartTime[nextTPSSFromUserDepositEpoch];\n\n if (timeWhenUserVolumeWasLastUpdated < epochEndTime && lastBalance > 0) {\n userVolume = uint192(\n lastBalance * (epochEndTime - timeWhenUserVolumeWasLastUpdated)\n );\n userVolumeUpdateTime = uint64(epochEndTime);\n }\n }\n }\n\n function needToInitializeUserUFE(\n Staking storage self,\n address user\n ) private view returns (bool) {\n IncompleteEpoch storage depositEpoch = self.users[user].depositEpoch;\n\n // next boundary TPSS for epoch when user deposited last time\n uint256 ufeEndTPSS = self.linkedListTPSS[depositEpoch.TPSS];\n uint256 ufeEndTime = self.epochStartTime[ufeEndTPSS];\n\n uint256 timeWhenUserVolumeWasLastUpdated = depositEpoch.timeWhenUserVolumeWasLastUpdated;\n // when we calculate rewards for UFE we set timeWhenUserVolumeWasLastUpdated to UFE end time\n bool userGotAllRewards = timeWhenUserVolumeWasLastUpdated == ufeEndTime;\n\n return\n (self.users[user].balance == 0 && userGotAllRewards) ||\n timeWhenUserVolumeWasLastUpdated == 0;\n }\n\n function initializeUserUFE(Staking storage self, address user) private {\n IncompleteEpoch storage depositEpoch = self.users[user].depositEpoch;\n\n depositEpoch.timeWhenUserVolumeWasLastUpdated = uint64(block.timestamp);\n depositEpoch.epochNum = self.numberOfEpochs;\n depositEpoch.volume = 0;\n }\n\n function setUserUFEStartingFromTheStartOfTheCurrentEpoch(\n Staking storage self,\n address user\n ) private {\n IncompleteEpoch storage depositEpoch = self.users[user].depositEpoch;\n\n uint256 thisEpochStartTime = self.epochStartTime[self.TPSS];\n depositEpoch.volume = uint192(\n self.users[user].balance * (block.timestamp - thisEpochStartTime)\n );\n depositEpoch.timeWhenUserVolumeWasLastUpdated = uint64(block.timestamp);\n depositEpoch.epochNum = self.numberOfEpochs;\n }\n}\n/* solhint-enable not-rely-on-time, ordering */\n"
},
"contracts/liquidityManagement/liquidityPool/pool/Pool.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport {AddressMustNotBeZero, AlreadyUpToDate} from \"contracts/interfaces/base/CommonErrors.sol\";\nimport {\n IMerkleTreeWhitelist\n} from \"contracts/interfaces/liquidityManagement/liquidityPool/IMerkleTreeWhitelist.sol\";\nimport {IPool} from \"contracts/interfaces/liquidityManagement/liquidityPool/IPool.sol\";\nimport {\n IPoolInitializer\n} from \"contracts/interfaces/liquidityManagement/liquidityPool/IPoolInitializer.sol\";\nimport {Staking} from \"contracts/interfaces/liquidityManagement/liquidityPool/Staking.sol\";\n\nimport {Suspendable} from \"../base/Suspendable.sol\";\nimport {DebtManager, Queue} from \"../libraries/DebtManager.sol\";\nimport {MerkleTreeRepository} from \"../libraries/MerkleTreeRepository.sol\";\n\n/**\n * @title Pool\n * @notice Blink liquidity pool.\n */\ncontract Pool is IPool, IPoolInitializer, Suspendable {\n using DebtManager for Queue;\n using SafeERC20 for IERC20;\n using MerkleTreeRepository for bytes32[];\n\n bytes32 public constant BORROWER_ROLE = keccak256(\"BORROWER_ROLE\");\n bytes32 public constant REPAYER_ROLE = keccak256(\"REPAYER_ROLE\");\n\n Staking private staking;\n Queue private debts;\n uint256 public thresholdOnTotalDeposit;\n address public token;\n IMerkleTreeWhitelist internal depositWhitelist;\n\n error ThresholdOnTotalDepositMustNotBeZero();\n\n function initialize(\n address borrower,\n address token_,\n uint256 thresholdOnTotalDeposit_\n ) external override initializer {\n if (borrower == address(0) || token_ == address(0)) revert AddressMustNotBeZero();\n if (thresholdOnTotalDeposit_ == 0) revert ThresholdOnTotalDepositMustNotBeZero();\n __Suspendable_init();\n _grantRole(DEFAULT_ADMIN_ROLE, tx.origin);\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n _grantRole(PAUSER_ROLE, msg.sender);\n _grantRole(BORROWER_ROLE, borrower);\n\n thresholdOnTotalDeposit = thresholdOnTotalDeposit_;\n token = token_;\n depositWhitelist = IMerkleTreeWhitelist(msg.sender);\n }\n\n function setFund(address fund) external override onlyRole(DEFAULT_ADMIN_ROLE) {\n if (!_grantRole(REPAYER_ROLE, fund)) {\n revert AlreadyUpToDate();\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n DEPOSIT/WITHDRAWAL/CLAIM LOGIC\n //////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IPool\n function deposit(\n uint128 amount,\n bytes32[] calldata permission\n ) external override whenNotPaused {\n if (!permission.verify(msg.sender, depositWhitelist.getRoot())) {\n revert MerkleTreeVerificationFailed();\n }\n if (amount + staking.totalDeposited > thresholdOnTotalDeposit) {\n revert TotalDepositThresholdExceeded();\n }\n\n staking.increasePosition(msg.sender, amount);\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n\n emit Deposited(msg.sender, amount);\n }\n\n /// @inheritdoc IPool\n function withdraw(uint128 amount, address to) external override {\n if (to == address(0)) {\n to = msg.sender;\n }\n if (amount > staking.users[msg.sender].balance) {\n revert WithdrawAmountExceedsBalance();\n }\n\n staking.decreasePosition(msg.sender, amount);\n uint256 amountToTransfer = _createDebtIfNecessary(amount + _claim(msg.sender));\n if (amountToTransfer != 0) {\n IERC20(token).safeTransfer(to, amountToTransfer);\n }\n\n emit Withdrawn(to, amount);\n }\n\n /// @inheritdoc IPool\n function claim(address to) external override {\n if (to == address(0)) {\n to = msg.sender;\n }\n\n uint256 amountToClaim = _claim(msg.sender);\n amountToClaim = _createDebtIfNecessary(amountToClaim);\n\n if (amountToClaim != 0) {\n IERC20(token).safeTransfer(to, amountToClaim);\n } else {\n revert NoPendingRewards();\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n ONLY BORROWER FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IPool\n function borrow(uint256 amount) external override onlyRole(BORROWER_ROLE) {\n if (amount > IERC20(token).balanceOf(address(this))) {\n revert BorrowAmountExceedsBalance();\n }\n IERC20(token).safeTransfer(msg.sender, amount);\n emit Borrowed(amount);\n }\n\n /*//////////////////////////////////////////////////////////////\n ONLY REPAYER FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IPool\n function returnAndDistribute(\n uint256 amount,\n uint256 rewards\n ) external override onlyRole(REPAYER_ROLE) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount + rewards);\n debts.tryRepay(address(token), amount);\n staking.increaseInterest(rewards);\n emit Returned(amount, rewards);\n }\n\n /*//////////////////////////////////////////////////////////////\n VIEW FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n /// @inheritdoc IPool\n function totalDeposited() external view override returns (uint256) {\n return staking.totalDeposited;\n }\n\n /// @inheritdoc IPool\n function getPendingRewards(address user) external view override returns (uint256) {\n return staking.getUserRewards(user);\n }\n\n /// @inheritdoc IPool\n function getPositionInfo(address liquidityProvider) external view override returns (uint256) {\n return staking.users[liquidityProvider].balance;\n }\n\n /*//////////////////////////////////////////////////////////////\n PRIVATE FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function _createDebtIfNecessary(\n uint256 amountToWithdraw\n ) private returns (uint256 amountToTransfer) {\n uint256 _totalBalance = IERC20(token).balanceOf(address(this));\n if (_totalBalance < amountToWithdraw) {\n debts.create(amountToWithdraw - _totalBalance, msg.sender);\n amountToTransfer = _totalBalance;\n } else {\n amountToTransfer = amountToWithdraw;\n }\n }\n\n function _claim(address user) private returns (uint256 claimed) {\n claimed = staking.claimRewards(user);\n if (claimed > 0) {\n emit Claimed(user, claimed);\n }\n }\n}\n"
},
"solady/src/utils/MerkleProofLib.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)\nlibrary MerkleProofLib {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MERKLE PROOF VERIFICATION OPERATIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.\n function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf)\n internal\n pure\n returns (bool isValid)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if mload(proof) {\n // Initialize `offset` to the offset of `proof` elements in memory.\n let offset := add(proof, 0x20)\n // Left shift by 5 is equivalent to multiplying by 0x20.\n let end := add(offset, shl(5, mload(proof)))\n // Iterate over proof elements to compute root hash.\n for {} 1 {} {\n // Slot of `leaf` in scratch space.\n // If the condition is true: 0x20, otherwise: 0x00.\n let scratch := shl(5, gt(leaf, mload(offset)))\n // Store elements to hash contiguously in scratch space.\n // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.\n mstore(scratch, leaf)\n mstore(xor(scratch, 0x20), mload(offset))\n // Reuse `leaf` to store the hash to reduce stack operations.\n leaf := keccak256(0x00, 0x40)\n offset := add(offset, 0x20)\n if iszero(lt(offset, end)) { break }\n }\n }\n isValid := eq(leaf, root)\n }\n }\n\n /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.\n function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf)\n internal\n pure\n returns (bool isValid)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if proof.length {\n // Left shift by 5 is equivalent to multiplying by 0x20.\n let end := add(proof.offset, shl(5, proof.length))\n // Initialize `offset` to the offset of `proof` in the calldata.\n let offset := proof.offset\n // Iterate over proof elements to compute root hash.\n for {} 1 {} {\n // Slot of `leaf` in scratch space.\n // If the condition is true: 0x20, otherwise: 0x00.\n let scratch := shl(5, gt(leaf, calldataload(offset)))\n // Store elements to hash contiguously in scratch space.\n // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.\n mstore(scratch, leaf)\n mstore(xor(scratch, 0x20), calldataload(offset))\n // Reuse `leaf` to store the hash to reduce stack operations.\n leaf := keccak256(0x00, 0x40)\n offset := add(offset, 0x20)\n if iszero(lt(offset, end)) { break }\n }\n }\n isValid := eq(leaf, root)\n }\n }\n\n /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,\n /// given `proof` and `flags`.\n function verifyMultiProof(\n bytes32[] memory proof,\n bytes32 root,\n bytes32[] memory leaves,\n bool[] memory flags\n ) internal pure returns (bool isValid) {\n // Rebuilds the root by consuming and producing values on a queue.\n // The queue starts with the `leaves` array, and goes into a `hashes` array.\n // After the process, the last element on the queue is verified\n // to be equal to the `root`.\n //\n // The `flags` array denotes whether the sibling\n // should be popped from the queue (`flag == true`), or\n // should be popped from the `proof` (`flag == false`).\n /// @solidity memory-safe-assembly\n assembly {\n // Cache the lengths of the arrays.\n let leavesLength := mload(leaves)\n let proofLength := mload(proof)\n let flagsLength := mload(flags)\n\n // Advance the pointers of the arrays to point to the data.\n leaves := add(0x20, leaves)\n proof := add(0x20, proof)\n flags := add(0x20, flags)\n\n // If the number of flags is correct.\n for {} eq(add(leavesLength, proofLength), add(flagsLength, 1)) {} {\n // For the case where `proof.length + leaves.length == 1`.\n if iszero(flagsLength) {\n // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.\n isValid := eq(mload(xor(leaves, mul(xor(proof, leaves), proofLength))), root)\n break\n }\n\n // The required final proof offset if `flagsLength` is not zero, otherwise zero.\n let proofEnd := mul(iszero(iszero(flagsLength)), add(proof, shl(5, proofLength)))\n // We can use the free memory space for the queue.\n // We don't need to allocate, since the queue is temporary.\n let hashesFront := mload(0x40)\n // Copy the leaves into the hashes.\n // Sometimes, a little memory expansion costs less than branching.\n // Should cost less, even with a high free memory offset of 0x7d00.\n leavesLength := shl(5, leavesLength)\n for { let i := 0 } iszero(eq(i, leavesLength)) { i := add(i, 0x20) } {\n mstore(add(hashesFront, i), mload(add(leaves, i)))\n }\n // Compute the back of the hashes.\n let hashesBack := add(hashesFront, leavesLength)\n // This is the end of the memory for the queue.\n // We recycle `flagsLength` to save on stack variables (sometimes save gas).\n flagsLength := add(hashesBack, shl(5, flagsLength))\n\n for {} 1 {} {\n // Pop from `hashes`.\n let a := mload(hashesFront)\n // Pop from `hashes`.\n let b := mload(add(hashesFront, 0x20))\n hashesFront := add(hashesFront, 0x40)\n\n // If the flag is false, load the next proof,\n // else, pops from the queue.\n if iszero(mload(flags)) {\n // Loads the next proof.\n b := mload(proof)\n proof := add(proof, 0x20)\n // Unpop from `hashes`.\n hashesFront := sub(hashesFront, 0x20)\n }\n\n // Advance to the next flag.\n flags := add(flags, 0x20)\n\n // Slot of `a` in scratch space.\n // If the condition is true: 0x20, otherwise: 0x00.\n let scratch := shl(5, gt(a, b))\n // Hash the scratch space and push the result onto the queue.\n mstore(scratch, a)\n mstore(xor(scratch, 0x20), b)\n mstore(hashesBack, keccak256(0x00, 0x40))\n hashesBack := add(hashesBack, 0x20)\n if iszero(lt(hashesBack, flagsLength)) { break }\n }\n isValid :=\n and(\n // Checks if the last value in the queue is same as the root.\n eq(mload(sub(hashesBack, 0x20)), root),\n // And whether all the proofs are used, if required (i.e. `proofEnd != 0`).\n or(iszero(proofEnd), eq(proofEnd, proof))\n )\n break\n }\n }\n }\n\n /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,\n /// given `proof` and `flags`.\n function verifyMultiProofCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32[] calldata leaves,\n bool[] calldata flags\n ) internal pure returns (bool isValid) {\n // Rebuilds the root by consuming and producing values on a queue.\n // The queue starts with the `leaves` array, and goes into a `hashes` array.\n // After the process, the last element on the queue is verified\n // to be equal to the `root`.\n //\n // The `flags` array denotes whether the sibling\n // should be popped from the queue (`flag == true`), or\n // should be popped from the `proof` (`flag == false`).\n /// @solidity memory-safe-assembly\n assembly {\n // If the number of flags is correct.\n for {} eq(add(leaves.length, proof.length), add(flags.length, 1)) {} {\n // For the case where `proof.length + leaves.length == 1`.\n if iszero(flags.length) {\n // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.\n // forgefmt: disable-next-item\n isValid := eq(\n calldataload(\n xor(leaves.offset, mul(xor(proof.offset, leaves.offset), proof.length))\n ),\n root\n )\n break\n }\n\n // The required final proof offset if `flagsLength` is not zero, otherwise zero.\n let proofEnd :=\n mul(iszero(iszero(flags.length)), add(proof.offset, shl(5, proof.length)))\n // We can use the free memory space for the queue.\n // We don't need to allocate, since the queue is temporary.\n let hashesFront := mload(0x40)\n // Copy the leaves into the hashes.\n // Sometimes, a little memory expansion costs less than branching.\n // Should cost less, even with a high free memory offset of 0x7d00.\n calldatacopy(hashesFront, leaves.offset, shl(5, leaves.length))\n // Compute the back of the hashes.\n let hashesBack := add(hashesFront, shl(5, leaves.length))\n // This is the end of the memory for the queue.\n // We recycle `flagsLength` to save on stack variables (sometimes save gas).\n flags.length := add(hashesBack, shl(5, flags.length))\n\n // We don't need to make a copy of `proof.offset` or `flags.offset`,\n // as they are pass-by-value (this trick may not always save gas).\n\n for {} 1 {} {\n // Pop from `hashes`.\n let a := mload(hashesFront)\n // Pop from `hashes`.\n let b := mload(add(hashesFront, 0x20))\n hashesFront := add(hashesFront, 0x40)\n\n // If the flag is false, load the next proof,\n // else, pops from the queue.\n if iszero(calldataload(flags.offset)) {\n // Loads the next proof.\n b := calldataload(proof.offset)\n proof.offset := add(proof.offset, 0x20)\n // Unpop from `hashes`.\n hashesFront := sub(hashesFront, 0x20)\n }\n\n // Advance to the next flag offset.\n flags.offset := add(flags.offset, 0x20)\n\n // Slot of `a` in scratch space.\n // If the condition is true: 0x20, otherwise: 0x00.\n let scratch := shl(5, gt(a, b))\n // Hash the scratch space and push the result onto the queue.\n mstore(scratch, a)\n mstore(xor(scratch, 0x20), b)\n mstore(hashesBack, keccak256(0x00, 0x40))\n hashesBack := add(hashesBack, 0x20)\n if iszero(lt(hashesBack, flags.length)) { break }\n }\n isValid :=\n and(\n // Checks if the last value in the queue is same as the root.\n eq(mload(sub(hashesBack, 0x20)), root),\n // And whether all the proofs are used, if required (i.e. `proofEnd != 0`).\n or(iszero(proofEnd), eq(proofEnd, proof.offset))\n )\n break\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EMPTY CALLDATA HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns an empty calldata bytes32 array.\n function emptyProof() internal pure returns (bytes32[] calldata proof) {\n /// @solidity memory-safe-assembly\n assembly {\n proof.length := 0\n }\n }\n\n /// @dev Returns an empty calldata bytes32 array.\n function emptyLeaves() internal pure returns (bytes32[] calldata leaves) {\n /// @solidity memory-safe-assembly\n assembly {\n leaves.length := 0\n }\n }\n\n /// @dev Returns an empty calldata bool array.\n function emptyFlags() internal pure returns (bool[] calldata flags) {\n /// @solidity memory-safe-assembly\n assembly {\n flags.length := 0\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": {}
}
}}
|
1 | 20,290,280 |
6129ecaafec1d7f05e12e751e6c9f5909a095f8b9272198f42fde8661b9fe49b
|
cd69b6c2635954b9a2680ca07e122c81fd5e81eb5bb3854090476e6dba2cb981
|
a9a0b8a5e1adca0caccc63a168f053cd3be30808
|
01cd62ed13d0b666e2a10d13879a763dfd1dab99
|
51d47c67b3a9777346bd2af0bd3eac2d7ecc3c8d
|
3d602d80600a3d3981f3363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
| |
1 | 20,290,282 |
3c560b05dc3f67d68eb406e87219f2b9b89a1638c6bd76b5e7d9c684c6fb3181
|
6fd84a5e5c14b5ca109994c7ecde07f50f459dfc64f013a07906826533b0f5b4
|
00bdb5699745f5b860228c8f939abf1b9ae374ed
|
ffa397285ce46fb78c588a9e993286aac68c37cd
|
9fd092c0c50b1d260282ed032c3f1b542f0b0796
|
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
|
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
|
pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
}
|
1 | 20,290,284 |
ac52e2195ef15159e634a18f4eb58bdbef48c9d97f8d039a997c9f7c1ef47d35
|
bf663e01c2d2cba88590079f9db4393f8dbd76991ee5ca0f4285c61e9600f7b4
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
696bc652e8133e2b7ce96d5d797ba7f450e47a25
|
6101006040523480156200001257600080fd5b50604051620025f6380380620025f6833981016040819052620000359162000090565b6001600160a01b03928316608081905260a052805160209091012060c0521660e0526200018a565b80516001600160a01b03811681146200007557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620000a657600080fd5b620000b1846200005d565b92506020620000c28186016200005d565b60408601519093506001600160401b0380821115620000e057600080fd5b818701915087601f830112620000f557600080fd5b8151818111156200010a576200010a6200007a565b604051601f8201601f19908116603f011681019083821181831017156200013557620001356200007a565b816040528281528a868487010111156200014e57600080fd5b600093505b8284101562000172578484018601518185018701529285019262000153565b60008684830101528096505050505050509250925092565b60805160a05160c05160e05161240f620001e7600039600081816107de01526109860152600081816106970152818161086001526108ff01526000818161083f01526108de015260008181610ed10152610fe5015261240f6000f3fe6080604052600436106100d65760003560e01c8063437feabf1161007f578063aa8ba05211610059578063aa8ba05214610247578063d1405f6214610267578063d547741f14610287578063e72aecf2146102a757600080fd5b8063437feabf146101ff57806391d1485414610212578063a217fddf1461023257600080fd5b8063248a9ca3116100b0578063248a9ca31461018d5780632f2ff15d146101bd57806336568abe146101df57600080fd5b806301ffc9a7146100e25780631193392a14610117578063221dc7f61461015957600080fd5b366100dd57005b600080fd5b3480156100ee57600080fd5b506101026100fd36600461139b565b6102df565b60405190151581526020015b60405180910390f35b34801561012357600080fd5b5061014b7f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a288995881565b60405190815260200161010e565b34801561016557600080fd5b5061014b7fbd8ac73f269c346bf68f1611e0d9aa37a79f6ef8d0abeb300124c346efb0a29581565b34801561019957600080fd5b5061014b6101a83660046113dd565b60009081526020819052604090206001015490565b3480156101c957600080fd5b506101dd6101d8366004611418565b610378565b005b3480156101eb57600080fd5b506101dd6101fa366004611418565b6103a3565b6101dd61020d366004611460565b610401565b34801561021e57600080fd5b5061010261022d366004611418565b6105e5565b34801561023e57600080fd5b5061014b600081565b34801561025357600080fd5b50610102610262366004611496565b610666565b34801561027357600080fd5b506101dd6102823660046114e6565b6108a4565b34801561029357600080fd5b506101dd6102a2366004611418565b610952565b6102ba6102b536600461155b565b610977565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010e565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061037257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008281526020819052604090206001015461039381610ae6565b61039d8383610af3565b50505050565b73ffffffffffffffffffffffffffffffffffffffff811633146103f2576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6103fc8282610bca565b505050565b7fbd8ac73f269c346bf68f1611e0d9aa37a79f6ef8d0abeb300124c346efb0a29561042b81610ae6565b600083905060008173ffffffffffffffffffffffffffffffffffffffff16632c86d98e6040518163ffffffff1660e01b81526004016040805180830381865afa15801561047c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a091906115e0565b50905060006104b2602086018661160e565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461053e576040517fa44789e000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044015b60405180910390fd5b6105488587610c60565b6040517f354030230000000000000000000000000000000000000000000000000000000081526020860135600482015273ffffffffffffffffffffffffffffffffffffffff8416906335403023906024016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc919061162b565b50505050505050565b60008215801561062757508173ffffffffffffffffffffffffffffffffffffffff1661060f610d50565b73ffffffffffffffffffffffffffffffffffffffff16145b8061065f575060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b9392505050565b60007f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a288995861069281610ae6565b6106c67f00000000000000000000000000000000000000000000000000000000000000006106c0858061164d565b90610d7f565b6106fc576040517f804da95600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff8116633db0a3e4610723868061164d565b61073190602081019061168b565b6040518363ffffffff1660e01b815260040161074e929190611d92565b6020604051808303816000875af115801561076d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610791919061162b565b9250821561089c576040517f67651fd300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301527f000000000000000000000000000000000000000000000000000000000000000016906367651fd390602401600060405180830381600087803b15801561082257600080fd5b505af1158015610836573d6000803e3d6000fd5b505050506108987f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086806020019061088f919061168b565b90929091610db9565b1592505b505092915050565b7f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a28899586108ce81610ae6565b60005b8281101561039d576109497f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086868581811061093057610930611e12565b9050602002810190610942919061164d565b9190610e23565b506001016108d1565b60008281526020819052604090206001015461096d81610ae6565b61039d8383610bca565b6000610984848484610eba565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16634ba745ff6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a159190611e41565b905060005b83811015610a5457610a4c82868684818110610a3857610a38611e12565b905060400201610c6090919063ffffffff16565b600101610a1a565b506040517f90631d8e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216906390631d8e90610aad903390889088908890600401611e5e565b600060405180830381600087803b158015610ac757600080fd5b505af1158015610adb573d6000803e3d6000fd5b505050509392505050565b610af08133611088565b50565b6000610aff83836105e5565b610bc25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b603390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610372565b506000610372565b6000610bd683836105e5565b15610bc25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610372565b8160200135600003610cc457610c79602083018361160e565b6040517f3b9b86ec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401610535565b610cef610cd4602084018461160e565b73ffffffffffffffffffffffffffffffffffffffff166110e7565b15610d1c57610d1873ffffffffffffffffffffffffffffffffffffffff82166020840135611137565b5050565b610d18338260208501803590610d32908761160e565b73ffffffffffffffffffffffffffffffffffffffff16929190611153565b6000610d7a7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c13205490565b905090565b600081610d8c848061164d565b610d9a906020810190611ec5565b604051610da8929190611f2a565b604051809103902014905092915050565b6000805b84811015610e1a57610df58484888885818110610ddc57610ddc611e12565b9050602002810190610dee919061164d565b91906111b0565b610e00576001610e03565b60005b610e109060ff1683611f69565b9150600101610dbd565b50949350505050565b6000610e33826106c0868061164d565b15610e88576000610e498484610dee888061164d565b90508015610e7457610e63848461088f602089018961168b565b610e6d9083611f69565b9150610e82565b81610e7e81611f7c565b9250505b5061065f565b6040517f804da95600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663fbc51461610f03602084018461160e565b60036040518363ffffffff1660e01b8152600401610f22929190611fb4565b60006040518083038186803b158015610f3a57600080fd5b505afa158015610f4e573d6000803e3d6000fd5b505050508060200135600003610f6b57610c79602082018261160e565b6000829003610fa6576040517fe1d362ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8281101561039d5736848483818110610fc457610fc4611e12565b6040029190910191505073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663fbc51461611017602084018461160e565b60026040518363ffffffff1660e01b8152600401611036929190611fb4565b60006040518083038186803b15801561104e57600080fd5b505afa158015611062573d6000803e3d6000fd5b50505050806020013560000361107f57610c79602082018261160e565b50600101610fa9565b61109282826105e5565b610d18576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610535565b600073ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148061037257505073ffffffffffffffffffffffffffffffffffffffff161590565b60008060008084865af1610d185763b12d13eb6000526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c52602060006064601c6000895af13d1560016000511417166111a257637939f4246000526004601cfd5b600060605260405250505050565b6000826111bd8584610d7f565b15610e885760005b6111d2602087018761168b565b905081101561138f57366111e9602088018861168b565b838181106111f9576111f9611e12565b905060200281019061120b9190612015565b905060008373ffffffffffffffffffffffffffffffffffffffff16634763f39d836040518263ffffffff1660e01b81526004016112489190612049565b6000604051808303816000875af1158015611267573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526112ad9190810190612127565b905060005a6040517fd670be0c000000000000000000000000000000000000000000000000000000008152909150734ba21ef812547ea7440f4caef9aaabc406f7ef1d9063d670be0c906113059085906004016122b1565b60006040518083038186803b15801561131d57600080fd5b505af492505050801561132e575060015b6113845761133d60088261239e565b5a1015611376576040517f77ebef4d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009550505050505061065f565b5050506001016111c5565b50506001949350505050565b6000602082840312156113ad57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461065f57600080fd5b6000602082840312156113ef57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610af057600080fd5b6000806040838503121561142b57600080fd5b82359150602083013561143d816113f6565b809150509250929050565b60006040828403121561145a57600080fd5b50919050565b6000806060838503121561147357600080fd5b823561147e816113f6565b915061148d8460208501611448565b90509250929050565b600080604083850312156114a957600080fd5b82356114b4816113f6565b9150602083013567ffffffffffffffff8111156114d057600080fd5b6114dc85828601611448565b9150509250929050565b600080602083850312156114f957600080fd5b823567ffffffffffffffff8082111561151157600080fd5b818501915085601f83011261152557600080fd5b81358181111561153457600080fd5b8660208260051b850101111561154957600080fd5b60209290920196919550909350505050565b60008060006060848603121561157057600080fd5b833567ffffffffffffffff8082111561158857600080fd5b818601915086601f83011261159c57600080fd5b8135818111156115ab57600080fd5b8760208260061b85010111156115c057600080fd5b6020928301955093506115d7918791508601611448565b90509250925092565b600080604083850312156115f357600080fd5b82516115fe816113f6565b6020939093015192949293505050565b60006020828403121561162057600080fd5b813561065f816113f6565b60006020828403121561163d57600080fd5b8151801515811461065f57600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261168157600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126116c057600080fd5b83018035915067ffffffffffffffff8211156116db57600080fd5b6020019150600581901b36038213156116f357600080fd5b9250929050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261172f57600080fd5b830160208101925035905067ffffffffffffffff81111561174f57600080fd5b8060051b36038213156116f357600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261179657600080fd5b830160208101925035905067ffffffffffffffff8111156117b657600080fd5b8036038213156116f357600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261184257600080fd5b90910192915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261184257600080fd5b8035825260006118926020830183611761565b604060208601526118a76040860182846117c5565b95945050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126118e557600080fd5b830160208101925035905067ffffffffffffffff81111561190557600080fd5b8060061b36038213156116f357600080fd5b8035611922816113f6565b73ffffffffffffffffffffffffffffffffffffffff168252602090810135910152565b81835260208301925060008160005b84811015611979576119668683611917565b6040958601959190910190600101611954565b5093949350505050565b60008383855260208086019550808560051b8301018460005b87811015611a66577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08584030189526119d5828861184b565b60406119e18283611761565b8287526119f183880182846117c5565b915050611a008784018461180e565b9250858103878701526060611a15848561184b565b818352611a248284018261187f565b915050611a33888501856118b0565b8383038a850152611a45838284611945565b9585013593909401929092525050509884019892509083019060010161199c565b5090979650505050505050565b60008383855260208086019550808560051b8301018460005b87811015611a66577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0858403018952611ac5828861184b565b6040611ad18283611761565b828752611ae183880182846117c5565b915050611af08784018461180e565b9250858103878701526060611b05848561184b565b818352611b148284018261187f565b9150508784013588830152611b2b838501856118b0565b945082820384840152611b3f828683611945565b9d89019d9750505093860193505050600101611a8c565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6183360301811261184257600080fd5b60008383855260208086019550808560051b8301018460005b87811015611a66577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0858403018952611bdc828861184b565b6040611be88283611761565b828752611bf883880182846117c5565b915050611c0787840184611b56565b92508581038787015260a0611c1c8485611761565b828452611c2c83850182846117c5565b92505050611c3c88850185611761565b8383038a850152611c4e8382846117c5565b8686013595850195909552505050606080840135908201526080928301359291611c77846113f6565b73ffffffffffffffffffffffffffffffffffffffff9390931691015298840198925090830190600101611ba3565b6000611cb182836116fa565b60a085528060a08601527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115611ce857600080fd5b60051b808260c087013784019050611d0360208401846116fa565b60c0868403016020870152611d1c60c084018284611983565b92505050611d2d60408401846116fa565b8583036040870152611d40838284611a73565b92505050611d5160608401846116fa565b8583036060870152611d64838284611b8a565b92505050611d7560808401846116fa565b8583036080870152611d88838284611b8a565b9695505050505050565b60208082528181018390526000906040600585901b8401810190840186845b87811015611e05577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0878503018352611df384611dee848c611b56565b611ca5565b93509184019190840190600101611db1565b5091979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611e5357600080fd5b815161065f816113f6565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201819052810183905260008460a08301825b86811015611eb357611ea08284611917565b6040928301929190910190600101611e8e565b5091506118a790506040830184611917565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611efa57600080fd5b83018035915067ffffffffffffffff821115611f1557600080fd5b6020019150368190038213156116f357600080fd5b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561037257610372611f3a565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611fad57611fad611f3a565b5060010190565b73ffffffffffffffffffffffffffffffffffffffff831681526040810160058310612008577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8260208301529392505050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6183360301811261168157600080fd5b60208152600061065f6020830184611ca5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156120ae576120ae61205c565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156120fb576120fb61205c565b604052919050565b60005b8381101561211e578181015183820152602001612106565b50506000910152565b6000602080838503121561213a57600080fd5b825167ffffffffffffffff8082111561215257600080fd5b818501915085601f83011261216657600080fd5b8151818111156121785761217861205c565b8060051b6121878582016120b4565b91825283810185019185810190898411156121a157600080fd5b86860192505b838310156122a4578251858111156121bf5760008081fd5b860160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d0381018213156121f65760008081fd5b6121fe61208b565b8a84015161220b816113f6565b81526040848101518c83015292840151928984111561222a5760008081fd5b83850194508e603f86011261224157600093508384fd5b8b8501519350898411156122575761225761205c565b6122678c84601f870116016120b4565b92508383528e8185870101111561227e5760008081fd5b61228d848d8501838801612103565b8101919091528452505091860191908601906121a7565b9998505050505050505050565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b83811015612390578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805173ffffffffffffffffffffffffffffffffffffffff16845287810151888501528601516060878501819052815190850181905260809061235281838801858d01612103565b96890196601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016949094019093019250908601906001016122da565b509098975050505050505050565b6000826123d4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea2646970667358221220643ffa3c8cf26ced4623b6be7ae61480d39bfe829ae1ff006cc144a1cfaf5cc364736f6c634300081600330000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a00000000000000000000000059853b694bbcf2c670ae6a75e580b93da38cc8bf00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000008657468657265756d000000000000000000000000000000000000000000000000
|
6080604052600436106100d65760003560e01c8063437feabf1161007f578063aa8ba05211610059578063aa8ba05214610247578063d1405f6214610267578063d547741f14610287578063e72aecf2146102a757600080fd5b8063437feabf146101ff57806391d1485414610212578063a217fddf1461023257600080fd5b8063248a9ca3116100b0578063248a9ca31461018d5780632f2ff15d146101bd57806336568abe146101df57600080fd5b806301ffc9a7146100e25780631193392a14610117578063221dc7f61461015957600080fd5b366100dd57005b600080fd5b3480156100ee57600080fd5b506101026100fd36600461139b565b6102df565b60405190151581526020015b60405180910390f35b34801561012357600080fd5b5061014b7f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a288995881565b60405190815260200161010e565b34801561016557600080fd5b5061014b7fbd8ac73f269c346bf68f1611e0d9aa37a79f6ef8d0abeb300124c346efb0a29581565b34801561019957600080fd5b5061014b6101a83660046113dd565b60009081526020819052604090206001015490565b3480156101c957600080fd5b506101dd6101d8366004611418565b610378565b005b3480156101eb57600080fd5b506101dd6101fa366004611418565b6103a3565b6101dd61020d366004611460565b610401565b34801561021e57600080fd5b5061010261022d366004611418565b6105e5565b34801561023e57600080fd5b5061014b600081565b34801561025357600080fd5b50610102610262366004611496565b610666565b34801561027357600080fd5b506101dd6102823660046114e6565b6108a4565b34801561029357600080fd5b506101dd6102a2366004611418565b610952565b6102ba6102b536600461155b565b610977565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010e565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061037257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008281526020819052604090206001015461039381610ae6565b61039d8383610af3565b50505050565b73ffffffffffffffffffffffffffffffffffffffff811633146103f2576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6103fc8282610bca565b505050565b7fbd8ac73f269c346bf68f1611e0d9aa37a79f6ef8d0abeb300124c346efb0a29561042b81610ae6565b600083905060008173ffffffffffffffffffffffffffffffffffffffff16632c86d98e6040518163ffffffff1660e01b81526004016040805180830381865afa15801561047c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a091906115e0565b50905060006104b2602086018661160e565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461053e576040517fa44789e000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152831660248201526044015b60405180910390fd5b6105488587610c60565b6040517f354030230000000000000000000000000000000000000000000000000000000081526020860135600482015273ffffffffffffffffffffffffffffffffffffffff8416906335403023906024016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc919061162b565b50505050505050565b60008215801561062757508173ffffffffffffffffffffffffffffffffffffffff1661060f610d50565b73ffffffffffffffffffffffffffffffffffffffff16145b8061065f575060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b9392505050565b60007f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a288995861069281610ae6565b6106c67f541111248b45b7a8dc3f5579f630e74cb01456ea6ac067d3f4d793245a2551556106c0858061164d565b90610d7f565b6106fc576040517f804da95600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff8116633db0a3e4610723868061164d565b61073190602081019061168b565b6040518363ffffffff1660e01b815260040161074e929190611d92565b6020604051808303816000875af115801561076d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610791919061162b565b9250821561089c576040517f67651fd300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301527f00000000000000000000000059853b694bbcf2c670ae6a75e580b93da38cc8bf16906367651fd390602401600060405180830381600087803b15801561082257600080fd5b505af1158015610836573d6000803e3d6000fd5b505050506108987f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a7f541111248b45b7a8dc3f5579f630e74cb01456ea6ac067d3f4d793245a25515586806020019061088f919061168b565b90929091610db9565b1592505b505092915050565b7f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a28899586108ce81610ae6565b60005b8281101561039d576109497f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a7f541111248b45b7a8dc3f5579f630e74cb01456ea6ac067d3f4d793245a25515586868581811061093057610930611e12565b9050602002810190610942919061164d565b9190610e23565b506001016108d1565b60008281526020819052604090206001015461096d81610ae6565b61039d8383610bca565b6000610984848484610eba565b7f00000000000000000000000059853b694bbcf2c670ae6a75e580b93da38cc8bf73ffffffffffffffffffffffffffffffffffffffff16634ba745ff6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a159190611e41565b905060005b83811015610a5457610a4c82868684818110610a3857610a38611e12565b905060400201610c6090919063ffffffff16565b600101610a1a565b506040517f90631d8e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216906390631d8e90610aad903390889088908890600401611e5e565b600060405180830381600087803b158015610ac757600080fd5b505af1158015610adb573d6000803e3d6000fd5b505050509392505050565b610af08133611088565b50565b6000610aff83836105e5565b610bc25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b603390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610372565b506000610372565b6000610bd683836105e5565b15610bc25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610372565b8160200135600003610cc457610c79602083018361160e565b6040517f3b9b86ec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401610535565b610cef610cd4602084018461160e565b73ffffffffffffffffffffffffffffffffffffffff166110e7565b15610d1c57610d1873ffffffffffffffffffffffffffffffffffffffff82166020840135611137565b5050565b610d18338260208501803590610d32908761160e565b73ffffffffffffffffffffffffffffffffffffffff16929190611153565b6000610d7a7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c13205490565b905090565b600081610d8c848061164d565b610d9a906020810190611ec5565b604051610da8929190611f2a565b604051809103902014905092915050565b6000805b84811015610e1a57610df58484888885818110610ddc57610ddc611e12565b9050602002810190610dee919061164d565b91906111b0565b610e00576001610e03565b60005b610e109060ff1683611f69565b9150600101610dbd565b50949350505050565b6000610e33826106c0868061164d565b15610e88576000610e498484610dee888061164d565b90508015610e7457610e63848461088f602089018961168b565b610e6d9083611f69565b9150610e82565b81610e7e81611f7c565b9250505b5061065f565b6040517f804da95600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a1663fbc51461610f03602084018461160e565b60036040518363ffffffff1660e01b8152600401610f22929190611fb4565b60006040518083038186803b158015610f3a57600080fd5b505afa158015610f4e573d6000803e3d6000fd5b505050508060200135600003610f6b57610c79602082018261160e565b6000829003610fa6576040517fe1d362ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8281101561039d5736848483818110610fc457610fc4611e12565b6040029190910191505073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002aa72a735165d78ea5568b1b34e5b00fa892797a1663fbc51461611017602084018461160e565b60026040518363ffffffff1660e01b8152600401611036929190611fb4565b60006040518083038186803b15801561104e57600080fd5b505afa158015611062573d6000803e3d6000fd5b50505050806020013560000361107f57610c79602082018261160e565b50600101610fa9565b61109282826105e5565b610d18576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610535565b600073ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148061037257505073ffffffffffffffffffffffffffffffffffffffff161590565b60008060008084865af1610d185763b12d13eb6000526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c52602060006064601c6000895af13d1560016000511417166111a257637939f4246000526004601cfd5b600060605260405250505050565b6000826111bd8584610d7f565b15610e885760005b6111d2602087018761168b565b905081101561138f57366111e9602088018861168b565b838181106111f9576111f9611e12565b905060200281019061120b9190612015565b905060008373ffffffffffffffffffffffffffffffffffffffff16634763f39d836040518263ffffffff1660e01b81526004016112489190612049565b6000604051808303816000875af1158015611267573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526112ad9190810190612127565b905060005a6040517fd670be0c000000000000000000000000000000000000000000000000000000008152909150734ba21ef812547ea7440f4caef9aaabc406f7ef1d9063d670be0c906113059085906004016122b1565b60006040518083038186803b15801561131d57600080fd5b505af492505050801561132e575060015b6113845761133d60088261239e565b5a1015611376576040517f77ebef4d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009550505050505061065f565b5050506001016111c5565b50506001949350505050565b6000602082840312156113ad57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461065f57600080fd5b6000602082840312156113ef57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610af057600080fd5b6000806040838503121561142b57600080fd5b82359150602083013561143d816113f6565b809150509250929050565b60006040828403121561145a57600080fd5b50919050565b6000806060838503121561147357600080fd5b823561147e816113f6565b915061148d8460208501611448565b90509250929050565b600080604083850312156114a957600080fd5b82356114b4816113f6565b9150602083013567ffffffffffffffff8111156114d057600080fd5b6114dc85828601611448565b9150509250929050565b600080602083850312156114f957600080fd5b823567ffffffffffffffff8082111561151157600080fd5b818501915085601f83011261152557600080fd5b81358181111561153457600080fd5b8660208260051b850101111561154957600080fd5b60209290920196919550909350505050565b60008060006060848603121561157057600080fd5b833567ffffffffffffffff8082111561158857600080fd5b818601915086601f83011261159c57600080fd5b8135818111156115ab57600080fd5b8760208260061b85010111156115c057600080fd5b6020928301955093506115d7918791508601611448565b90509250925092565b600080604083850312156115f357600080fd5b82516115fe816113f6565b6020939093015192949293505050565b60006020828403121561162057600080fd5b813561065f816113f6565b60006020828403121561163d57600080fd5b8151801515811461065f57600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261168157600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126116c057600080fd5b83018035915067ffffffffffffffff8211156116db57600080fd5b6020019150600581901b36038213156116f357600080fd5b9250929050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261172f57600080fd5b830160208101925035905067ffffffffffffffff81111561174f57600080fd5b8060051b36038213156116f357600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261179657600080fd5b830160208101925035905067ffffffffffffffff8111156117b657600080fd5b8036038213156116f357600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261184257600080fd5b90910192915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261184257600080fd5b8035825260006118926020830183611761565b604060208601526118a76040860182846117c5565b95945050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126118e557600080fd5b830160208101925035905067ffffffffffffffff81111561190557600080fd5b8060061b36038213156116f357600080fd5b8035611922816113f6565b73ffffffffffffffffffffffffffffffffffffffff168252602090810135910152565b81835260208301925060008160005b84811015611979576119668683611917565b6040958601959190910190600101611954565b5093949350505050565b60008383855260208086019550808560051b8301018460005b87811015611a66577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08584030189526119d5828861184b565b60406119e18283611761565b8287526119f183880182846117c5565b915050611a008784018461180e565b9250858103878701526060611a15848561184b565b818352611a248284018261187f565b915050611a33888501856118b0565b8383038a850152611a45838284611945565b9585013593909401929092525050509884019892509083019060010161199c565b5090979650505050505050565b60008383855260208086019550808560051b8301018460005b87811015611a66577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0858403018952611ac5828861184b565b6040611ad18283611761565b828752611ae183880182846117c5565b915050611af08784018461180e565b9250858103878701526060611b05848561184b565b818352611b148284018261187f565b9150508784013588830152611b2b838501856118b0565b945082820384840152611b3f828683611945565b9d89019d9750505093860193505050600101611a8c565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6183360301811261184257600080fd5b60008383855260208086019550808560051b8301018460005b87811015611a66577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0858403018952611bdc828861184b565b6040611be88283611761565b828752611bf883880182846117c5565b915050611c0787840184611b56565b92508581038787015260a0611c1c8485611761565b828452611c2c83850182846117c5565b92505050611c3c88850185611761565b8383038a850152611c4e8382846117c5565b8686013595850195909552505050606080840135908201526080928301359291611c77846113f6565b73ffffffffffffffffffffffffffffffffffffffff9390931691015298840198925090830190600101611ba3565b6000611cb182836116fa565b60a085528060a08601527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115611ce857600080fd5b60051b808260c087013784019050611d0360208401846116fa565b60c0868403016020870152611d1c60c084018284611983565b92505050611d2d60408401846116fa565b8583036040870152611d40838284611a73565b92505050611d5160608401846116fa565b8583036060870152611d64838284611b8a565b92505050611d7560808401846116fa565b8583036080870152611d88838284611b8a565b9695505050505050565b60208082528181018390526000906040600585901b8401810190840186845b87811015611e05577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0878503018352611df384611dee848c611b56565b611ca5565b93509184019190840190600101611db1565b5091979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611e5357600080fd5b815161065f816113f6565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201819052810183905260008460a08301825b86811015611eb357611ea08284611917565b6040928301929190910190600101611e8e565b5091506118a790506040830184611917565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112611efa57600080fd5b83018035915067ffffffffffffffff821115611f1557600080fd5b6020019150368190038213156116f357600080fd5b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561037257610372611f3a565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611fad57611fad611f3a565b5060010190565b73ffffffffffffffffffffffffffffffffffffffff831681526040810160058310612008577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8260208301529392505050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6183360301811261168157600080fd5b60208152600061065f6020830184611ca5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156120ae576120ae61205c565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156120fb576120fb61205c565b604052919050565b60005b8381101561211e578181015183820152602001612106565b50506000910152565b6000602080838503121561213a57600080fd5b825167ffffffffffffffff8082111561215257600080fd5b818501915085601f83011261216657600080fd5b8151818111156121785761217861205c565b8060051b6121878582016120b4565b91825283810185019185810190898411156121a157600080fd5b86860192505b838310156122a4578251858111156121bf5760008081fd5b860160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d0381018213156121f65760008081fd5b6121fe61208b565b8a84015161220b816113f6565b81526040848101518c83015292840151928984111561222a5760008081fd5b83850194508e603f86011261224157600093508384fd5b8b8501519350898411156122575761225761205c565b6122678c84601f870116016120b4565b92508383528e8185870101111561227e5760008081fd5b61228d848d8501838801612103565b8101919091528452505091860191908601906121a7565b9998505050505050505050565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b83811015612390578883037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00185528151805173ffffffffffffffffffffffffffffffffffffffff16845287810151888501528601516060878501819052815190850181905260809061235281838801858d01612103565b96890196601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016949094019093019250908601906001016122da565b509098975050505050505050565b6000826123d4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b50049056fea2646970667358221220643ffa3c8cf26ced4623b6be7ae61480d39bfe829ae1ff006cc144a1cfaf5cc364736f6c63430008160033
|
{{
"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/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"
},
"@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"
},
"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/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/compliance/IWhitelistingController.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\n/**\n * @title Status\n * @notice Enum representing status of a record (e.g., token, protocol, operator)\n * used for operation validation.\n * @notice Validators must adhere to the following rules for different operations and contexts:\n * 1) For exchanges: `operator`, `pool`, and `input token` *MAY* be either supported or suspended, but the `output token` *MUST* be supported.\n * 2) For deposits: `operator`, `pool`, and every `token` in the `pool` *MUST* be supported.\n * 3) For withdrawals: `operator`, `pool`, and each `token` *MAY* be either supported or suspended.\n *\n * @dev **Note** that deposit denotes **all** ways of aquiring liquidity such\n * as token deposit, LP tokens stake, NFT mint etc.\n */\nenum Status {\n Undefined,\n Supported,\n Suspended\n}\n\n/**\n * @title WhitelistingAddressRecord\n * @notice A struct to store an address and its support status.\n * @dev This struct stores an address and its support status.\n * @dev `source`: The address to be stored.\n * @dev `supported`: Indicates whether the address is supported or not.\n */\nstruct WhitelistingAddressRecord {\n address source;\n bool supported;\n}\n\n/**\n * @title TokenPermission\n * @notice This enum represents different levels of permission for a token, including trading, collateral, leverage, and full access.\n * @dev `None`: Represents no permissions granted for the token.\n * @dev `TradeOnly`: Represents the lowest permission level where you can only trade the token.\n * @dev `Collateral`: Allows you to use the token as collateral.\n * @dev `Leverage`: Allows you to leverage the token.\n * @dev `FullAccess`: Represents the highest permission level where you have full access to trade, use as collateral, and leverage the token.\n */\nenum TokenPermission {\n None,\n TradeOnly,\n Collateral,\n Leverage,\n FullAccess\n}\n\n/**\n * @title WhitelistingTokenRecord\n * @notice This struct stores an address and its support status for whitelisting, collateral and leverage.\n * @dev `source`: The address of the token.\n * @dev `supported`: Whether the token can be received from a protocol trades.\n * @dev `permission`: Level of [`TokenPermission`](./enum.TokenPermission.html).\n */\nstruct WhitelistingTokenRecord {\n address source;\n bool supported;\n TokenPermission permission;\n}\n\n/**\n * @notice An error indicating that a token is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported token is used.\n * @dev `token`: The address of the unsupported token.\n */\nerror TokenIsNotSupported(address token);\n\n/**\n * @notice An error indicating that a token is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended token is used.\n * @dev `token`: The address of the suspended token.\n */\nerror TokenIsSuspended(address token);\n\n/**\n * @notice An error indicating that the token's permission level is insufficient for the requested action.\n * @dev This can be thrown at [`IWhitelistingController.enforceTokenHasPermission()`](./interface.IWhitelistingController.html#enforcetokenhaspermission)\n * @param token The address of the token that has insufficient permissions.\n * @param required The required permission level for the action.\n * @param actual The actual permission level of the token.\n */\nerror TokenLevelInsufficient(address token, TokenPermission required, TokenPermission actual);\n\n/**\n * @notice An error indicating that an operator is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported operator is used.\n * @dev `operator`: The address of the unsupported operator.\n */\nerror OperatorIsNotSupported(address operator);\n\n/**\n * @notice An error indicating that an operator is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended operator is used.\n * @dev `operator`: The address of the suspended operator.\n */\nerror OperatorIsSuspended(address operator);\n\n/**\n * @notice An error indicating that a protocol is not supported by the whitelisting controller.\n * @dev This error is thrown when an unsupported protocol is used.\n * @dev `protocol`: The identification string of the unsupported protocol.\n */\nerror ProtocolIsNotSupported(string protocol);\n\n/**\n * @notice An error indicating that a protocol is suspended by the whitelisting controller.\n * @dev This error is thrown when a suspended protocol is used.\n * @dev `protocol`: The identification string of the unsupported protocol.\n */\nerror ProtocolIsSuspended(string protocol);\n\n/**\n * @title IWhitelistingController\n * @notice Interface for managing whitelisting of tokens, protocols, and operators.\n */\ninterface IWhitelistingController {\n /**\n * @dev Emitted when the support status of a protocol changes.\n * @dev `protocol`: The identification string of the protocol.\n * @dev `supported`: Whether the protocol is supported or not.\n */\n event ProtocolSupportChanged(string indexed protocol, bool supported);\n\n /**\n * @dev Emitted when the support status of a token changes.\n * @dev `token`: The address of the token.\n * @dev `supported`: Whether the token is supported or not.\n * @dev `permission`: Level of [`TokenPermission`](./enum.TokenPermission.html).\n */\n event TokenSupportChanged(address indexed token, bool supported, TokenPermission permission);\n\n /**\n * @dev Emitted when the support status of an operator changes for a specific protocol.\n * @dev `protocol`: The identification string of the protocol.\n * @dev `operator`: The address of the operator.\n * @dev `supported`: Whether the operator is supported or not.\n */\n event OperatorSupportChanged(string indexed protocol, address indexed operator, bool supported);\n\n /**\n * @notice Update the support status of multiple tokens.\n * @dev Emits a [`TokenSupportChanged()`](#tokensupportchanged) event for each token whose status changed.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if no token status changed.\n * @param _tokens An array of [`WhitelistingTokenRecord`](./struct.WhitelistingTokenRecord.html)\n * structs containing token addresses, support statuses and permissions.\n */\n function updateTokensSupport(WhitelistingTokenRecord[] calldata _tokens) external;\n\n /**\n * @notice Update the support status of a protocol.\n * @dev Emits a [`ProtocolSupportChanged()`](#protocolsupportchanged) event.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if protocol status is up to date.\n * @param _protocol The identification string of the protocol.\n * @param _adapterEvaluator The address of the adapter evaluator for the protocol.\n * @param _supported Whether the protocol is supported or not.\n */\n function updateProtocolSupport(\n string calldata _protocol,\n address _adapterEvaluator,\n bool _supported\n ) external;\n\n /**\n * @notice Update the support status of multiple operators for a specific protocol.\n * @dev Emits a [`OperatorSupportChanged()`](#operatorsupportchanged) event for each token whose status changed.\n * @dev Reverts with an [`AlreadyUpToDate()`](/interfaces/base/CommonErrors.sol/error.AlreadyUpToDate.html)\n * error if no operator status changed.\n * @param _protocol The identification string of the protocol.\n * @param _operators An array of `WhitelistingAddressRecord` structs containing operator addresses and support statuses.\n */\n function updateOperatorsSupport(\n string calldata _protocol,\n WhitelistingAddressRecord[] calldata _operators\n ) external;\n\n /**\n * @notice Ensures that a token has the specified permission level.\n * @dev This check does not enforce exact match, but only that level is sufficient.\n * So if `permission` is TokenPermission.TradeOnly and the token has TokenPermission.Collateral\n * then it assumes that level is sufficient since Collateral level includes both\n * TradeOnly and Collateral levels.\n * @param token The address of the token to check for permission.\n * @param permission The required [`TokenPermission`](TokenPermission) to be enforced.\n */\n function enforceTokenHasPermission(address token, TokenPermission permission) external view;\n\n /**\n * @notice Returns the support status of a token as well as it's permissions.\n * @param _token The address of the token.\n * @return The [`Status`](./enum.Status.html)\n * of the token.\n * @return The [`TokenPermission`](./enum.TokenPermission.html)\n * of the token.\n */\n function getTokenSupport(address _token) external view returns (Status, TokenPermission);\n\n /**\n * @notice Returns the support status of a protocol.\n * @param _protocol The identification string of the protocol.\n * @return The [`Status`](./enum.Status.html)\n * of the protocol.\n */\n function getProtocolStatus(string calldata _protocol) external view returns (Status);\n\n /**\n * @notice Returns the address of the adapter evaluator for a protocol.\n * @param _protocol The identification string of the protocol.\n * @return The address of the adapter evaluator for the protocol.\n */\n function getProtocolEvaluator(string calldata _protocol) external view returns (address);\n\n /**\n * @notice Returns the support status of an operator for a specific protocol.\n * @param _operator The address of the operator.\n * @return operatorStatus_ The [`Status`](./enum.Status.html)\n * of the operator.\n * @return protocolStatus_ The [`Status`](./enum.Status.html)\n * of the protocol.\n */\n function getOperatorStatus(\n address _operator\n ) external view returns (Status operatorStatus_, Status protocolStatus_);\n}\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/accountAbstraction/marginAccount/IAccountFactory.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IAccountFactory {\n /// @notice Logged when new margin account is deployed\n event AccountDeployed(address indexed account);\n /// @notice Logged every time a margin account being assigned to a new owner\n event AccountBorrowed(address indexed account);\n /// @notice Logged every time a margin account being unassigned from the previous owner\n event AccountReturned(address indexed account);\n\n /**\n * @notice Allows *Margin Engine* to borrow an account for registration.\n * @return Address of the borrowed account.\n */\n function borrowAccount() external returns (address);\n\n /**\n * @notice After account was closed or liquidated *Margin Engine* returns it to the factory for later reuse.\n * @param account Address of the account to return.\n */\n function returnAccount(address account) external;\n\n /**\n * @notice Utility to deploy multiple margin accounts for future use\n * @param count Number of margin accounts to deploy\n */\n function deployMarginAccounts(uint256 count) external;\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/marginEngine/Envelope.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Script} from \"contracts/interfaces/accountAbstraction/interpreter/Script.sol\";\nimport {EnvelopeRunner} from \"contracts/marginEngine/libraries/EnvelopeRunner.sol\";\n\n/**\n * @title Route\n * @notice Part of the [envelope](/interfaces/marginEngine/Envelope.sol/struct.Envelope.html)\n * @notice At **routing** level we define `protocol` name where **content**\n * should be executed as well as through which `protocol` **content** should\n * be delivered to the target ledger if chain did not matched.\n * @dev The `protocol` through which **content** should be delivered.\n * @dev The `destination` chain of the **content**.\n */\nstruct Route {\n string protocol;\n string destination;\n}\n\n/**\n * @title Envelope\n * @notice Part of the [syntax tree](/interfaces/marginEngine/index.html#syntax-tree-for-allocation--liquidation)\n * @notice Along with **routing** this struct holds **content** containing\n * [scripts](/interfaces/accountAbstraction/interpreter/Script.sol/struct.Script.html)\n * with actual business logic.\n * @dev The [route](/interfaces/marginEngine/Envelope.sol/struct.Route.html) of the **content**\n * @dev The `content` field holds an array of [`Scripts`](/interfaces/accountAbstraction/interpreter/Script.sol/struct.Script.html)\n * that should be executed at the `route.destination`.\n */\nstruct Envelope {\n Route route;\n Script[] content;\n}\n\nusing EnvelopeRunner for Envelope global;\n\n/**\n * @dev Error indicating that cross-chain actions are forbidden.\n */\nerror CrossChainActionIsForbidden();\n"
},
"contracts/interfaces/marginEngine/IDispatcher.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Asset} from \"contracts/libraries/AssetLibrary.sol\";\nimport {Package} from \"./Package.sol\";\n\n/**\n * @title Dispatcher\n * @notice The facade for communication between margin engine backend and margin engine smart contracts module.\n * @notice This contract is responsible for handling [account registration](#registermarginaccount), [leverage allocation](#submitplan), [account close](#tryclosemarginaccount) and [account liquidation](#tryclosemarginaccount).\n */\ninterface IDispatcher {\n /// @notice Throwed when asset, supplied to a margin account, does not corresponds the account's leverage\n error InvalidLeverageSupplied(address actual, address expected);\n\n /**\n * @notice Ether may be received from _Asset Manager_ during registration and from [`IPool`](/interfaces/liquidityManagement/liquidityPool/IPool.sol/interface.IPool.html) during the allocation.\n */\n receive() external payable;\n\n /**\n * @notice Assigns and registers a new margin account to the caller.\n * @notice Collateral will be transferred from `msg.sender` to the account immediately.\n * After the call the account will be in the `registered` state.\n * Will revert if either thresholds are not met,\n * whitelists validation failed, or collateral tokens are not approved to this contract.\n * @dev [AccountFactory](/interfaces/accountAbstraction/marginAccount/IAccountFactory.sol/interface.IAccountFactory.html)\n * emits [AccountBorrowed](/interfaces/accountAbstraction/marginAccount/IAccountFactory.sol/interface.IAccountFactory.html#accountborrowed)\n * (and [AccountDeployed](http://localhost:3000/interfaces/accountAbstraction/marginAccount/IAccountFactory.sol/interface.IAccountFactory.html#accountdeployed) if object pool is empty).\n * @dev [Account](/interfaces/accountAbstraction/marginAccount/IAccount.sol/interface.IAccount.html) emits\n * [AccountRegistered](/interfaces/accountAbstraction/marginAccount/IAccount.sol/interface.IAccount.html#accountregistered).\n */\n function registerMarginAccount(\n Asset[] calldata _collateral,\n Asset calldata _leverage\n ) external payable returns (address account);\n\n /**\n * @notice Executes provided syntax tree.\n * @dev Will revert **ONLY IF** [script](/interfaces/accountAbstraction/interpreter/Script.sol/struct.Script.html) compilation failed.\n * @dev Will **NOT** revert if execution of compiled instruction failed.\n * @param syntaxTree Deterministic set of scripts wrapped in routing envelopes.\n * `onComplete` callback will be run only if `action` execution was successful.\n */\n function submitPlan(Package[] calldata syntaxTree) external;\n\n /**\n * @notice Supplies registered margin account with leverage.\n * @dev Will revert if either account already opened, [invalid leverage token supplied](/interfaces/marginEngine/IDispatcher.sol/interface.IDispatcher.html#invalidleveragesupplied) or too much supplied\n * @param partialLeverage Full or partial amount of leverage to supply.\n */\n function supplyMarginAccount(\n address payable account,\n Asset calldata partialLeverage\n ) external payable;\n\n /**\n * @notice Switchs margin account to the `suspended` state and\n * tries to execute provided plan's action on the account. Can be called\n * multiple times if the account's closing was not successful\n * @dev Will not revert if action execution on margin account failed\n * therefore all the changes from successful scripts will be applied\n * after transaction. Account will remain in the suspended state and\n * will wait till successful closing.\n * @param liquidationPlan `action` will be executed on the account and\n * `onComplete` callback will be run on this contract (if `action` succeeded).\n */\n function tryCloseMarginAccount(\n address payable account,\n Package calldata liquidationPlan\n ) external returns (bool success);\n}\n"
},
"contracts/interfaces/marginEngine/Package.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {PackageRunner} from \"contracts/marginEngine/libraries/PackageRunner.sol\";\nimport {Envelope} from \"./Envelope.sol\";\n\n/**\n * @title Package\n * @notice Part of the [syntax tree](/interfaces/marginEngine/index.html#syntax-tree-for-allocation--liquidation)\n * @notice **Automation** part of the syntax tree which defines an `action` with attached to it callback `onComplete`.\n * The callback will only be run if action succeeded.\n * @dev The `action` field represents the primary action in the [`Envelope`](../Envelope.sol/struct.Envelope.html) struct to be executed.\n * @dev The `onComplete` array is composed of [`Envelope`](../Envelope.sol/struct.Envelope.html) structs that will be executed after the primary action completes.\n */\nstruct Package {\n Envelope action;\n Envelope[] onComplete;\n}\n\nusing PackageRunner for Package global;\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/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/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/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"
},
"contracts/marginEngine/base/ThresholdsVerifier.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IWhitelistingController,\n TokenPermission\n} from \"contracts/interfaces/accountAbstraction/compliance/IWhitelistingController.sol\";\nimport {AmountMustNotBeZero, ArrayMustNotBeEmpty} from \"contracts/interfaces/base/CommonErrors.sol\";\nimport {Asset} from \"contracts/libraries/AssetLibrary.sol\";\n\nabstract contract ThresholdsVerifier {\n IWhitelistingController internal immutable compliance;\n\n constructor(address _compliance) {\n compliance = IWhitelistingController(_compliance);\n }\n\n function verifyThresholds(\n Asset[] calldata _collateral,\n Asset calldata _leverage\n ) internal view {\n compliance.enforceTokenHasPermission(_leverage.token, TokenPermission.Leverage);\n if (_leverage.amount == 0) revert AmountMustNotBeZero(_leverage.token);\n\n if (_collateral.length == 0) revert ArrayMustNotBeEmpty();\n\n for (uint256 i; i < _collateral.length; i++) {\n Asset calldata c = _collateral[i];\n compliance.enforceTokenHasPermission(c.token, TokenPermission.Collateral);\n if (c.amount == 0) revert AmountMustNotBeZero(c.token);\n }\n }\n}\n"
},
"contracts/marginEngine/Dispatcher.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IAccount} from \"contracts/interfaces/accountAbstraction/marginAccount/IAccount.sol\";\nimport {\n IAccountFactory\n} from \"contracts/interfaces/accountAbstraction/marginAccount/IAccountFactory.sol\";\nimport {Asset, IDispatcher} from \"contracts/interfaces/marginEngine/IDispatcher.sol\";\n\nimport {AccessControlDS} from \"contracts/base/auth/AccessControlDS.sol\";\n\nimport {ThresholdsVerifier} from \"./base/ThresholdsVerifier.sol\";\nimport {\n CrossChainActionIsForbidden,\n Envelope,\n EnvelopeRunner,\n Package\n} from \"./libraries/PackageRunner.sol\";\n\ncontract Dispatcher is IDispatcher, AccessControlDS, ThresholdsVerifier {\n using EnvelopeRunner for Envelope[];\n\n address private immutable interpreter;\n bytes32 private immutable chainNameHash;\n IAccountFactory private immutable factory;\n\n bytes32 public constant MARGIN_ENGINE_AUTHORITY = keccak256(\"Margin Engine Authority\");\n bytes32 public constant MARGIN_ACCOUNT_SUPPLIER = keccak256(\"Margin Account Supplier\");\n\n constructor(\n address _interpreter,\n address _factory,\n string memory _chainName\n ) ThresholdsVerifier(_interpreter) {\n interpreter = _interpreter;\n chainNameHash = keccak256(bytes(_chainName));\n factory = IAccountFactory(_factory);\n }\n\n receive() external payable override {}\n\n function registerMarginAccount(\n Asset[] calldata _collateral,\n Asset calldata _leverage\n ) external payable override returns (address account) {\n verifyThresholds(_collateral, _leverage);\n\n account = factory.borrowAccount();\n\n for (uint256 i; i < _collateral.length; i++) {\n _collateral[i].forward(account);\n }\n\n IAccount(payable(account)).register(msg.sender, _collateral, _leverage);\n }\n\n function submitPlan(\n Package[] calldata _plan\n ) external override onlyRole(MARGIN_ENGINE_AUTHORITY) {\n for (uint256 i; i < _plan.length; i++) {\n _plan[i].run(interpreter, chainNameHash);\n }\n }\n\n function supplyMarginAccount(\n address payable _account,\n Asset calldata partialLeverage\n ) external payable override onlyRole(MARGIN_ACCOUNT_SUPPLIER) {\n IAccount account = IAccount(_account);\n\n (address expected, ) = account.leverage();\n address supplying = partialLeverage.token;\n if (supplying != expected) revert InvalidLeverageSupplied(supplying, expected);\n\n partialLeverage.forward(_account);\n account.supply(partialLeverage.amount);\n }\n\n function tryCloseMarginAccount(\n address payable _account,\n Package calldata _liquidationPlan\n ) external override onlyRole(MARGIN_ENGINE_AUTHORITY) returns (bool success_) {\n if (!_liquidationPlan.action.isChainEq(chainNameHash)) revert CrossChainActionIsForbidden();\n\n IAccount account = IAccount(_account);\n\n if (success_ = account.tryClose(_liquidationPlan.action.content)) {\n factory.returnAccount(address(account));\n success_ = _liquidationPlan.onComplete.run(interpreter, chainNameHash) == 0;\n }\n }\n}\n"
},
"contracts/marginEngine/libraries/EnvelopeRunner.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {\n IJitCompiler,\n Script\n} from \"contracts/interfaces/accountAbstraction/interpreter/IJitCompiler.sol\";\nimport {\n CrossChainActionIsForbidden,\n Envelope\n} from \"contracts/interfaces/marginEngine/Envelope.sol\";\nimport {Command, CommandExecutor} from \"contracts/libraries/CommandLibrary.sol\";\n\nlibrary EnvelopeRunner {\n using CommandExecutor for Command[];\n\n /**\n * @dev This error should never happen, it is needed\n * for preventing underestimation on \"eth_estimateGas\".\n */\n error OutOfGas();\n\n function run(\n Envelope[] calldata self,\n address jitCompiler,\n bytes32 chainNameHash\n ) internal returns (uint256 numberOfFailures) {\n for (uint256 i; i < self.length; i++) {\n numberOfFailures += self[i].run(jitCompiler, chainNameHash) ? 0 : 1;\n }\n }\n\n function run(\n Envelope calldata self,\n address jitCompiler,\n bytes32 chainNameHash\n ) internal returns (bool success) {\n IJitCompiler compiler = IJitCompiler(jitCompiler);\n\n if (self.isChainEq(chainNameHash)) {\n for (uint256 i; i < self.content.length; i++) {\n Script calldata script = self.content[i];\n Command[] memory cmds = compiler.compile(script);\n uint256 gasBefore = gasleft();\n // solhint-disable-next-line no-empty-blocks\n try cmds.execute() {} catch {\n // NOTE: Since we allow silent fail here, this revert is\n // required to prevent the underestimation of gas in the\n // context of EIP-150. The \"all but one 64th\" rule, along\n // with the way most clients estimate gas, may produce an\n // out-of-gas error at the callee contract but success at\n // the caller contract. For example, if we have a single\n // instruction to execute, and after executing this\n // instruction, the remaining work will consume 5000 gas,\n // the instruction will only receive at most 5000*63 gas.\n // Therefore, if the actual requirements are higher, it\n // will fail at the random opcode. The remaining work\n // will be finished (since we still have at least 5000*1\n // gas), and overall transaction success will be achieved,\n // making the gas estimator happy.\n //\n // The proportion for comparing the gasleft (to check that\n // the call has not consumed all the gas passed) is in practice\n // 1 to 16-32, but we take twice as much just in case.\n if (gasleft() < gasBefore / 8) revert OutOfGas();\n return success = false;\n }\n }\n } else {\n revert CrossChainActionIsForbidden();\n }\n\n return success = true;\n }\n\n function isChainEq(Envelope calldata self, bytes32 chainNameHash) internal pure returns (bool) {\n return keccak256(bytes(self.route.destination)) == chainNameHash;\n }\n}\n"
},
"contracts/marginEngine/libraries/PackageRunner.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {Package} from \"contracts/interfaces/marginEngine/Package.sol\";\nimport {Command, SafeCall} from \"contracts/libraries/SafeCall.sol\";\nimport {CrossChainActionIsForbidden, Envelope, EnvelopeRunner} from \"./EnvelopeRunner.sol\";\n\nlibrary PackageRunner {\n using SafeCall for Command[];\n using EnvelopeRunner for Envelope[];\n\n function run(\n Package calldata self,\n address compiler,\n bytes32 chainNameHash\n ) internal returns (uint256 numberOfFailures) {\n if (self.action.isChainEq(chainNameHash)) {\n bool actionSuccess = self.action.run(compiler, chainNameHash);\n if (actionSuccess) {\n numberOfFailures += self.onComplete.run(compiler, chainNameHash);\n } else {\n numberOfFailures++;\n }\n } else {\n revert CrossChainActionIsForbidden();\n }\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/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,284 |
ac52e2195ef15159e634a18f4eb58bdbef48c9d97f8d039a997c9f7c1ef47d35
|
5542565e1ce1575690e90428786a8687bee1a72465afeed6069a3d5735c782a4
|
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
|
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
|
293ba5f4fd8b8129208dcf1e2274dbaefcdd6fae
|
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
| ||
1 | 20,290,285 |
69799e81f9e50e7b9105c583350d73862d644d9676e9d81c67487819bf5401e9
|
6c9efc3091a7f2685924f85c15c7f733c111d987c0cbc29008a869f022664066
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
54c1c72df0ab9934ae0144155ecad3f0b66e5155
|
697e63fffe3b3469bb0e1a51113154a176765e5c
|
608060405234801561001057600080fd5b5061077c806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806336568abe1161005b57806336568abe1461010e57806391d1485414610121578063a217fddf14610134578063d547741f1461013c57600080fd5b806301ffc9a71461008d5780630b620b81146100b5578063248a9ca3146100ca5780632f2ff15d146100fb575b600080fd5b6100a061009b366004610648565b61014f565b60405190151581526020015b60405180910390f35b6100c86100c33660046106ac565b6101e8565b005b6100ed6100d83660046106fd565b60009081526020819052604090206001015490565b6040519081526020016100ac565b6100c8610109366004610716565b610309565b6100c861011c366004610716565b610334565b6100a061012f366004610716565b610392565b6100ed600081565b6100c861014a366004610716565b610413565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806101e257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a288995861021281610438565b6040517fd9caed1200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015284811660248301526044820184905286169063d9caed1290606401600060405180830381600087803b15801561028a57600080fd5b505af115801561029e573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff898116825288811660208301528716818301526060810186905290517fa4195c37c2947bbe89165f03e320b6903116f0b10d8cfdb522330f7ce6f9fa249350908190036080019150a15050505050565b60008281526020819052604090206001015461032481610438565b61032e8383610445565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610383576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61038d828261051c565b505050565b6000821580156103d457508173ffffffffffffffffffffffffffffffffffffffff166103bc6105b2565b73ffffffffffffffffffffffffffffffffffffffff16145b8061040c575060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b9392505050565b60008281526020819052604090206001015461042e81610438565b61032e838361051c565b61044281336105e1565b50565b60006104518383610392565b6105145760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556104b23390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016101e2565b5060006101e2565b60006105288383610392565b156105145760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016101e2565b60006105dc7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c13205490565b905090565b6105eb8282610392565b610644576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440160405180910390fd5b5050565b60006020828403121561065a57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461040c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461044257600080fd5b600080600080608085870312156106c257600080fd5b84356106cd8161068a565b935060208501356106dd8161068a565b925060408501356106ed8161068a565b9396929550929360600135925050565b60006020828403121561070f57600080fd5b5035919050565b6000806040838503121561072957600080fd5b82359150602083013561073b8161068a565b80915050925092905056fea264697066735822122061c235c8dfe7895f4d16cdd1f2f8e3c4f30a40e7e06dd28cdff480c8f9613a2464736f6c63430008160033
|
608060405234801561001057600080fd5b50600436106100885760003560e01c806336568abe1161005b57806336568abe1461010e57806391d1485414610121578063a217fddf14610134578063d547741f1461013c57600080fd5b806301ffc9a71461008d5780630b620b81146100b5578063248a9ca3146100ca5780632f2ff15d146100fb575b600080fd5b6100a061009b366004610648565b61014f565b60405190151581526020015b60405180910390f35b6100c86100c33660046106ac565b6101e8565b005b6100ed6100d83660046106fd565b60009081526020819052604090206001015490565b6040519081526020016100ac565b6100c8610109366004610716565b610309565b6100c861011c366004610716565b610334565b6100a061012f366004610716565b610392565b6100ed600081565b6100c861014a366004610716565b610413565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806101e257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7f73dc7116aeb4443506890f87340f6691830bb8eec46a412a34da68a2a288995861021281610438565b6040517fd9caed1200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015284811660248301526044820184905286169063d9caed1290606401600060405180830381600087803b15801561028a57600080fd5b505af115801561029e573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff898116825288811660208301528716818301526060810186905290517fa4195c37c2947bbe89165f03e320b6903116f0b10d8cfdb522330f7ce6f9fa249350908190036080019150a15050505050565b60008281526020819052604090206001015461032481610438565b61032e8383610445565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610383576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61038d828261051c565b505050565b6000821580156103d457508173ffffffffffffffffffffffffffffffffffffffff166103bc6105b2565b73ffffffffffffffffffffffffffffffffffffffff16145b8061040c575060008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff165b9392505050565b60008281526020819052604090206001015461042e81610438565b61032e838361051c565b61044281336105e1565b50565b60006104518383610392565b6105145760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556104b23390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016101e2565b5060006101e2565b60006105288383610392565b156105145760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016101e2565b60006105dc7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c13205490565b905090565b6105eb8282610392565b610644576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440160405180910390fd5b5050565b60006020828403121561065a57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461040c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461044257600080fd5b600080600080608085870312156106c257600080fd5b84356106cd8161068a565b935060208501356106dd8161068a565b925060408501356106ed8161068a565b9396929550929360600135925050565b60006020828403121561070f57600080fd5b5035919050565b6000806040838503121561072957600080fd5b82359150602083013561073b8161068a565b80915050925092905056fea264697066735822122061c235c8dfe7895f4d16cdd1f2f8e3c4f30a40e7e06dd28cdff480c8f9613a2464736f6c63430008160033
|
{{
"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/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"
},
"@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"
},
"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/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/marginEngine/IWithdrawer.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\ninterface IWithdrawer {\n function withdraw(\n address payable account,\n address token,\n address receiver,\n uint256 amount\n ) 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/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/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/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"
},
"contracts/marginEngine/Withdrawer.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.22;\n\nimport {IAccount} from \"contracts/interfaces/accountAbstraction/marginAccount/IAccount.sol\";\nimport {IWithdrawer} from \"contracts/interfaces/marginEngine/IWithdrawer.sol\";\nimport {AccessControlDS} from \"contracts/base/auth/AccessControlDS.sol\";\n\ncontract Withdrawer is IWithdrawer, AccessControlDS {\n bytes32 private constant MARGIN_ENGINE_AUTHORITY = keccak256(\"Margin Engine Authority\");\n\n event Withdrawn(address account, address token, address recipient, uint256 amount);\n\n function withdraw(\n address payable account,\n address token,\n address receiver,\n uint256 amount\n ) external override onlyRole(MARGIN_ENGINE_AUTHORITY) {\n IAccount(account).withdraw(token, receiver, amount);\n emit Withdrawn(account, token, receiver, amount);\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/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": {}
}
}}
|
1 | 20,290,291 |
c3170d4639b6c6cf9d95c46fc36040b1e7b8f5d15c172521d0009ca25d820a1a
|
91adebb81d7408e27acd85590a1e2732cdc7078f1b2506dc4171098882611f7f
|
bbb014a8196ec46604bca105e86b0ecd6ffb563f
|
bbb014a8196ec46604bca105e86b0ecd6ffb563f
|
9d5c57da5091d9016894f31528b8eb176401ecd9
|
60806040523480156200001157600080fd5b5060405162006aa138038062006aa1833981810160405281019062000037919062000977565b610230600c8190555084600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160006003808111156200009c576200009b620009ff565b5b6003811115620000b157620000b0620009ff565b5b815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360016000806003811115620001185762000117620009ff565b5b60038111156200012d576200012c620009ff565b5b815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826001600060016003811115620001955762000194620009ff565b5b6003811115620001aa57620001a9620009ff565b5b815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200020b6000801b33620003b460201b60201c565b62000243604051602001620002209062000a89565b6040516020818303038152906040528051906020012033620003ca60201b60201c565b6200027b604051602001620002589062000af0565b6040516020818303038152906040528051906020012033620003ca60201b60201c565b620002b6604051602001620002909062000a89565b604051602081830303815290604052805190602001206000801b6200041360201b60201c565b620002f1604051602001620002cb9062000af0565b604051602081830303815290604052805190602001206000801b6200041360201b60201c565b6a0422ca8b0a00a425000000600a819055506200033b604051602001620003189062000a89565b6040516020818303038152906040528051906020012082620003ca60201b60201c565b6006819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506365926056600b81905550505050505062000e9b565b620003c682826200047660201b60201c565b5050565b620003db826200056760201b60201c565b620003fc81620003f06200058660201b60201c565b6200058e60201b60201c565b6200040e83836200047660201b60201c565b505050565b600062000426836200056760201b60201c565b905081600080858152602001908152602001600020600101819055508181847fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff60405160405180910390a4505050565b6200048882826200064860201b60201c565b6200056357600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550620005086200058660201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000806000838152602001908152602001600020600101549050919050565b600033905090565b620005a082826200064860201b60201c565b6200064457620005ce8173ffffffffffffffffffffffffffffffffffffffff166014620006b260201b60201c565b620005e48360001c6020620006b260201b60201c565b604051602001620005f792919062000c15565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200063b919062000cba565b60405180910390fd5b5050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b606060006002836002620006c7919062000d17565b620006d3919062000d62565b67ffffffffffffffff811115620006ef57620006ee62000d9d565b5b6040519080825280601f01601f191660200182016040528015620007225781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106200075d576200075c62000dcc565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110620007c457620007c362000dcc565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600262000806919062000d17565b62000812919062000d62565b90505b6001811115620008bc577f3031323334353637383961626364656600000000000000000000000000000000600f86166010811062000858576200085762000dcc565b5b1a60f81b82828151811062000872576200087162000dcc565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080620008b49062000dfb565b905062000815565b506000841462000903576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620008fa9062000e79565b60405180910390fd5b8091505092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200093f8262000912565b9050919050565b620009518162000932565b81146200095d57600080fd5b50565b600081519050620009718162000946565b92915050565b600080600080600060a086880312156200099657620009956200090d565b5b6000620009a68882890162000960565b9550506020620009b98882890162000960565b9450506040620009cc8882890162000960565b9350506060620009df8882890162000960565b9250506080620009f28882890162000960565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600081905092915050565b7f526566696e657279000000000000000000000000000000000000000000000000600082015250565b600062000a7160088362000a2e565b915062000a7e8262000a39565b600882019050919050565b600062000a968262000a62565b9150819050919050565b7f53756241646d696e000000000000000000000000000000000000000000000000600082015250565b600062000ad860088362000a2e565b915062000ae58262000aa0565b600882019050919050565b600062000afd8262000ac9565b9150819050919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b600062000b3f60178362000a2e565b915062000b4c8262000b07565b601782019050919050565b600081519050919050565b60005b8381101562000b8257808201518184015260208101905062000b65565b60008484015250505050565b600062000b9b8262000b57565b62000ba7818562000a2e565b935062000bb981856020860162000b62565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600062000bfd60118362000a2e565b915062000c0a8262000bc5565b601182019050919050565b600062000c228262000b30565b915062000c30828562000b8e565b915062000c3d8262000bee565b915062000c4b828462000b8e565b91508190509392505050565b600082825260208201905092915050565b6000601f19601f8301169050919050565b600062000c868262000b57565b62000c92818562000c57565b935062000ca481856020860162000b62565b62000caf8162000c68565b840191505092915050565b6000602082019050818103600083015262000cd6818462000c79565b905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000d248262000cde565b915062000d318362000cde565b925082820262000d418162000cde565b9150828204841483151762000d5b5762000d5a62000ce8565b5b5092915050565b600062000d6f8262000cde565b915062000d7c8362000cde565b925082820190508082111562000d975762000d9662000ce8565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600062000e088262000cde565b91506000820362000e1e5762000e1d62000ce8565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b600062000e6160208362000c57565b915062000e6e8262000e29565b602082019050919050565b6000602082019050818103600083015262000e948162000e52565b9050919050565b615bf68062000eab6000396000f3fe6080604052600436106102305760003560e01c80638538142b1161012e578063bed7e1d8116100ab578063ce47d69a1161006f578063ce47d69a1461080e578063d547741f14610825578063da60fe8f1461084e578063f4651d5714610879578063f962a757146108a257610230565b8063bed7e1d814610751578063c1f1608b14610768578063c2c77c6614610791578063ca13d367146107ba578063cb315ef4146107e357610230565b8063a217fddf116100f2578063a217fddf14610687578063af6a909e146106b2578063b5440c31146106bc578063b5f522f7146106e5578063b9c4eb431461072857610230565b80638538142b146105a2578063853828b6146105df5780638a559fe3146105f657806391d148541461061f5780639af1d35a1461065c57610230565b80633887645b116101bc5780636e164b71116101805780636e164b71146104bd578063709334f3146104fa57806378dacee1146105255780637a8b69191461054e5780637da441c31461057757610230565b80633887645b146103da57806346cc599e146104055780634bb1ba82146104425780634ce58f151461046b5780635079399c1461049457610230565b8063211130361161020357806321113036146102df578063248a9ca3146103205780632f2ff15d1461035d57806336568abe146103865780633700cefb146103af57610230565b806301ffc9a714610235578063049c5c49146102725780630979f888146102895780630b97bc86146102b4575b600080fd5b34801561024157600080fd5b5061025c60048036038101906102579190613ead565b6108df565b6040516102699190613ef5565b60405180910390f35b34801561027e57600080fd5b50610287610959565b005b34801561029557600080fd5b5061029e610a30565b6040516102ab9190613f29565b60405180910390f35b3480156102c057600080fd5b506102c9610a36565b6040516102d69190613f29565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190613f70565b610a3c565b604051610317959493929190613f9d565b60405180910390f35b34801561032c57600080fd5b5061034760048036038101906103429190614026565b610a72565b6040516103549190614062565b60405180910390f35b34801561036957600080fd5b50610384600480360381019061037f91906140db565b610a91565b005b34801561039257600080fd5b506103ad60048036038101906103a891906140db565b610aba565b005b3480156103bb57600080fd5b506103c4610b3d565b6040516103d191906141d6565b60405180910390f35b3480156103e657600080fd5b506103ef610c47565b6040516103fc9190613f29565b60405180910390f35b34801561041157600080fd5b5061042c600480360381019061042791906141f1565b610c54565b6040516104399190613ef5565b60405180910390f35b34801561044e57600080fd5b5061046960048036038101906104649190613f70565b610c74565b005b34801561047757600080fd5b50610492600480360381019061048d9190614243565b610e26565b005b3480156104a057600080fd5b506104bb60048036038101906104b69190614597565b611040565b005b3480156104c957600080fd5b506104e460048036038101906104df9190613f70565b6113a7565b6040516104f19190614631565b60405180910390f35b34801561050657600080fd5b5061050f6113e6565b60405161051c9190613f29565b60405180910390f35b34801561053157600080fd5b5061054c60048036038101906105479190613f70565b6113ec565b005b34801561055a57600080fd5b50610575600480360381019061057091906141f1565b611485565b005b34801561058357600080fd5b5061058c611515565b6040516105999190614631565b60405180910390f35b3480156105ae57600080fd5b506105c960048036038101906105c49190613f70565b61153b565b6040516105d69190614631565b60405180910390f35b3480156105eb57600080fd5b506105f461157a565b005b34801561060257600080fd5b5061061d60048036038101906106189190613f70565b611b03565b005b34801561062b57600080fd5b50610646600480360381019061064191906140db565b611b8e565b6040516106539190613ef5565b60405180910390f35b34801561066857600080fd5b50610671611bf8565b60405161067e9190613f29565b60405180910390f35b34801561069357600080fd5b5061069c611bfe565b6040516106a99190614062565b60405180910390f35b6106ba611c05565b005b3480156106c857600080fd5b506106e360048036038101906106de9190614678565b611d46565b005b3480156106f157600080fd5b5061070c60048036038101906107079190613f70565b6121a3565b60405161071f97969594939291906146f3565b60405180910390f35b34801561073457600080fd5b5061074f600480360381019061074a91906141f1565b61221f565b005b34801561075d57600080fd5b506107666122ff565b005b34801561077457600080fd5b5061078f600480360381019061078a91906141f1565b6123d6565b005b34801561079d57600080fd5b506107b860048036038101906107b391906141f1565b612453565b005b3480156107c657600080fd5b506107e160048036038101906107dc9190614825565b612533565b005b3480156107ef57600080fd5b506107f8612719565b6040516108059190613f29565b60405180910390f35b34801561081a57600080fd5b50610823612726565b005b34801561083157600080fd5b5061084c600480360381019061084791906140db565b61277c565b005b34801561085a57600080fd5b506108636127a5565b6040516108709190613f29565b60405180910390f35b34801561088557600080fd5b506108a0600480360381019061089b91906141f1565b6127ab565b005b3480156108ae57600080fd5b506108c960048036038101906108c491906148ff565b612828565b6040516108d69190614631565b60405180910390f35b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061095257506109518261285b565b5b9050919050565b6109666000801b33611b8e565b8061099b575061099a60405160200161097e90614983565b6040516020818303038152906040528051906020012033611b8e565b5b6109da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d1906149f5565b60405180910390fd5b60006008600060016002546109ef9190614a44565b815260200190815260200160002090508060050160009054906101000a900460ff16158160050160006101000a81548160ff02191690831515021790555050565b60035481565b600b5481565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b6000806000838152602001908152602001600020600101549050919050565b610a9a82610a72565b610aab81610aa66128c5565b6128cd565b610ab5838361296a565b505050565b610ac26128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2690614aea565b60405180910390fd5b610b398282612a4a565b5050565b610b45613d9a565b610b4d613d9a565b600060025403610b605780915050610c44565b600860006001600254610b739190614a44565b81526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509150505b90565b6000600680549050905090565b60056020528060005260406000206000915054906101000a900460ff1681565b610c816000801b33611b8e565b80610cb65750610cb5604051602001610c9990614983565b6040516020818303038152906040528051906020012033611b8e565b5b610cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cec906149f5565b60405180910390fd5b610cfe81612b2b565b610d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3490614b56565b60405180910390fd5b6000600860006001600254610d529190614a44565b815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610dc393929190614b76565b6020604051808303816000875af1158015610de2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e069190614bc2565b5081816003016000828254610e1b9190614bef565b925050819055505050565b6000612710600c5484610e399190614c23565b610e439190614c94565b83610e4e9190614a44565b905060016000836003811115610e6757610e66614cc5565b5b6003811115610e7957610e78614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401610ee493929190614b76565b6020604051808303816000875af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f279190614bc2565b506000600860006001600254610f3d9190614a44565b81526020019081526020016000209050611015816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b61101e57600080fd5b61103a82848360050160019054906101000a900460ff16612d87565b50505050565b61104d6000801b33611b8e565b80611082575061108160405160200161106590614983565b6040516020818303038152906040528051906020012033611b8e565b5b6110c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b8906149f5565b60405180910390fd5b600083511180156110d3575080518351145b611112576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110990614d40565b60405180910390fd5b81600181111561112557611124614cc5565b5b6000600181111561113957611138614cc5565b5b0361125c5760005b83518110156112565760016005600086848151811061116357611162614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508381815181106111cf576111ce614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460003385858151811061122457611223614d60565b5b602002602001015160405161123b93929190614e45565b60405180910390a2808061124e90614e83565b915050611141565b506113a2565b81600181111561126f5761126e614cc5565b5b60018081111561128257611281614cc5565b5b036113a15760005b835181101561139f576000600560008684815181106112ac576112ab614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555083818151811061131857611317614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460013385858151811061136d5761136c614d60565b5b602002602001015160405161138493929190614e45565b60405180910390a2808061139790614e83565b91505061128a565b505b5b505050565b600781815481106113b757600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6113f96000801b33611b8e565b611438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142f90614f17565b60405180910390fd5b6000811161147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147290614f83565b60405180910390fd5b80600c8190555050565b6114926000801b33611b8e565b6114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614f17565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6006818154811061154b57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6115876000801b33611b8e565b6115c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bd90614f17565b60405180910390fd5b600160006003808111156115dd576115dc614cc5565b5b60038111156115ef576115ee614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336001600060038081111561165157611650614cc5565b5b600381111561166357611662614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116ca9190614631565b602060405180830381865afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b9190614fb8565b6040518363ffffffff1660e01b8152600401611728929190614fe5565b6020604051808303816000875af1158015611747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176b9190614bc2565b506001600080600381111561178357611782614cc5565b5b600381111561179557611794614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160008060038111156117f7576117f6614cc5565b5b600381111561180957611808614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016118709190614631565b602060405180830381865afa15801561188d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b19190614fb8565b6040518363ffffffff1660e01b81526004016118ce929190614fe5565b6020604051808303816000875af11580156118ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119119190614bc2565b50600160006001600381111561192a57611929614cc5565b5b600381111561193c5761193b614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160006001600381111561199f5761199e614cc5565b5b60038111156119b1576119b0614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611a189190614631565b602060405180830381865afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a599190614fb8565b6040518363ffffffff1660e01b8152600401611a76929190614fe5565b6020604051808303816000875af1158015611a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab99190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611b00573d6000803e3d6000fd5b50565b611b106000801b33611b8e565b80611b455750611b44604051602001611b2890614983565b6040516020818303038152906040528051906020012033611b8e565b5b611b84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7b906149f5565b60405180910390fd5b80600a8190555050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600c5481565b6000801b81565b6000612710600c5434611c189190614c23565b611c229190614c94565b34611c2d9190614a44565b90506000600860006001600254611c449190614a44565b81526020019081526020016000209050611d1c816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b611d2557600080fd5b611d428260028360050160019054906101000a900460ff16612d87565b5050565b611d536000801b33611b8e565b80611d885750611d87604051602001611d6b90614983565b6040516020818303038152906040528051906020012033611b8e565b5b611dc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbe906149f5565b60405180910390fd5b611dd082612b2b565b611e0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0690614b56565b60405180910390fd5b600060035411611e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4b9061505a565b60405180910390fd5b600060025414611f6a57611f69600860006001600254611e749190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860006001600254611eb99190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611f239190614631565b602060405180830381865afa158015611f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f649190614fb8565b613306565b5b60006008600060025481526020019081526020016000209050858160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084816001018190555083816002018190555082816003018190555060018160050160006101000a81548160ff021916908315150217905550818160050160016101000a81548160ff0219169083151502179055506301e13380600b5461202c9190614bef565b816001015411156120405761203f613385565b5b61204861338e565b6120506135dc565b8461205b9190614bef565b111561209c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612093906150c6565b60405180910390fd5b8060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b81526004016120fd93929190614b76565b6020604051808303816000875af115801561211c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121409190614bc2565b506002547fef6707848cac12824ef51fe16d76a210e3558daae9d1a56675945774d2c1ca9a878787878760405161217b9594939291906150e6565b60405180910390a26002600081548092919061219690614e83565b9190505550505050505050565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040154908060050160009054906101000a900460ff16908060050160019054906101000a900460ff16905087565b61222c6000801b33611b8e565b61226b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226290614f17565b60405180910390fd5b61229960405160200161227d90614983565b6040516020818303038152906040528051906020012082610a91565b6007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61230c6000801b33611b8e565b80612341575061234060405160200161232490614983565b6040516020818303038152906040528051906020012033611b8e565b5b612380576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612377906149f5565b60405180910390fd5b60006008600060016002546123959190614a44565b815260200190815260200160002090508060050160019054906101000a900460ff16158160050160016101000a81548160ff02191690831515021790555050565b6123e36000801b33611b8e565b612422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241990614f17565b60405180910390fd5b61245060405160200161243490615185565b604051602081830303815290604052805190602001208261277c565b50565b6124606000801b33611b8e565b61249f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161249690614f17565b60405180910390fd5b6124cd6040516020016124b190615185565b6040516020818303038152906040528051906020012082610a91565b6006819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61256160405160200161254590615185565b6040516020818303038152906040528051906020012033611b8e565b6125a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612597906151e6565b60405180910390fd5b600082511180156125b2575060008151115b6125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890615252565b60405180910390fd5b6000600960006003548152602001908152602001600020905087816000018190555086816001018190555085816003018190555084816004018190555083816002018190555060005b83518110156126f65761264b613df1565b83828151811061265e5761265d614d60565b5b602002602001015181602001818152505084828151811061268257612681614d60565b5b602002602001015181600001819052508260050181908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000190816126d5919061547e565b506020820151816001015550505080806126ee90614e83565b91505061263a565b506003600081548092919061270a90614e83565b91905055505050505050505050565b6000600780549050905090565b6127336000801b33611b8e565b612772576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276990614f17565b60405180910390fd5b61277a613385565b565b61278582610a72565b612796816127916128c5565b6128cd565b6127a08383612a4a565b505050565b600a5481565b6127b86000801b33611b8e565b6127f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ee90614f17565b60405180910390fd5b61282560405160200161280990614983565b604051602081830303815290604052805190602001208261277c565b50565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b6128d78282611b8e565b612966576128fc8173ffffffffffffffffffffffffffffffffffffffff1660146136f0565b61290a8360001c60206136f0565b60405160200161291b929190615619565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161295d9190615653565b60405180910390fd5b5050565b6129748282611b8e565b612a4657600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506129eb6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b612a548282611b8e565b15612b2757600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612acc6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060025403612b67576001915050612d19565b6000805b600254811015612c7f576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509050600b54816020015110612c6b57806060015183612c689190614bef565b92505b508080612c7790614e83565b915050612b6b565b508381612c8c9190614bef565b90506000612d0d8373ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d029190614fb8565b600a5460128061392c565b90508082111593505050505b919050565b60008160c00151612d325760019050612d82565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690505b919050565b600083118015612d9957506000600254115b612dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dcf906156c1565b60405180910390fd5b6000600860006001600254612ded9190614a44565b8152602001908152602001600020905080600101544210158015612e15575080600201544211155b612e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4b9061572d565b60405180910390fd5b8060050160009054906101000a900460ff16612ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e9c90615799565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000846003811115612ee157612ee0614cc5565b5b60006003811115612ef557612ef4614cc5565b5b03612f7d57612f768273ffffffffffffffffffffffffffffffffffffffff1663d8f1d7ea6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6c9190614fb8565b876006601261392c565b9050613187565b846003811115612f9057612f8f614cc5565b5b60016003811115612fa457612fa3614cc5565b5b0361302c576130258273ffffffffffffffffffffffffffffffffffffffff1663b77d2a1d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301b9190614fb8565b876006601261392c565b9050613186565b84600381111561303f5761303e614cc5565b5b60038081111561305257613051614cc5565b5b036130da576130d38273ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c99190614fb8565b876006601261392c565b9050613185565b8460038111156130ed576130ec614cc5565b5b6002600381111561310157613100614cc5565b5b03613184576131818273ffffffffffffffffffffffffffffffffffffffff1663027480e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015613154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131789190614fb8565b8760128061392c565b90505b5b5b5b6000613192826139b1565b9050818460040160008282546131a89190614bef565b925050819055508360030154846004015411156131fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131f190615805565b60405180910390fd5b8360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401613259929190614fe5565b6020604051808303816000875af1158015613278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329c9190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff167f9c0381305bbf7da8ed16753de32983d70bbb06100f82ff8a8b6f1d598cd4525d87898589866000015187602001516040516132f59695949392919061586d565b60405180910390a250505050505050565b60008111156133815760008290508073ffffffffffffffffffffffffffffffffffffffff166342966c68836040518263ffffffff1660e01b815260040161334d9190613f29565b600060405180830381600087803b15801561336757600080fd5b505af115801561337b573d6000803e3d6000fd5b50505050505b5050565b42600b81905550565b600080600354116133d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133cb90615921565b60405180910390fd5b60006133de613e0b565b60005b6003548110156135a757600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b8282101561352e5783829060005260206000209060020201604051806040016040529081600082018054613493906152a1565b80601f01602080910402602001604051908101604052809291908181526020018280546134bf906152a1565b801561350c5780601f106134e15761010080835404028352916020019161350c565b820191906000526020600020905b8154815290600101906020018083116134ef57829003601f168201915b5050505050815260200160018201548152505081526020019060010190613460565b5050505081525050915060008260a00151905060005b815181101561359257600082828151811061356257613561614d60565b5b6020026020010151905080602001518661357c9190614bef565b955050808061358a90614e83565b915050613544565b5050808061359f90614e83565b9150506133e1565b506064670de0b6b3a7640000612710846135c19190614c23565b6135cb9190614c23565b6135d59190614c94565b9250505090565b60008060005b6002548110156136e8576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff16151515158152505090508060800151836136d29190614bef565b92505080806136e090614e83565b9150506135e2565b508091505090565b6060600060028360026137039190614c23565b61370d9190614bef565b67ffffffffffffffff81111561372657613725614299565b5b6040519080825280601f01601f1916602001820160405280156137585781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106137905761378f614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106137f4576137f3614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026138349190614c23565b61383e9190614bef565b90505b60018111156138de577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106138805761387f614d60565b5b1a60f81b82828151811061389757613896614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806138d790615941565b9050613841565b5060008414613922576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613919906159b6565b60405180910390fd5b8091505092915050565b600080828411156139615782846139439190614a44565b600a61394f9190615b09565b8561395a9190614c94565b9050613987565b838361396d9190614a44565b600a6139799190615b09565b856139849190614c23565b90505b8581670de0b6b3a764000061399c9190614c23565b6139a69190614c94565b915050949350505050565b6139b9613df1565b60006003541180156139cd57506000600254115b613a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a0390615ba0565b60405180910390fd5b6000613a16613e0b565b60005b600354811015613c4c57600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b82821015613b665783829060005260206000209060020201604051806040016040529081600082018054613acb906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613af7906152a1565b8015613b445780601f10613b1957610100808354040283529160200191613b44565b820191906000526020600020905b815481529060010190602001808311613b2757829003601f168201915b5050505050815260200160018201548152505081526020019060010190613a98565b5050505081525050915060008260a00151905060005b8151811015613c37576000828281518110613b9a57613b99614d60565b5b60200260200101519050806020015186613bb49190614bef565b95506064670de0b6b3a764000061271088613bcf9190614c23565b613bd99190614c23565b613be39190614c94565b88613bec6135dc565b613bf69190614bef565b11613c2357828281518110613c0e57613c0d614d60565b5b60200260200101519650505050505050613d95565b508080613c2f90614e83565b915050613b7c565b50508080613c4490614e83565b915050613a19565b506000600960006001600354613c629190614a44565b8152602001908152602001600020600501805480602002602001604051908101604052809291908181526020016000905b82821015613d615783829060005260206000209060020201604051806040016040529081600082018054613cc6906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613cf2906152a1565b8015613d3f5780601f10613d1457610100808354040283529160200191613d3f565b820191906000526020600020905b815481529060010190602001808311613d2257829003601f168201915b5050505050815260200160018201548152505081526020019060010190613c93565b5050505090508060018251613d769190614a44565b81518110613d8757613d86614d60565b5b602002602001015193505050505b919050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b604051806040016040528060608152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613e8a81613e55565b8114613e9557600080fd5b50565b600081359050613ea781613e81565b92915050565b600060208284031215613ec357613ec2613e4b565b5b6000613ed184828501613e98565b91505092915050565b60008115159050919050565b613eef81613eda565b82525050565b6000602082019050613f0a6000830184613ee6565b92915050565b6000819050919050565b613f2381613f10565b82525050565b6000602082019050613f3e6000830184613f1a565b92915050565b613f4d81613f10565b8114613f5857600080fd5b50565b600081359050613f6a81613f44565b92915050565b600060208284031215613f8657613f85613e4b565b5b6000613f9484828501613f5b565b91505092915050565b600060a082019050613fb26000830188613f1a565b613fbf6020830187613f1a565b613fcc6040830186613f1a565b613fd96060830185613f1a565b613fe66080830184613f1a565b9695505050505050565b6000819050919050565b61400381613ff0565b811461400e57600080fd5b50565b60008135905061402081613ffa565b92915050565b60006020828403121561403c5761403b613e4b565b5b600061404a84828501614011565b91505092915050565b61405c81613ff0565b82525050565b60006020820190506140776000830184614053565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006140a88261407d565b9050919050565b6140b88161409d565b81146140c357600080fd5b50565b6000813590506140d5816140af565b92915050565b600080604083850312156140f2576140f1613e4b565b5b600061410085828601614011565b9250506020614111858286016140c6565b9150509250929050565b6141248161409d565b82525050565b61413381613f10565b82525050565b61414281613eda565b82525050565b60e08201600082015161415e600085018261411b565b506020820151614171602085018261412a565b506040820151614184604085018261412a565b506060820151614197606085018261412a565b5060808201516141aa608085018261412a565b5060a08201516141bd60a0850182614139565b5060c08201516141d060c0850182614139565b50505050565b600060e0820190506141eb6000830184614148565b92915050565b60006020828403121561420757614206613e4b565b5b6000614215848285016140c6565b91505092915050565b6004811061422b57600080fd5b50565b60008135905061423d8161421e565b92915050565b6000806040838503121561425a57614259613e4b565b5b600061426885828601613f5b565b92505060206142798582860161422e565b9150509250929050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6142d182614288565b810181811067ffffffffffffffff821117156142f0576142ef614299565b5b80604052505050565b6000614303613e41565b905061430f82826142c8565b919050565b600067ffffffffffffffff82111561432f5761432e614299565b5b602082029050602081019050919050565b600080fd5b600061435861435384614314565b6142f9565b9050808382526020820190506020840283018581111561437b5761437a614340565b5b835b818110156143a4578061439088826140c6565b84526020840193505060208101905061437d565b5050509392505050565b600082601f8301126143c3576143c2614283565b5b81356143d3848260208601614345565b91505092915050565b600281106143e957600080fd5b50565b6000813590506143fb816143dc565b92915050565b600067ffffffffffffffff82111561441c5761441b614299565b5b602082029050602081019050919050565b600080fd5b600067ffffffffffffffff82111561444d5761444c614299565b5b61445682614288565b9050602081019050919050565b82818337600083830152505050565b600061448561448084614432565b6142f9565b9050828152602081018484840111156144a1576144a061442d565b5b6144ac848285614463565b509392505050565b600082601f8301126144c9576144c8614283565b5b81356144d9848260208601614472565b91505092915050565b60006144f56144f084614401565b6142f9565b9050808382526020820190506020840283018581111561451857614517614340565b5b835b8181101561455f57803567ffffffffffffffff81111561453d5761453c614283565b5b80860161454a89826144b4565b8552602085019450505060208101905061451a565b5050509392505050565b600082601f83011261457e5761457d614283565b5b813561458e8482602086016144e2565b91505092915050565b6000806000606084860312156145b0576145af613e4b565b5b600084013567ffffffffffffffff8111156145ce576145cd613e50565b5b6145da868287016143ae565b93505060206145eb868287016143ec565b925050604084013567ffffffffffffffff81111561460c5761460b613e50565b5b61461886828701614569565b9150509250925092565b61462b8161409d565b82525050565b60006020820190506146466000830184614622565b92915050565b61465581613eda565b811461466057600080fd5b50565b6000813590506146728161464c565b92915050565b600080600080600060a0868803121561469457614693613e4b565b5b60006146a2888289016140c6565b95505060206146b388828901613f5b565b94505060406146c488828901613f5b565b93505060606146d588828901613f5b565b92505060806146e688828901614663565b9150509295509295909350565b600060e082019050614708600083018a614622565b6147156020830189613f1a565b6147226040830188613f1a565b61472f6060830187613f1a565b61473c6080830186613f1a565b61474960a0830185613ee6565b61475660c0830184613ee6565b98975050505050505050565b600067ffffffffffffffff82111561477d5761477c614299565b5b602082029050602081019050919050565b60006147a161479c84614762565b6142f9565b905080838252602082019050602084028301858111156147c4576147c3614340565b5b835b818110156147ed57806147d98882613f5b565b8452602084019350506020810190506147c6565b5050509392505050565b600082601f83011261480c5761480b614283565b5b813561481c84826020860161478e565b91505092915050565b600080600080600080600060e0888a03121561484457614843613e4b565b5b60006148528a828b01613f5b565b97505060206148638a828b01613f5b565b96505060406148748a828b01613f5b565b95505060606148858a828b01613f5b565b94505060806148968a828b01613f5b565b93505060a088013567ffffffffffffffff8111156148b7576148b6613e50565b5b6148c38a828b01614569565b92505060c088013567ffffffffffffffff8111156148e4576148e3613e50565b5b6148f08a828b016147f7565b91505092959891949750929550565b60006020828403121561491557614914613e4b565b5b60006149238482850161422e565b91505092915050565b600081905092915050565b7f53756241646d696e000000000000000000000000000000000000000000000000600082015250565b600061496d60088361492c565b915061497882614937565b600882019050919050565b600061498e82614960565b9150819050919050565b600082825260208201905092915050565b7f4f41000000000000000000000000000000000000000000000000000000000000600082015250565b60006149df600283614998565b91506149ea826149a9565b602082019050919050565b60006020820190508181036000830152614a0e816149d2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614a4f82613f10565b9150614a5a83613f10565b9250828203905081811115614a7257614a71614a15565b5b92915050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000614ad4602f83614998565b9150614adf82614a78565b604082019050919050565b60006020820190508181036000830152614b0381614ac7565b9050919050565b7f4541000000000000000000000000000000000000000000000000000000000000600082015250565b6000614b40600283614998565b9150614b4b82614b0a565b602082019050919050565b60006020820190508181036000830152614b6f81614b33565b9050919050565b6000606082019050614b8b6000830186614622565b614b986020830185614622565b614ba56040830184613f1a565b949350505050565b600081519050614bbc8161464c565b92915050565b600060208284031215614bd857614bd7613e4b565b5b6000614be684828501614bad565b91505092915050565b6000614bfa82613f10565b9150614c0583613f10565b9250828201905080821115614c1d57614c1c614a15565b5b92915050565b6000614c2e82613f10565b9150614c3983613f10565b9250828202614c4781613f10565b91508282048414831517614c5e57614c5d614a15565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614c9f82613f10565b9150614caa83613f10565b925082614cba57614cb9614c65565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6c656e677468206d69736d617463680000000000000000000000000000000000600082015250565b6000614d2a600f83614998565b9150614d3582614cf4565b602082019050919050565b60006020820190508181036000830152614d5981614d1d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60028110614da057614d9f614cc5565b5b50565b6000819050614db182614d8f565b919050565b6000614dc182614da3565b9050919050565b614dd181614db6565b82525050565b600081519050919050565b60005b83811015614e00578082015181840152602081019050614de5565b60008484015250505050565b6000614e1782614dd7565b614e218185614998565b9350614e31818560208601614de2565b614e3a81614288565b840191505092915050565b6000606082019050614e5a6000830186614dc8565b614e676020830185614622565b8181036040830152614e798184614e0c565b9050949350505050565b6000614e8e82613f10565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614ec057614ebf614a15565b5b600182019050919050565b7f4f4f000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f01600283614998565b9150614f0c82614ecb565b602082019050919050565b60006020820190508181036000830152614f3081614ef4565b9050919050565b7f4956000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f6d600283614998565b9150614f7882614f37565b602082019050919050565b60006020820190508181036000830152614f9c81614f60565b9050919050565b600081519050614fb281613f44565b92915050565b600060208284031215614fce57614fcd613e4b565b5b6000614fdc84828501614fa3565b91505092915050565b6000604082019050614ffa6000830185614622565b6150076020830184613f1a565b9392505050565b7f5245000000000000000000000000000000000000000000000000000000000000600082015250565b6000615044600283614998565b915061504f8261500e565b602082019050919050565b6000602082019050818103600083015261507381615037565b9050919050565b7f4e47420000000000000000000000000000000000000000000000000000000000600082015250565b60006150b0600383614998565b91506150bb8261507a565b602082019050919050565b600060208201905081810360008301526150df816150a3565b9050919050565b600060a0820190506150fb6000830188614622565b6151086020830187613f1a565b6151156040830186613f1a565b6151226060830185613f1a565b61512f6080830184613ee6565b9695505050505050565b7f526566696e657279000000000000000000000000000000000000000000000000600082015250565b600061516f60088361492c565b915061517a82615139565b600882019050919050565b600061519082615162565b9150819050919050565b7f4f52000000000000000000000000000000000000000000000000000000000000600082015250565b60006151d0600283614998565b91506151db8261519a565b602082019050919050565b600060208201905081810360008301526151ff816151c3565b9050919050565b7f696e76616c696420696e70757400000000000000000000000000000000000000600082015250565b600061523c600d83614998565b915061524782615206565b602082019050919050565b6000602082019050818103600083015261526b8161522f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806152b957607f821691505b6020821081036152cc576152cb615272565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026153347fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826152f7565b61533e86836152f7565b95508019841693508086168417925050509392505050565b6000819050919050565b600061537b61537661537184613f10565b615356565b613f10565b9050919050565b6000819050919050565b61539583615360565b6153a96153a182615382565b848454615304565b825550505050565b600090565b6153be6153b1565b6153c981848461538c565b505050565b5b818110156153ed576153e26000826153b6565b6001810190506153cf565b5050565b601f82111561543257615403816152d2565b61540c846152e7565b8101602085101561541b578190505b61542f615427856152e7565b8301826153ce565b50505b505050565b600082821c905092915050565b600061545560001984600802615437565b1980831691505092915050565b600061546e8383615444565b9150826002028217905092915050565b61548782614dd7565b67ffffffffffffffff8111156154a05761549f614299565b5b6154aa82546152a1565b6154b58282856153f1565b600060209050601f8311600181146154e857600084156154d6578287015190505b6154e08582615462565b865550615548565b601f1984166154f6866152d2565b60005b8281101561551e578489015182556001820191506020850194506020810190506154f9565b8683101561553b5784890151615537601f891682615444565b8355505b6001600288020188555050505b505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b600061558660178361492c565b915061559182615550565b601782019050919050565b60006155a782614dd7565b6155b1818561492c565b93506155c1818560208601614de2565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061560360118361492c565b915061560e826155cd565b601182019050919050565b600061562482615579565b9150615630828561559c565b915061563b826155f6565b9150615647828461559c565b91508190509392505050565b6000602082019050818103600083015261566d8184614e0c565b905092915050565b7f4731000000000000000000000000000000000000000000000000000000000000600082015250565b60006156ab600283614998565b91506156b682615675565b602082019050919050565b600060208201905081810360008301526156da8161569e565b9050919050565b7f4732000000000000000000000000000000000000000000000000000000000000600082015250565b6000615717600283614998565b9150615722826156e1565b602082019050919050565b600060208201905081810360008301526157468161570a565b9050919050565b7f53616c6520496e61637469766500000000000000000000000000000000000000600082015250565b6000615783600d83614998565b915061578e8261574d565b602082019050919050565b600060208201905081810360008301526157b281615776565b9050919050565b7f4733000000000000000000000000000000000000000000000000000000000000600082015250565b60006157ef600283614998565b91506157fa826157b9565b602082019050919050565b6000602082019050818103600083015261581e816157e2565b9050919050565b6004811061583657615835614cc5565b5b50565b600081905061584782615825565b919050565b600061585782615839565b9050919050565b6158678161584c565b82525050565b600060c082019050615882600083018961585e565b61588f6020830188613f1a565b61589c6040830187613f1a565b6158a96060830186613ee6565b81810360808301526158bb8185614e0c565b90506158ca60a0830184613f1a565b979650505050505050565b7f52434d0000000000000000000000000000000000000000000000000000000000600082015250565b600061590b600383614998565b9150615916826158d5565b602082019050919050565b6000602082019050818103600083015261593a816158fe565b9050919050565b600061594c82613f10565b91506000820361595f5761595e614a15565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006159a0602083614998565b91506159ab8261596a565b602082019050919050565b600060208201905081810360008301526159cf81615993565b9050919050565b60008160011c9050919050565b6000808291508390505b6001851115615a2d57808604811115615a0957615a08614a15565b5b6001851615615a185780820291505b8081029050615a26856159d6565b94506159ed565b94509492505050565b600082615a465760019050615b02565b81615a545760009050615b02565b8160018114615a6a5760028114615a7457615aa3565b6001915050615b02565b60ff841115615a8657615a85614a15565b5b8360020a915084821115615a9d57615a9c614a15565b5b50615b02565b5060208310610133831016604e8410600b8410161715615ad85782820a905083811115615ad357615ad2614a15565b5b615b02565b615ae584848460016159e3565b92509050818404811115615afc57615afb614a15565b5b81810290505b9392505050565b6000615b1482613f10565b9150615b1f83613f10565b9250615b4c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484615a36565b905092915050565b7f5243534d00000000000000000000000000000000000000000000000000000000600082015250565b6000615b8a600483614998565b9150615b9582615b54565b602082019050919050565b60006020820190508181036000830152615bb981615b7d565b905091905056fea2646970667358221220ed3431308cf882b95bbed9087bdf84a22e7e8f28fc2b4d5b721490d085ca02fc64736f6c63430008130033000000000000000000000000041b522ec77d4f4ffaefed196913fb7a60352575000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000001abaea1f7c830bd89acc67ec4af516284b1bc33c0000000000000000000000007ca0128701b0fbbe5f75aa9a750c8738d683b69c
|
6080604052600436106102305760003560e01c80638538142b1161012e578063bed7e1d8116100ab578063ce47d69a1161006f578063ce47d69a1461080e578063d547741f14610825578063da60fe8f1461084e578063f4651d5714610879578063f962a757146108a257610230565b8063bed7e1d814610751578063c1f1608b14610768578063c2c77c6614610791578063ca13d367146107ba578063cb315ef4146107e357610230565b8063a217fddf116100f2578063a217fddf14610687578063af6a909e146106b2578063b5440c31146106bc578063b5f522f7146106e5578063b9c4eb431461072857610230565b80638538142b146105a2578063853828b6146105df5780638a559fe3146105f657806391d148541461061f5780639af1d35a1461065c57610230565b80633887645b116101bc5780636e164b71116101805780636e164b71146104bd578063709334f3146104fa57806378dacee1146105255780637a8b69191461054e5780637da441c31461057757610230565b80633887645b146103da57806346cc599e146104055780634bb1ba82146104425780634ce58f151461046b5780635079399c1461049457610230565b8063211130361161020357806321113036146102df578063248a9ca3146103205780632f2ff15d1461035d57806336568abe146103865780633700cefb146103af57610230565b806301ffc9a714610235578063049c5c49146102725780630979f888146102895780630b97bc86146102b4575b600080fd5b34801561024157600080fd5b5061025c60048036038101906102579190613ead565b6108df565b6040516102699190613ef5565b60405180910390f35b34801561027e57600080fd5b50610287610959565b005b34801561029557600080fd5b5061029e610a30565b6040516102ab9190613f29565b60405180910390f35b3480156102c057600080fd5b506102c9610a36565b6040516102d69190613f29565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190613f70565b610a3c565b604051610317959493929190613f9d565b60405180910390f35b34801561032c57600080fd5b5061034760048036038101906103429190614026565b610a72565b6040516103549190614062565b60405180910390f35b34801561036957600080fd5b50610384600480360381019061037f91906140db565b610a91565b005b34801561039257600080fd5b506103ad60048036038101906103a891906140db565b610aba565b005b3480156103bb57600080fd5b506103c4610b3d565b6040516103d191906141d6565b60405180910390f35b3480156103e657600080fd5b506103ef610c47565b6040516103fc9190613f29565b60405180910390f35b34801561041157600080fd5b5061042c600480360381019061042791906141f1565b610c54565b6040516104399190613ef5565b60405180910390f35b34801561044e57600080fd5b5061046960048036038101906104649190613f70565b610c74565b005b34801561047757600080fd5b50610492600480360381019061048d9190614243565b610e26565b005b3480156104a057600080fd5b506104bb60048036038101906104b69190614597565b611040565b005b3480156104c957600080fd5b506104e460048036038101906104df9190613f70565b6113a7565b6040516104f19190614631565b60405180910390f35b34801561050657600080fd5b5061050f6113e6565b60405161051c9190613f29565b60405180910390f35b34801561053157600080fd5b5061054c60048036038101906105479190613f70565b6113ec565b005b34801561055a57600080fd5b50610575600480360381019061057091906141f1565b611485565b005b34801561058357600080fd5b5061058c611515565b6040516105999190614631565b60405180910390f35b3480156105ae57600080fd5b506105c960048036038101906105c49190613f70565b61153b565b6040516105d69190614631565b60405180910390f35b3480156105eb57600080fd5b506105f461157a565b005b34801561060257600080fd5b5061061d60048036038101906106189190613f70565b611b03565b005b34801561062b57600080fd5b50610646600480360381019061064191906140db565b611b8e565b6040516106539190613ef5565b60405180910390f35b34801561066857600080fd5b50610671611bf8565b60405161067e9190613f29565b60405180910390f35b34801561069357600080fd5b5061069c611bfe565b6040516106a99190614062565b60405180910390f35b6106ba611c05565b005b3480156106c857600080fd5b506106e360048036038101906106de9190614678565b611d46565b005b3480156106f157600080fd5b5061070c60048036038101906107079190613f70565b6121a3565b60405161071f97969594939291906146f3565b60405180910390f35b34801561073457600080fd5b5061074f600480360381019061074a91906141f1565b61221f565b005b34801561075d57600080fd5b506107666122ff565b005b34801561077457600080fd5b5061078f600480360381019061078a91906141f1565b6123d6565b005b34801561079d57600080fd5b506107b860048036038101906107b391906141f1565b612453565b005b3480156107c657600080fd5b506107e160048036038101906107dc9190614825565b612533565b005b3480156107ef57600080fd5b506107f8612719565b6040516108059190613f29565b60405180910390f35b34801561081a57600080fd5b50610823612726565b005b34801561083157600080fd5b5061084c600480360381019061084791906140db565b61277c565b005b34801561085a57600080fd5b506108636127a5565b6040516108709190613f29565b60405180910390f35b34801561088557600080fd5b506108a0600480360381019061089b91906141f1565b6127ab565b005b3480156108ae57600080fd5b506108c960048036038101906108c491906148ff565b612828565b6040516108d69190614631565b60405180910390f35b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061095257506109518261285b565b5b9050919050565b6109666000801b33611b8e565b8061099b575061099a60405160200161097e90614983565b6040516020818303038152906040528051906020012033611b8e565b5b6109da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d1906149f5565b60405180910390fd5b60006008600060016002546109ef9190614a44565b815260200190815260200160002090508060050160009054906101000a900460ff16158160050160006101000a81548160ff02191690831515021790555050565b60035481565b600b5481565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b6000806000838152602001908152602001600020600101549050919050565b610a9a82610a72565b610aab81610aa66128c5565b6128cd565b610ab5838361296a565b505050565b610ac26128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2690614aea565b60405180910390fd5b610b398282612a4a565b5050565b610b45613d9a565b610b4d613d9a565b600060025403610b605780915050610c44565b600860006001600254610b739190614a44565b81526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509150505b90565b6000600680549050905090565b60056020528060005260406000206000915054906101000a900460ff1681565b610c816000801b33611b8e565b80610cb65750610cb5604051602001610c9990614983565b6040516020818303038152906040528051906020012033611b8e565b5b610cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cec906149f5565b60405180910390fd5b610cfe81612b2b565b610d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3490614b56565b60405180910390fd5b6000600860006001600254610d529190614a44565b815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610dc393929190614b76565b6020604051808303816000875af1158015610de2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e069190614bc2565b5081816003016000828254610e1b9190614bef565b925050819055505050565b6000612710600c5484610e399190614c23565b610e439190614c94565b83610e4e9190614a44565b905060016000836003811115610e6757610e66614cc5565b5b6003811115610e7957610e78614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401610ee493929190614b76565b6020604051808303816000875af1158015610f03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f279190614bc2565b506000600860006001600254610f3d9190614a44565b81526020019081526020016000209050611015816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b61101e57600080fd5b61103a82848360050160019054906101000a900460ff16612d87565b50505050565b61104d6000801b33611b8e565b80611082575061108160405160200161106590614983565b6040516020818303038152906040528051906020012033611b8e565b5b6110c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b8906149f5565b60405180910390fd5b600083511180156110d3575080518351145b611112576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110990614d40565b60405180910390fd5b81600181111561112557611124614cc5565b5b6000600181111561113957611138614cc5565b5b0361125c5760005b83518110156112565760016005600086848151811061116357611162614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508381815181106111cf576111ce614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460003385858151811061122457611223614d60565b5b602002602001015160405161123b93929190614e45565b60405180910390a2808061124e90614e83565b915050611141565b506113a2565b81600181111561126f5761126e614cc5565b5b60018081111561128257611281614cc5565b5b036113a15760005b835181101561139f576000600560008684815181106112ac576112ab614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555083818151811061131857611317614d60565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f914f148e65ceb74618f47cae19edfaaa0d0c2624c777c498b2e2f4ac53d241c460013385858151811061136d5761136c614d60565b5b602002602001015160405161138493929190614e45565b60405180910390a2808061139790614e83565b91505061128a565b505b5b505050565b600781815481106113b757600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6113f96000801b33611b8e565b611438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142f90614f17565b60405180910390fd5b6000811161147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147290614f83565b60405180910390fd5b80600c8190555050565b6114926000801b33611b8e565b6114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614f17565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6006818154811061154b57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6115876000801b33611b8e565b6115c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bd90614f17565b60405180910390fd5b600160006003808111156115dd576115dc614cc5565b5b60038111156115ef576115ee614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336001600060038081111561165157611650614cc5565b5b600381111561166357611662614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116ca9190614631565b602060405180830381865afa1580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b9190614fb8565b6040518363ffffffff1660e01b8152600401611728929190614fe5565b6020604051808303816000875af1158015611747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176b9190614bc2565b506001600080600381111561178357611782614cc5565b5b600381111561179557611794614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160008060038111156117f7576117f6614cc5565b5b600381111561180957611808614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016118709190614631565b602060405180830381865afa15801561188d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b19190614fb8565b6040518363ffffffff1660e01b81526004016118ce929190614fe5565b6020604051808303816000875af11580156118ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119119190614bc2565b50600160006001600381111561192a57611929614cc5565b5b600381111561193c5761193b614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600160006001600381111561199f5761199e614cc5565b5b60038111156119b1576119b0614cc5565b5b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611a189190614631565b602060405180830381865afa158015611a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a599190614fb8565b6040518363ffffffff1660e01b8152600401611a76929190614fe5565b6020604051808303816000875af1158015611a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab99190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611b00573d6000803e3d6000fd5b50565b611b106000801b33611b8e565b80611b455750611b44604051602001611b2890614983565b6040516020818303038152906040528051906020012033611b8e565b5b611b84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7b906149f5565b60405180910390fd5b80600a8190555050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600c5481565b6000801b81565b6000612710600c5434611c189190614c23565b611c229190614c94565b34611c2d9190614a44565b90506000600860006001600254611c449190614a44565b81526020019081526020016000209050611d1c816040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff161515151581525050612d1e565b611d2557600080fd5b611d428260028360050160019054906101000a900460ff16612d87565b5050565b611d536000801b33611b8e565b80611d885750611d87604051602001611d6b90614983565b6040516020818303038152906040528051906020012033611b8e565b5b611dc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbe906149f5565b60405180910390fd5b611dd082612b2b565b611e0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0690614b56565b60405180910390fd5b600060035411611e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4b9061505a565b60405180910390fd5b600060025414611f6a57611f69600860006001600254611e749190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860006001600254611eb99190614a44565b815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611f239190614631565b602060405180830381865afa158015611f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f649190614fb8565b613306565b5b60006008600060025481526020019081526020016000209050858160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084816001018190555083816002018190555082816003018190555060018160050160006101000a81548160ff021916908315150217905550818160050160016101000a81548160ff0219169083151502179055506301e13380600b5461202c9190614bef565b816001015411156120405761203f613385565b5b61204861338e565b6120506135dc565b8461205b9190614bef565b111561209c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612093906150c6565b60405180910390fd5b8060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b81526004016120fd93929190614b76565b6020604051808303816000875af115801561211c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121409190614bc2565b506002547fef6707848cac12824ef51fe16d76a210e3558daae9d1a56675945774d2c1ca9a878787878760405161217b9594939291906150e6565b60405180910390a26002600081548092919061219690614e83565b9190505550505050505050565b60086020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040154908060050160009054906101000a900460ff16908060050160019054906101000a900460ff16905087565b61222c6000801b33611b8e565b61226b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226290614f17565b60405180910390fd5b61229960405160200161227d90614983565b6040516020818303038152906040528051906020012082610a91565b6007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61230c6000801b33611b8e565b80612341575061234060405160200161232490614983565b6040516020818303038152906040528051906020012033611b8e565b5b612380576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612377906149f5565b60405180910390fd5b60006008600060016002546123959190614a44565b815260200190815260200160002090508060050160019054906101000a900460ff16158160050160016101000a81548160ff02191690831515021790555050565b6123e36000801b33611b8e565b612422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241990614f17565b60405180910390fd5b61245060405160200161243490615185565b604051602081830303815290604052805190602001208261277c565b50565b6124606000801b33611b8e565b61249f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161249690614f17565b60405180910390fd5b6124cd6040516020016124b190615185565b6040516020818303038152906040528051906020012082610a91565b6006819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61256160405160200161254590615185565b6040516020818303038152906040528051906020012033611b8e565b6125a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612597906151e6565b60405180910390fd5b600082511180156125b2575060008151115b6125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890615252565b60405180910390fd5b6000600960006003548152602001908152602001600020905087816000018190555086816001018190555085816003018190555084816004018190555083816002018190555060005b83518110156126f65761264b613df1565b83828151811061265e5761265d614d60565b5b602002602001015181602001818152505084828151811061268257612681614d60565b5b602002602001015181600001819052508260050181908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000190816126d5919061547e565b506020820151816001015550505080806126ee90614e83565b91505061263a565b506003600081548092919061270a90614e83565b91905055505050505050505050565b6000600780549050905090565b6127336000801b33611b8e565b612772576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276990614f17565b60405180910390fd5b61277a613385565b565b61278582610a72565b612796816127916128c5565b6128cd565b6127a08383612a4a565b505050565b600a5481565b6127b86000801b33611b8e565b6127f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ee90614f17565b60405180910390fd5b61282560405160200161280990614983565b604051602081830303815290604052805190602001208261277c565b50565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b6128d78282611b8e565b612966576128fc8173ffffffffffffffffffffffffffffffffffffffff1660146136f0565b61290a8360001c60206136f0565b60405160200161291b929190615619565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161295d9190615653565b60405180910390fd5b5050565b6129748282611b8e565b612a4657600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506129eb6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b612a548282611b8e565b15612b2757600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550612acc6128c5565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060025403612b67576001915050612d19565b6000805b600254811015612c7f576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff1615151515815250509050600b54816020015110612c6b57806060015183612c689190614bef565b92505b508080612c7790614e83565b915050612b6b565b508381612c8c9190614bef565b90506000612d0d8373ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d029190614fb8565b600a5460128061392c565b90508082111593505050505b919050565b60008160c00151612d325760019050612d82565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690505b919050565b600083118015612d9957506000600254115b612dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dcf906156c1565b60405180910390fd5b6000600860006001600254612ded9190614a44565b8152602001908152602001600020905080600101544210158015612e15575080600201544211155b612e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4b9061572d565b60405180910390fd5b8060050160009054906101000a900460ff16612ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e9c90615799565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000846003811115612ee157612ee0614cc5565b5b60006003811115612ef557612ef4614cc5565b5b03612f7d57612f768273ffffffffffffffffffffffffffffffffffffffff1663d8f1d7ea6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6c9190614fb8565b876006601261392c565b9050613187565b846003811115612f9057612f8f614cc5565b5b60016003811115612fa457612fa3614cc5565b5b0361302c576130258273ffffffffffffffffffffffffffffffffffffffff1663b77d2a1d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301b9190614fb8565b876006601261392c565b9050613186565b84600381111561303f5761303e614cc5565b5b60038081111561305257613051614cc5565b5b036130da576130d38273ffffffffffffffffffffffffffffffffffffffff16630a161a0c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c99190614fb8565b876006601261392c565b9050613185565b8460038111156130ed576130ec614cc5565b5b6002600381111561310157613100614cc5565b5b03613184576131818273ffffffffffffffffffffffffffffffffffffffff1663027480e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015613154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131789190614fb8565b8760128061392c565b90505b5b5b5b6000613192826139b1565b9050818460040160008282546131a89190614bef565b925050819055508360030154846004015411156131fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131f190615805565b60405180910390fd5b8360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401613259929190614fe5565b6020604051808303816000875af1158015613278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329c9190614bc2565b503373ffffffffffffffffffffffffffffffffffffffff167f9c0381305bbf7da8ed16753de32983d70bbb06100f82ff8a8b6f1d598cd4525d87898589866000015187602001516040516132f59695949392919061586d565b60405180910390a250505050505050565b60008111156133815760008290508073ffffffffffffffffffffffffffffffffffffffff166342966c68836040518263ffffffff1660e01b815260040161334d9190613f29565b600060405180830381600087803b15801561336757600080fd5b505af115801561337b573d6000803e3d6000fd5b50505050505b5050565b42600b81905550565b600080600354116133d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133cb90615921565b60405180910390fd5b60006133de613e0b565b60005b6003548110156135a757600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b8282101561352e5783829060005260206000209060020201604051806040016040529081600082018054613493906152a1565b80601f01602080910402602001604051908101604052809291908181526020018280546134bf906152a1565b801561350c5780601f106134e15761010080835404028352916020019161350c565b820191906000526020600020905b8154815290600101906020018083116134ef57829003601f168201915b5050505050815260200160018201548152505081526020019060010190613460565b5050505081525050915060008260a00151905060005b815181101561359257600082828151811061356257613561614d60565b5b6020026020010151905080602001518661357c9190614bef565b955050808061358a90614e83565b915050613544565b5050808061359f90614e83565b9150506133e1565b506064670de0b6b3a7640000612710846135c19190614c23565b6135cb9190614c23565b6135d59190614c94565b9250505090565b60008060005b6002548110156136e8576000600860008381526020019081526020016000206040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff16151515158152505090508060800151836136d29190614bef565b92505080806136e090614e83565b9150506135e2565b508091505090565b6060600060028360026137039190614c23565b61370d9190614bef565b67ffffffffffffffff81111561372657613725614299565b5b6040519080825280601f01601f1916602001820160405280156137585781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106137905761378f614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106137f4576137f3614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026138349190614c23565b61383e9190614bef565b90505b60018111156138de577f3031323334353637383961626364656600000000000000000000000000000000600f8616601081106138805761387f614d60565b5b1a60f81b82828151811061389757613896614d60565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806138d790615941565b9050613841565b5060008414613922576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613919906159b6565b60405180910390fd5b8091505092915050565b600080828411156139615782846139439190614a44565b600a61394f9190615b09565b8561395a9190614c94565b9050613987565b838361396d9190614a44565b600a6139799190615b09565b856139849190614c23565b90505b8581670de0b6b3a764000061399c9190614c23565b6139a69190614c94565b915050949350505050565b6139b9613df1565b60006003541180156139cd57506000600254115b613a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a0390615ba0565b60405180910390fd5b6000613a16613e0b565b60005b600354811015613c4c57600960008281526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201805480602002602001604051908101604052809291908181526020016000905b82821015613b665783829060005260206000209060020201604051806040016040529081600082018054613acb906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613af7906152a1565b8015613b445780601f10613b1957610100808354040283529160200191613b44565b820191906000526020600020905b815481529060010190602001808311613b2757829003601f168201915b5050505050815260200160018201548152505081526020019060010190613a98565b5050505081525050915060008260a00151905060005b8151811015613c37576000828281518110613b9a57613b99614d60565b5b60200260200101519050806020015186613bb49190614bef565b95506064670de0b6b3a764000061271088613bcf9190614c23565b613bd99190614c23565b613be39190614c94565b88613bec6135dc565b613bf69190614bef565b11613c2357828281518110613c0e57613c0d614d60565b5b60200260200101519650505050505050613d95565b508080613c2f90614e83565b915050613b7c565b50508080613c4490614e83565b915050613a19565b506000600960006001600354613c629190614a44565b8152602001908152602001600020600501805480602002602001604051908101604052809291908181526020016000905b82821015613d615783829060005260206000209060020201604051806040016040529081600082018054613cc6906152a1565b80601f0160208091040260200160405190810160405280929190818152602001828054613cf2906152a1565b8015613d3f5780601f10613d1457610100808354040283529160200191613d3f565b820191906000526020600020905b815481529060010190602001808311613d2257829003601f168201915b5050505050815260200160018201548152505081526020019060010190613c93565b5050505090508060018251613d769190614a44565b81518110613d8757613d86614d60565b5b602002602001015193505050505b919050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b604051806040016040528060608152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613e8a81613e55565b8114613e9557600080fd5b50565b600081359050613ea781613e81565b92915050565b600060208284031215613ec357613ec2613e4b565b5b6000613ed184828501613e98565b91505092915050565b60008115159050919050565b613eef81613eda565b82525050565b6000602082019050613f0a6000830184613ee6565b92915050565b6000819050919050565b613f2381613f10565b82525050565b6000602082019050613f3e6000830184613f1a565b92915050565b613f4d81613f10565b8114613f5857600080fd5b50565b600081359050613f6a81613f44565b92915050565b600060208284031215613f8657613f85613e4b565b5b6000613f9484828501613f5b565b91505092915050565b600060a082019050613fb26000830188613f1a565b613fbf6020830187613f1a565b613fcc6040830186613f1a565b613fd96060830185613f1a565b613fe66080830184613f1a565b9695505050505050565b6000819050919050565b61400381613ff0565b811461400e57600080fd5b50565b60008135905061402081613ffa565b92915050565b60006020828403121561403c5761403b613e4b565b5b600061404a84828501614011565b91505092915050565b61405c81613ff0565b82525050565b60006020820190506140776000830184614053565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006140a88261407d565b9050919050565b6140b88161409d565b81146140c357600080fd5b50565b6000813590506140d5816140af565b92915050565b600080604083850312156140f2576140f1613e4b565b5b600061410085828601614011565b9250506020614111858286016140c6565b9150509250929050565b6141248161409d565b82525050565b61413381613f10565b82525050565b61414281613eda565b82525050565b60e08201600082015161415e600085018261411b565b506020820151614171602085018261412a565b506040820151614184604085018261412a565b506060820151614197606085018261412a565b5060808201516141aa608085018261412a565b5060a08201516141bd60a0850182614139565b5060c08201516141d060c0850182614139565b50505050565b600060e0820190506141eb6000830184614148565b92915050565b60006020828403121561420757614206613e4b565b5b6000614215848285016140c6565b91505092915050565b6004811061422b57600080fd5b50565b60008135905061423d8161421e565b92915050565b6000806040838503121561425a57614259613e4b565b5b600061426885828601613f5b565b92505060206142798582860161422e565b9150509250929050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6142d182614288565b810181811067ffffffffffffffff821117156142f0576142ef614299565b5b80604052505050565b6000614303613e41565b905061430f82826142c8565b919050565b600067ffffffffffffffff82111561432f5761432e614299565b5b602082029050602081019050919050565b600080fd5b600061435861435384614314565b6142f9565b9050808382526020820190506020840283018581111561437b5761437a614340565b5b835b818110156143a4578061439088826140c6565b84526020840193505060208101905061437d565b5050509392505050565b600082601f8301126143c3576143c2614283565b5b81356143d3848260208601614345565b91505092915050565b600281106143e957600080fd5b50565b6000813590506143fb816143dc565b92915050565b600067ffffffffffffffff82111561441c5761441b614299565b5b602082029050602081019050919050565b600080fd5b600067ffffffffffffffff82111561444d5761444c614299565b5b61445682614288565b9050602081019050919050565b82818337600083830152505050565b600061448561448084614432565b6142f9565b9050828152602081018484840111156144a1576144a061442d565b5b6144ac848285614463565b509392505050565b600082601f8301126144c9576144c8614283565b5b81356144d9848260208601614472565b91505092915050565b60006144f56144f084614401565b6142f9565b9050808382526020820190506020840283018581111561451857614517614340565b5b835b8181101561455f57803567ffffffffffffffff81111561453d5761453c614283565b5b80860161454a89826144b4565b8552602085019450505060208101905061451a565b5050509392505050565b600082601f83011261457e5761457d614283565b5b813561458e8482602086016144e2565b91505092915050565b6000806000606084860312156145b0576145af613e4b565b5b600084013567ffffffffffffffff8111156145ce576145cd613e50565b5b6145da868287016143ae565b93505060206145eb868287016143ec565b925050604084013567ffffffffffffffff81111561460c5761460b613e50565b5b61461886828701614569565b9150509250925092565b61462b8161409d565b82525050565b60006020820190506146466000830184614622565b92915050565b61465581613eda565b811461466057600080fd5b50565b6000813590506146728161464c565b92915050565b600080600080600060a0868803121561469457614693613e4b565b5b60006146a2888289016140c6565b95505060206146b388828901613f5b565b94505060406146c488828901613f5b565b93505060606146d588828901613f5b565b92505060806146e688828901614663565b9150509295509295909350565b600060e082019050614708600083018a614622565b6147156020830189613f1a565b6147226040830188613f1a565b61472f6060830187613f1a565b61473c6080830186613f1a565b61474960a0830185613ee6565b61475660c0830184613ee6565b98975050505050505050565b600067ffffffffffffffff82111561477d5761477c614299565b5b602082029050602081019050919050565b60006147a161479c84614762565b6142f9565b905080838252602082019050602084028301858111156147c4576147c3614340565b5b835b818110156147ed57806147d98882613f5b565b8452602084019350506020810190506147c6565b5050509392505050565b600082601f83011261480c5761480b614283565b5b813561481c84826020860161478e565b91505092915050565b600080600080600080600060e0888a03121561484457614843613e4b565b5b60006148528a828b01613f5b565b97505060206148638a828b01613f5b565b96505060406148748a828b01613f5b565b95505060606148858a828b01613f5b565b94505060806148968a828b01613f5b565b93505060a088013567ffffffffffffffff8111156148b7576148b6613e50565b5b6148c38a828b01614569565b92505060c088013567ffffffffffffffff8111156148e4576148e3613e50565b5b6148f08a828b016147f7565b91505092959891949750929550565b60006020828403121561491557614914613e4b565b5b60006149238482850161422e565b91505092915050565b600081905092915050565b7f53756241646d696e000000000000000000000000000000000000000000000000600082015250565b600061496d60088361492c565b915061497882614937565b600882019050919050565b600061498e82614960565b9150819050919050565b600082825260208201905092915050565b7f4f41000000000000000000000000000000000000000000000000000000000000600082015250565b60006149df600283614998565b91506149ea826149a9565b602082019050919050565b60006020820190508181036000830152614a0e816149d2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614a4f82613f10565b9150614a5a83613f10565b9250828203905081811115614a7257614a71614a15565b5b92915050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000614ad4602f83614998565b9150614adf82614a78565b604082019050919050565b60006020820190508181036000830152614b0381614ac7565b9050919050565b7f4541000000000000000000000000000000000000000000000000000000000000600082015250565b6000614b40600283614998565b9150614b4b82614b0a565b602082019050919050565b60006020820190508181036000830152614b6f81614b33565b9050919050565b6000606082019050614b8b6000830186614622565b614b986020830185614622565b614ba56040830184613f1a565b949350505050565b600081519050614bbc8161464c565b92915050565b600060208284031215614bd857614bd7613e4b565b5b6000614be684828501614bad565b91505092915050565b6000614bfa82613f10565b9150614c0583613f10565b9250828201905080821115614c1d57614c1c614a15565b5b92915050565b6000614c2e82613f10565b9150614c3983613f10565b9250828202614c4781613f10565b91508282048414831517614c5e57614c5d614a15565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614c9f82613f10565b9150614caa83613f10565b925082614cba57614cb9614c65565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f6c656e677468206d69736d617463680000000000000000000000000000000000600082015250565b6000614d2a600f83614998565b9150614d3582614cf4565b602082019050919050565b60006020820190508181036000830152614d5981614d1d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60028110614da057614d9f614cc5565b5b50565b6000819050614db182614d8f565b919050565b6000614dc182614da3565b9050919050565b614dd181614db6565b82525050565b600081519050919050565b60005b83811015614e00578082015181840152602081019050614de5565b60008484015250505050565b6000614e1782614dd7565b614e218185614998565b9350614e31818560208601614de2565b614e3a81614288565b840191505092915050565b6000606082019050614e5a6000830186614dc8565b614e676020830185614622565b8181036040830152614e798184614e0c565b9050949350505050565b6000614e8e82613f10565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614ec057614ebf614a15565b5b600182019050919050565b7f4f4f000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f01600283614998565b9150614f0c82614ecb565b602082019050919050565b60006020820190508181036000830152614f3081614ef4565b9050919050565b7f4956000000000000000000000000000000000000000000000000000000000000600082015250565b6000614f6d600283614998565b9150614f7882614f37565b602082019050919050565b60006020820190508181036000830152614f9c81614f60565b9050919050565b600081519050614fb281613f44565b92915050565b600060208284031215614fce57614fcd613e4b565b5b6000614fdc84828501614fa3565b91505092915050565b6000604082019050614ffa6000830185614622565b6150076020830184613f1a565b9392505050565b7f5245000000000000000000000000000000000000000000000000000000000000600082015250565b6000615044600283614998565b915061504f8261500e565b602082019050919050565b6000602082019050818103600083015261507381615037565b9050919050565b7f4e47420000000000000000000000000000000000000000000000000000000000600082015250565b60006150b0600383614998565b91506150bb8261507a565b602082019050919050565b600060208201905081810360008301526150df816150a3565b9050919050565b600060a0820190506150fb6000830188614622565b6151086020830187613f1a565b6151156040830186613f1a565b6151226060830185613f1a565b61512f6080830184613ee6565b9695505050505050565b7f526566696e657279000000000000000000000000000000000000000000000000600082015250565b600061516f60088361492c565b915061517a82615139565b600882019050919050565b600061519082615162565b9150819050919050565b7f4f52000000000000000000000000000000000000000000000000000000000000600082015250565b60006151d0600283614998565b91506151db8261519a565b602082019050919050565b600060208201905081810360008301526151ff816151c3565b9050919050565b7f696e76616c696420696e70757400000000000000000000000000000000000000600082015250565b600061523c600d83614998565b915061524782615206565b602082019050919050565b6000602082019050818103600083015261526b8161522f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806152b957607f821691505b6020821081036152cc576152cb615272565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026153347fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826152f7565b61533e86836152f7565b95508019841693508086168417925050509392505050565b6000819050919050565b600061537b61537661537184613f10565b615356565b613f10565b9050919050565b6000819050919050565b61539583615360565b6153a96153a182615382565b848454615304565b825550505050565b600090565b6153be6153b1565b6153c981848461538c565b505050565b5b818110156153ed576153e26000826153b6565b6001810190506153cf565b5050565b601f82111561543257615403816152d2565b61540c846152e7565b8101602085101561541b578190505b61542f615427856152e7565b8301826153ce565b50505b505050565b600082821c905092915050565b600061545560001984600802615437565b1980831691505092915050565b600061546e8383615444565b9150826002028217905092915050565b61548782614dd7565b67ffffffffffffffff8111156154a05761549f614299565b5b6154aa82546152a1565b6154b58282856153f1565b600060209050601f8311600181146154e857600084156154d6578287015190505b6154e08582615462565b865550615548565b601f1984166154f6866152d2565b60005b8281101561551e578489015182556001820191506020850194506020810190506154f9565b8683101561553b5784890151615537601f891682615444565b8355505b6001600288020188555050505b505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b600061558660178361492c565b915061559182615550565b601782019050919050565b60006155a782614dd7565b6155b1818561492c565b93506155c1818560208601614de2565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061560360118361492c565b915061560e826155cd565b601182019050919050565b600061562482615579565b9150615630828561559c565b915061563b826155f6565b9150615647828461559c565b91508190509392505050565b6000602082019050818103600083015261566d8184614e0c565b905092915050565b7f4731000000000000000000000000000000000000000000000000000000000000600082015250565b60006156ab600283614998565b91506156b682615675565b602082019050919050565b600060208201905081810360008301526156da8161569e565b9050919050565b7f4732000000000000000000000000000000000000000000000000000000000000600082015250565b6000615717600283614998565b9150615722826156e1565b602082019050919050565b600060208201905081810360008301526157468161570a565b9050919050565b7f53616c6520496e61637469766500000000000000000000000000000000000000600082015250565b6000615783600d83614998565b915061578e8261574d565b602082019050919050565b600060208201905081810360008301526157b281615776565b9050919050565b7f4733000000000000000000000000000000000000000000000000000000000000600082015250565b60006157ef600283614998565b91506157fa826157b9565b602082019050919050565b6000602082019050818103600083015261581e816157e2565b9050919050565b6004811061583657615835614cc5565b5b50565b600081905061584782615825565b919050565b600061585782615839565b9050919050565b6158678161584c565b82525050565b600060c082019050615882600083018961585e565b61588f6020830188613f1a565b61589c6040830187613f1a565b6158a96060830186613ee6565b81810360808301526158bb8185614e0c565b90506158ca60a0830184613f1a565b979650505050505050565b7f52434d0000000000000000000000000000000000000000000000000000000000600082015250565b600061590b600383614998565b9150615916826158d5565b602082019050919050565b6000602082019050818103600083015261593a816158fe565b9050919050565b600061594c82613f10565b91506000820361595f5761595e614a15565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006159a0602083614998565b91506159ab8261596a565b602082019050919050565b600060208201905081810360008301526159cf81615993565b9050919050565b60008160011c9050919050565b6000808291508390505b6001851115615a2d57808604811115615a0957615a08614a15565b5b6001851615615a185780820291505b8081029050615a26856159d6565b94506159ed565b94509492505050565b600082615a465760019050615b02565b81615a545760009050615b02565b8160018114615a6a5760028114615a7457615aa3565b6001915050615b02565b60ff841115615a8657615a85614a15565b5b8360020a915084821115615a9d57615a9c614a15565b5b50615b02565b5060208310610133831016604e8410600b8410161715615ad85782820a905083811115615ad357615ad2614a15565b5b615b02565b615ae584848460016159e3565b92509050818404811115615afc57615afb614a15565b5b81810290505b9392505050565b6000615b1482613f10565b9150615b1f83613f10565b9250615b4c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484615a36565b905092915050565b7f5243534d00000000000000000000000000000000000000000000000000000000600082015250565b6000615b8a600483614998565b9150615b9582615b54565b602082019050919050565b60006020820190508181036000830152615bb981615b7d565b905091905056fea2646970667358221220ed3431308cf882b95bbed9087bdf84a22e7e8f28fc2b4d5b721490d085ca02fc64736f6c63430008130033
| |
1 | 20,290,293 |
4e527d9fc132bb532ee1cbe0189362104b6177df7cde5af1c5c557e5e507b5d5
|
f18bd5d2ffd384054ee42baa6b11a4e356bf5751b2d114144baba72949da3f95
|
67e5855aa4d5786c086b7fc6b4203a5ea50e93f8
|
67e5855aa4d5786c086b7fc6b4203a5ea50e93f8
|
d60899683383e53ab8807f0cd34e3a6dd6df66a3
|
60e0346100f357601f6114b038819003918201601f19168301916001600160401b038311848410176100f8578084926060946040528339810103126100f3576100478161010e565b9061006060406100596020840161010e565b920161010e565b60809290925260a05260008054336001600160a01b0319821681178355604051936001600160a01b039390928416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a31660c05261138d908161012382396080518181816102a6015261065a015260a05181818161078301526111f9015260c0518181816108960152610edb0152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100f35756fe6080604052600436101561001257600080fd5b60003560e01c8062d34411146100f65780631073f93d146100f1578063121d523e146100ec57806315b75bea146100e75780633687f24a146100e25780636ad889b7146100dd578063715018a6146100d85780638da5cb5b146100d35780639ac41b98146100ce5780639e83334b146100c9578063b4a90ff7146100c4578063d3710343146100bf578063ddca3f43146100ba5763f2fde38b146100b557600080fd5b6108ea565b6108ba565b610869565b6107a7565b610756565b6105c7565b61051d565b61049b565b610469565b6103dc565b610373565b6102ca565b610279565b610212565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761014657604052565b6100fb565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761014657604052565b6040519060a0820182811067ffffffffffffffff82111761014657604052565b60005b8381106101bf5750506000910152565b81810151838201526020016101af565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209361020b815180928187528780880191016101ac565b0116010190565b34610274576000600319360112610274576102706040516102328161012a565b600a81527f6c617965722d7a65726f0000000000000000000000000000000000000000000060208201526040519182916020835260208301906101cf565b0390f35b600080fd5b3461027457600060031936011261027457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346102745760406003193601126102745760043560243563ffffffff8116809103610274576102f7610a05565b600091808352600160205260408320827fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000008254161790557f11186c81a030f629870a38c451f20ce4f00ecbad9442ec3ff4e0491cd7a0993e8380a380f35b73ffffffffffffffffffffffffffffffffffffffff81160361027457565b346102745760206003193601126102745773ffffffffffffffffffffffffffffffffffffffff6004356103a581610355565b6103ad610a05565b167fffffffffffffffffffffffff00000000000000000000000000000000000000006003541617600355600080f35b34610274576020600319360112610274576004356fffffffffffffffffffffffffffffffff81168091036102745760207f20461e09b8e557b77e107939f9ce6544698123aad0fc964ac5cc59b7df2e608f91610436610a05565b807fffffffffffffffffffffffffffffffff000000000000000000000000000000006002541617600255604051908152a1005b34610274576020600319360112610274576004356000526001602052602063ffffffff60406000205416604051908152f35b346102745760008060031936011261051a576104b5610a05565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b3461027457600060031936011261027457602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b67ffffffffffffffff81116101465760051b60200190565b81601f820112156102745780359161058083610551565b9261058e604051948561014b565b808452602092838086019260051b820101928311610274578301905b8282106105b8575050505090565b813581529083019083016105aa565b6060600319360112610274576004356024356105e281610355565b60443567ffffffffffffffff811161027457610602903690600401610569565b906040928351917fceee6e550000000000000000000000000000000000000000000000000000000083528261063a8560048301610b32565b039360008473ffffffffffffffffffffffffffffffffffffffff968183897f0000000000000000000000000000000000000000000000000000000000000000165af19384156107515760009461072e575b5060005b815181101561070c57806106a560019284610b52565b51857fdfde4db189423e6f919a3d3cb1306e03dc18b4e72bc0c6c13fe07c58b395335c6107036106d5858b610b52565b518c5173ffffffffffffffffffffffffffffffffffffffff8a16815260208101919091529081906040820190565b0390a30161068f565b5061071f92610270958795931690610d46565b90519081529081906020820190565b61074a91943d8091833e610742818361014b565b810190610a84565b923861068b565b610b46565b3461027457600060031936011261027457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b6080600319360112610274576024356107bf81610355565b67ffffffffffffffff90604435828111610274576107e1903690600401610569565b90606435928311610274573660238401121561027457826004013561080581610551565b93610813604051958661014b565b81855260209160248387019160051b8301019136831161027457602401905b82821061085a5761027061084a8888886004356111db565b6040519081529081906020820190565b81358152908301908301610832565b3461027457600060031936011261027457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346102745760006003193601126102745760206fffffffffffffffffffffffffffffffff60025416604051908152f35b346102745760206003193601126102745760043561090781610355565b61090f610a05565b73ffffffffffffffffffffffffffffffffffffffff8091168015610981576000918254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff600054163303610a2657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60209081818403126102745780519067ffffffffffffffff821161027457019180601f84011215610274578251610aba81610551565b93610ac8604051958661014b565b818552838086019260051b820101928311610274578301905b828210610aef575050505090565b81518152908301908301610ae1565b90815180825260208080930193019160005b828110610b1e575050505090565b835185529381019392810192600101610b10565b906020610b43928181520190610afe565b90565b6040513d6000823e3d90fd5b8051821015610b665760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90610ba890604083526040830190610afe565b81810360209283015282518082529082019282019160005b828110610bce575050505090565b835185529381019392810192600101610bc0565b602081519101519060208110610bf6575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060200360031b1b1690565b809103906080821261027457604080519267ffffffffffffffff606085018181118682101761014657835283518552602084015190811681036102745760208501527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0018113610274576060815192610c9b8461012a565b8281015184520151602083015282015290565b9073ffffffffffffffffffffffffffffffffffffffff6020919493946040845263ffffffff81511660408501528281015160608501526080610d35610d01604084015160a08489015260e08801906101cf565b60608401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08883030160a08901526101cf565b910151151560c08501529416910152565b610d60610d6a919493946000526001602052604060002090565b5463ffffffff1690565b9063ffffffff821615610f3c57610ec193608093610e35610e24610e30610d8f610f66565b95610db5610dae6002546fffffffffffffffffffffffffffffffff1690565b8098610f9b565b95610dc860405196879260208401610b95565b0390610dfa7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09283810188528761014b565b6040805173ffffffffffffffffffffffffffffffffffffffff909216602083015290938491820190565b0390810183528261014b565b610be2565b610e4c610e4061018c565b63ffffffff9096168652565b60208501526040840152606083015260008383015260035473ffffffffffffffffffffffffffffffffffffffff16916fffffffffffffffffffffffffffffffff6040518096819582947f2637a45000000000000000000000000000000000000000000000000000000000845260048401610cae565b03921673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1801561075157610f0e575b50600090565b610f2e9060803d8111610f35575b610f26818361014b565b810190610c23565b5038610f08565b503d610f1c565b60046040517fa1430e03000000000000000000000000000000000000000000000000000000008152fd5b6040517e03000000000000000000000000000000000000000000000000000000000000602082015260028152610b438161012a565b61ffff90600382610fab836112e9565b16036110d9577fffffffffffffffffffffffffffffffff000000000000000000000000000000006040519360801b16602084015260108352610fec8361012a565b600382610ff8836112e9565b16036110d9578251918083116110555761101961102991610b439416611114565b9360405194859360208501611156565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261014b565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f36206269747300000000000000000000000000000000000000000000000000006064820152fd5b906110e56024926112e9565b6040517f3a51740d00000000000000000000000000000000000000000000000000000000815291166004820152fd5b90600161ffff8093160191821161112757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60209061116d6004959493828151948592016101ac565b01907fffff0000000000000000000000000000000000000000000000000000000000007f01000000000000000000000000000000000000000000000000000000000000009182845260f01b16600183015260038201526111d682518093602086850191016101ac565b010190565b909392919373ffffffffffffffffffffffffffffffffffffffff93847f0000000000000000000000000000000000000000000000000000000000000000168033036112b2575060005b86518110156112a2578061123a60019289610b52565b51857fd05d8e0013365e4d441d98e6459477af9dd142c5cf590e87ca927921993b6c6261129961126a858b610b52565b516040805173ffffffffffffffffffffffffffffffffffffffff8b168152602081019290925290918291820190565b0390a301611224565b5094919093610b43941690610d46565b604490604051907fce98f8150000000000000000000000000000000000000000000000000000000082523360048301526024820152fd5b60028151106112f9576002015190565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7431365f6f75744f66426f756e64730000000000000000000000006044820152fdfea2646970667358221220299c18341b91758356503ed4640897b7787c279f9a7930894c3520cbb9aa6d6e64736f6c63430008140033000000000000000000000000117d7d593e6a7d9699a763c552bfa3177a46b957000000000000000000000000bae4ebbf42815bb9bc3720267ea4496277d60db80000000000000000000000001a44076050125825900e736c501f859c50fe728c
|
6080604052600436101561001257600080fd5b60003560e01c8062d34411146100f65780631073f93d146100f1578063121d523e146100ec57806315b75bea146100e75780633687f24a146100e25780636ad889b7146100dd578063715018a6146100d85780638da5cb5b146100d35780639ac41b98146100ce5780639e83334b146100c9578063b4a90ff7146100c4578063d3710343146100bf578063ddca3f43146100ba5763f2fde38b146100b557600080fd5b6108ea565b6108ba565b610869565b6107a7565b610756565b6105c7565b61051d565b61049b565b610469565b6103dc565b610373565b6102ca565b610279565b610212565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761014657604052565b6100fb565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761014657604052565b6040519060a0820182811067ffffffffffffffff82111761014657604052565b60005b8381106101bf5750506000910152565b81810151838201526020016101af565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209361020b815180928187528780880191016101ac565b0116010190565b34610274576000600319360112610274576102706040516102328161012a565b600a81527f6c617965722d7a65726f0000000000000000000000000000000000000000000060208201526040519182916020835260208301906101cf565b0390f35b600080fd5b3461027457600060031936011261027457602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000117d7d593e6a7d9699a763c552bfa3177a46b957168152f35b346102745760406003193601126102745760043560243563ffffffff8116809103610274576102f7610a05565b600091808352600160205260408320827fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000008254161790557f11186c81a030f629870a38c451f20ce4f00ecbad9442ec3ff4e0491cd7a0993e8380a380f35b73ffffffffffffffffffffffffffffffffffffffff81160361027457565b346102745760206003193601126102745773ffffffffffffffffffffffffffffffffffffffff6004356103a581610355565b6103ad610a05565b167fffffffffffffffffffffffff00000000000000000000000000000000000000006003541617600355600080f35b34610274576020600319360112610274576004356fffffffffffffffffffffffffffffffff81168091036102745760207f20461e09b8e557b77e107939f9ce6544698123aad0fc964ac5cc59b7df2e608f91610436610a05565b807fffffffffffffffffffffffffffffffff000000000000000000000000000000006002541617600255604051908152a1005b34610274576020600319360112610274576004356000526001602052602063ffffffff60406000205416604051908152f35b346102745760008060031936011261051a576104b5610a05565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b3461027457600060031936011261027457602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b67ffffffffffffffff81116101465760051b60200190565b81601f820112156102745780359161058083610551565b9261058e604051948561014b565b808452602092838086019260051b820101928311610274578301905b8282106105b8575050505090565b813581529083019083016105aa565b6060600319360112610274576004356024356105e281610355565b60443567ffffffffffffffff811161027457610602903690600401610569565b906040928351917fceee6e550000000000000000000000000000000000000000000000000000000083528261063a8560048301610b32565b039360008473ffffffffffffffffffffffffffffffffffffffff968183897f000000000000000000000000117d7d593e6a7d9699a763c552bfa3177a46b957165af19384156107515760009461072e575b5060005b815181101561070c57806106a560019284610b52565b51857fdfde4db189423e6f919a3d3cb1306e03dc18b4e72bc0c6c13fe07c58b395335c6107036106d5858b610b52565b518c5173ffffffffffffffffffffffffffffffffffffffff8a16815260208101919091529081906040820190565b0390a30161068f565b5061071f92610270958795931690610d46565b90519081529081906020820190565b61074a91943d8091833e610742818361014b565b810190610a84565b923861068b565b610b46565b3461027457600060031936011261027457602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000bae4ebbf42815bb9bc3720267ea4496277d60db8168152f35b6080600319360112610274576024356107bf81610355565b67ffffffffffffffff90604435828111610274576107e1903690600401610569565b90606435928311610274573660238401121561027457826004013561080581610551565b93610813604051958661014b565b81855260209160248387019160051b8301019136831161027457602401905b82821061085a5761027061084a8888886004356111db565b6040519081529081906020820190565b81358152908301908301610832565b3461027457600060031936011261027457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c168152f35b346102745760006003193601126102745760206fffffffffffffffffffffffffffffffff60025416604051908152f35b346102745760206003193601126102745760043561090781610355565b61090f610a05565b73ffffffffffffffffffffffffffffffffffffffff8091168015610981576000918254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff600054163303610a2657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60209081818403126102745780519067ffffffffffffffff821161027457019180601f84011215610274578251610aba81610551565b93610ac8604051958661014b565b818552838086019260051b820101928311610274578301905b828210610aef575050505090565b81518152908301908301610ae1565b90815180825260208080930193019160005b828110610b1e575050505090565b835185529381019392810192600101610b10565b906020610b43928181520190610afe565b90565b6040513d6000823e3d90fd5b8051821015610b665760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90610ba890604083526040830190610afe565b81810360209283015282518082529082019282019160005b828110610bce575050505090565b835185529381019392810192600101610bc0565b602081519101519060208110610bf6575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060200360031b1b1690565b809103906080821261027457604080519267ffffffffffffffff606085018181118682101761014657835283518552602084015190811681036102745760208501527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0018113610274576060815192610c9b8461012a565b8281015184520151602083015282015290565b9073ffffffffffffffffffffffffffffffffffffffff6020919493946040845263ffffffff81511660408501528281015160608501526080610d35610d01604084015160a08489015260e08801906101cf565b60608401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08883030160a08901526101cf565b910151151560c08501529416910152565b610d60610d6a919493946000526001602052604060002090565b5463ffffffff1690565b9063ffffffff821615610f3c57610ec193608093610e35610e24610e30610d8f610f66565b95610db5610dae6002546fffffffffffffffffffffffffffffffff1690565b8098610f9b565b95610dc860405196879260208401610b95565b0390610dfa7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09283810188528761014b565b6040805173ffffffffffffffffffffffffffffffffffffffff909216602083015290938491820190565b0390810183528261014b565b610be2565b610e4c610e4061018c565b63ffffffff9096168652565b60208501526040840152606083015260008383015260035473ffffffffffffffffffffffffffffffffffffffff16916fffffffffffffffffffffffffffffffff6040518096819582947f2637a45000000000000000000000000000000000000000000000000000000000845260048401610cae565b03921673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c165af1801561075157610f0e575b50600090565b610f2e9060803d8111610f35575b610f26818361014b565b810190610c23565b5038610f08565b503d610f1c565b60046040517fa1430e03000000000000000000000000000000000000000000000000000000008152fd5b6040517e03000000000000000000000000000000000000000000000000000000000000602082015260028152610b438161012a565b61ffff90600382610fab836112e9565b16036110d9577fffffffffffffffffffffffffffffffff000000000000000000000000000000006040519360801b16602084015260108352610fec8361012a565b600382610ff8836112e9565b16036110d9578251918083116110555761101961102991610b439416611114565b9360405194859360208501611156565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261014b565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f36206269747300000000000000000000000000000000000000000000000000006064820152fd5b906110e56024926112e9565b6040517f3a51740d00000000000000000000000000000000000000000000000000000000815291166004820152fd5b90600161ffff8093160191821161112757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60209061116d6004959493828151948592016101ac565b01907fffff0000000000000000000000000000000000000000000000000000000000007f01000000000000000000000000000000000000000000000000000000000000009182845260f01b16600183015260038201526111d682518093602086850191016101ac565b010190565b909392919373ffffffffffffffffffffffffffffffffffffffff93847f000000000000000000000000bae4ebbf42815bb9bc3720267ea4496277d60db8168033036112b2575060005b86518110156112a2578061123a60019289610b52565b51857fd05d8e0013365e4d441d98e6459477af9dd142c5cf590e87ca927921993b6c6261129961126a858b610b52565b516040805173ffffffffffffffffffffffffffffffffffffffff8b168152602081019290925290918291820190565b0390a301611224565b5094919093610b43941690610d46565b604490604051907fce98f8150000000000000000000000000000000000000000000000000000000082523360048301526024820152fd5b60028151106112f9576002015190565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7431365f6f75744f66426f756e64730000000000000000000000006044820152fdfea2646970667358221220299c18341b91758356503ed4640897b7787c279f9a7930894c3520cbb9aa6d6e64736f6c63430008140033
|
{{
"language": "Solidity",
"sources": {
"@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/DVNOptions.sol": {
"content": "// SPDX-License-Identifier: LZBL-1.2\n\npragma solidity ^0.8.20;\n\nimport { BytesLib } from \"solidity-bytes-utils/contracts/BytesLib.sol\";\n\nimport { BitMap256 } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol\";\nimport { CalldataBytesLib } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol\";\n\nlibrary DVNOptions {\n using CalldataBytesLib for bytes;\n using BytesLib for bytes;\n\n uint8 internal constant WORKER_ID = 2;\n uint8 internal constant OPTION_TYPE_PRECRIME = 1;\n\n error DVN_InvalidDVNIdx();\n error DVN_InvalidDVNOptions(uint256 cursor);\n\n /// @dev group dvn options by its idx\n /// @param _options [dvn_id][dvn_option][dvn_id][dvn_option]...\n /// dvn_option = [option_size][dvn_idx][option_type][option]\n /// option_size = len(dvn_idx) + len(option_type) + len(option)\n /// dvn_id: uint8, dvn_idx: uint8, option_size: uint16, option_type: uint8, option: bytes\n /// @return dvnOptions the grouped options, still share the same format of _options\n /// @return dvnIndices the dvn indices\n function groupDVNOptionsByIdx(\n bytes memory _options\n ) internal pure returns (bytes[] memory dvnOptions, uint8[] memory dvnIndices) {\n if (_options.length == 0) return (dvnOptions, dvnIndices);\n\n uint8 numDVNs = getNumDVNs(_options);\n\n // if there is only 1 dvn, we can just return the whole options\n if (numDVNs == 1) {\n dvnOptions = new bytes[](1);\n dvnOptions[0] = _options;\n\n dvnIndices = new uint8[](1);\n dvnIndices[0] = _options.toUint8(3); // dvn idx\n return (dvnOptions, dvnIndices);\n }\n\n // otherwise, we need to group the options by dvn_idx\n dvnIndices = new uint8[](numDVNs);\n dvnOptions = new bytes[](numDVNs);\n unchecked {\n uint256 cursor = 0;\n uint256 start = 0;\n uint8 lastDVNIdx = 255; // 255 is an invalid dvn_idx\n\n while (cursor < _options.length) {\n ++cursor; // skip worker_id\n\n // optionLength asserted in getNumDVNs (skip check)\n uint16 optionLength = _options.toUint16(cursor);\n cursor += 2;\n\n // dvnIdx asserted in getNumDVNs (skip check)\n uint8 dvnIdx = _options.toUint8(cursor);\n\n // dvnIdx must equal to the lastDVNIdx for the first option\n // so it is always skipped in the first option\n // this operation slices out options whenever the scan finds a different lastDVNIdx\n if (lastDVNIdx == 255) {\n lastDVNIdx = dvnIdx;\n } else if (dvnIdx != lastDVNIdx) {\n uint256 len = cursor - start - 3; // 3 is for worker_id and option_length\n bytes memory opt = _options.slice(start, len);\n _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, opt);\n\n // reset the start and lastDVNIdx\n start += len;\n lastDVNIdx = dvnIdx;\n }\n\n cursor += optionLength;\n }\n\n // skip check the cursor here because the cursor is asserted in getNumDVNs\n // if we have reached the end of the options, we need to process the last dvn\n uint256 size = cursor - start;\n bytes memory op = _options.slice(start, size);\n _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, op);\n\n // revert dvnIndices to start from 0\n for (uint8 i = 0; i < numDVNs; ++i) {\n --dvnIndices[i];\n }\n }\n }\n\n function _insertDVNOptions(\n bytes[] memory _dvnOptions,\n uint8[] memory _dvnIndices,\n uint8 _dvnIdx,\n bytes memory _newOptions\n ) internal pure {\n // dvnIdx starts from 0 but default value of dvnIndices is 0,\n // so we tell if the slot is empty by adding 1 to dvnIdx\n if (_dvnIdx == 255) revert DVN_InvalidDVNIdx();\n uint8 dvnIdxAdj = _dvnIdx + 1;\n\n for (uint256 j = 0; j < _dvnIndices.length; ++j) {\n uint8 index = _dvnIndices[j];\n if (dvnIdxAdj == index) {\n _dvnOptions[j] = abi.encodePacked(_dvnOptions[j], _newOptions);\n break;\n } else if (index == 0) {\n // empty slot, that means it is the first time we see this dvn\n _dvnIndices[j] = dvnIdxAdj;\n _dvnOptions[j] = _newOptions;\n break;\n }\n }\n }\n\n /// @dev get the number of unique dvns\n /// @param _options the format is the same as groupDVNOptionsByIdx\n function getNumDVNs(bytes memory _options) internal pure returns (uint8 numDVNs) {\n uint256 cursor = 0;\n BitMap256 bitmap;\n\n // find number of unique dvn_idx\n unchecked {\n while (cursor < _options.length) {\n ++cursor; // skip worker_id\n\n uint16 optionLength = _options.toUint16(cursor);\n cursor += 2;\n if (optionLength < 2) revert DVN_InvalidDVNOptions(cursor); // at least 1 byte for dvn_idx and 1 byte for option_type\n\n uint8 dvnIdx = _options.toUint8(cursor);\n\n // if dvnIdx is not set, increment numDVNs\n // max num of dvns is 255, 255 is an invalid dvn_idx\n // The order of the dvnIdx is not required to be sequential, as enforcing the order may weaken\n // the composability of the options. e.g. if we refrain from enforcing the order, an OApp that has\n // already enforced certain options can append additional options to the end of the enforced\n // ones without restrictions.\n if (dvnIdx == 255) revert DVN_InvalidDVNIdx();\n if (!bitmap.get(dvnIdx)) {\n ++numDVNs;\n bitmap = bitmap.set(dvnIdx);\n }\n\n cursor += optionLength;\n }\n }\n if (cursor != _options.length) revert DVN_InvalidDVNOptions(cursor);\n }\n\n /// @dev decode the next dvn option from _options starting from the specified cursor\n /// @param _options the format is the same as groupDVNOptionsByIdx\n /// @param _cursor the cursor to start decoding\n /// @return optionType the type of the option\n /// @return option the option\n /// @return cursor the cursor to start decoding the next option\n function nextDVNOption(\n bytes calldata _options,\n uint256 _cursor\n ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) {\n unchecked {\n // skip worker id\n cursor = _cursor + 1;\n\n // read option size\n uint16 size = _options.toU16(cursor);\n cursor += 2;\n\n // read option type\n optionType = _options.toU8(cursor + 1); // skip dvn_idx\n\n // startCursor and endCursor are used to slice the option from _options\n uint256 startCursor = cursor + 2; // skip option type and dvn_idx\n uint256 endCursor = cursor + size;\n option = _options[startCursor:endCursor];\n cursor += size;\n }\n }\n}\n"
},
"@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/libs/OptionsBuilder.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { BytesLib } from \"solidity-bytes-utils/contracts/BytesLib.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport { ExecutorOptions } from \"@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/ExecutorOptions.sol\";\nimport { DVNOptions } from \"@layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/DVNOptions.sol\";\n\n/**\n * @title OptionsBuilder\n * @dev Library for building and encoding various message options.\n */\nlibrary OptionsBuilder {\n using SafeCast for uint256;\n using BytesLib for bytes;\n\n // Constants for options types\n uint16 internal constant TYPE_1 = 1; // legacy options type 1\n uint16 internal constant TYPE_2 = 2; // legacy options type 2\n uint16 internal constant TYPE_3 = 3;\n\n // Custom error message\n error InvalidSize(uint256 max, uint256 actual);\n error InvalidOptionType(uint16 optionType);\n\n // Modifier to ensure only options of type 3 are used\n modifier onlyType3(bytes memory _options) {\n if (_options.toUint16(0) != TYPE_3) revert InvalidOptionType(_options.toUint16(0));\n _;\n }\n\n /**\n * @dev Creates a new options container with type 3.\n * @return options The newly created options container.\n */\n function newOptions() internal pure returns (bytes memory) {\n return abi.encodePacked(TYPE_3);\n }\n\n /**\n * @dev Adds an executor LZ receive option to the existing options.\n * @param _options The existing options container.\n * @param _gas The gasLimit used on the lzReceive() function in the OApp.\n * @param _value The msg.value passed to the lzReceive() function in the OApp.\n * @return options The updated options container.\n *\n * @dev When multiples of this option are added, they are summed by the executor\n * eg. if (_gas: 200k, and _value: 1 ether) AND (_gas: 100k, _value: 0.5 ether) are sent in an option to the LayerZeroEndpoint,\n * that becomes (300k, 1.5 ether) when the message is executed on the remote lzReceive() function.\n */\n function addExecutorLzReceiveOption(\n bytes memory _options,\n uint128 _gas,\n uint128 _value\n ) internal pure onlyType3(_options) returns (bytes memory) {\n bytes memory option = ExecutorOptions.encodeLzReceiveOption(_gas, _value);\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZRECEIVE, option);\n }\n\n /**\n * @dev Adds an executor native drop option to the existing options.\n * @param _options The existing options container.\n * @param _amount The amount for the native value that is airdropped to the 'receiver'.\n * @param _receiver The receiver address for the native drop option.\n * @return options The updated options container.\n *\n * @dev When multiples of this option are added, they are summed by the executor on the remote chain.\n */\n function addExecutorNativeDropOption(\n bytes memory _options,\n uint128 _amount,\n bytes32 _receiver\n ) internal pure onlyType3(_options) returns (bytes memory) {\n bytes memory option = ExecutorOptions.encodeNativeDropOption(_amount, _receiver);\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_NATIVE_DROP, option);\n }\n\n /**\n * @dev Adds an executor LZ compose option to the existing options.\n * @param _options The existing options container.\n * @param _index The index for the lzCompose() function call.\n * @param _gas The gasLimit for the lzCompose() function call.\n * @param _value The msg.value for the lzCompose() function call.\n * @return options The updated options container.\n *\n * @dev When multiples of this option are added, they are summed PER index by the executor on the remote chain.\n * @dev If the OApp sends N lzCompose calls on the remote, you must provide N incremented indexes starting with 0.\n * ie. When your remote OApp composes (N = 3) messages, you must set this option for index 0,1,2\n */\n function addExecutorLzComposeOption(\n bytes memory _options,\n uint16 _index,\n uint128 _gas,\n uint128 _value\n ) internal pure onlyType3(_options) returns (bytes memory) {\n bytes memory option = ExecutorOptions.encodeLzComposeOption(_index, _gas, _value);\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_LZCOMPOSE, option);\n }\n\n /**\n * @dev Adds an executor ordered execution option to the existing options.\n * @param _options The existing options container.\n * @return options The updated options container.\n */\n function addExecutorOrderedExecutionOption(\n bytes memory _options\n ) internal pure onlyType3(_options) returns (bytes memory) {\n return addExecutorOption(_options, ExecutorOptions.OPTION_TYPE_ORDERED_EXECUTION, bytes(\"\"));\n }\n\n /**\n * @dev Adds a DVN pre-crime option to the existing options.\n * @param _options The existing options container.\n * @param _dvnIdx The DVN index for the pre-crime option.\n * @return options The updated options container.\n */\n function addDVNPreCrimeOption(\n bytes memory _options,\n uint8 _dvnIdx\n ) internal pure onlyType3(_options) returns (bytes memory) {\n return addDVNOption(_options, _dvnIdx, DVNOptions.OPTION_TYPE_PRECRIME, bytes(\"\"));\n }\n\n /**\n * @dev Adds an executor option to the existing options.\n * @param _options The existing options container.\n * @param _optionType The type of the executor option.\n * @param _option The encoded data for the executor option.\n * @return options The updated options container.\n */\n function addExecutorOption(\n bytes memory _options,\n uint8 _optionType,\n bytes memory _option\n ) internal pure onlyType3(_options) returns (bytes memory) {\n return\n abi.encodePacked(\n _options,\n ExecutorOptions.WORKER_ID,\n _option.length.toUint16() + 1, // +1 for optionType\n _optionType,\n _option\n );\n }\n\n /**\n * @dev Adds a DVN option to the existing options.\n * @param _options The existing options container.\n * @param _dvnIdx The DVN index for the DVN option.\n * @param _optionType The type of the DVN option.\n * @param _option The encoded data for the DVN option.\n * @return options The updated options container.\n */\n function addDVNOption(\n bytes memory _options,\n uint8 _dvnIdx,\n uint8 _optionType,\n bytes memory _option\n ) internal pure onlyType3(_options) returns (bytes memory) {\n return\n abi.encodePacked(\n _options,\n DVNOptions.WORKER_ID,\n _option.length.toUint16() + 2, // +2 for optionType and dvnIdx\n _dvnIdx,\n _optionType,\n _option\n );\n }\n\n /**\n * @dev Encodes legacy options of type 1.\n * @param _executionGas The gasLimit value passed to lzReceive().\n * @return legacyOptions The encoded legacy options.\n */\n function encodeLegacyOptionsType1(uint256 _executionGas) internal pure returns (bytes memory) {\n if (_executionGas > type(uint128).max) revert InvalidSize(type(uint128).max, _executionGas);\n return abi.encodePacked(TYPE_1, _executionGas);\n }\n\n /**\n * @dev Encodes legacy options of type 2.\n * @param _executionGas The gasLimit value passed to lzReceive().\n * @param _nativeForDst The amount of native air dropped to the receiver.\n * @param _receiver The _nativeForDst receiver address.\n * @return legacyOptions The encoded legacy options of type 2.\n */\n function encodeLegacyOptionsType2(\n uint256 _executionGas,\n uint256 _nativeForDst,\n bytes memory _receiver // @dev Use bytes instead of bytes32 in legacy type 2 for _receiver.\n ) internal pure returns (bytes memory) {\n if (_executionGas > type(uint128).max) revert InvalidSize(type(uint128).max, _executionGas);\n if (_nativeForDst > type(uint128).max) revert InvalidSize(type(uint128).max, _nativeForDst);\n if (_receiver.length > 32) revert InvalidSize(32, _receiver.length);\n return abi.encodePacked(TYPE_2, _executionGas, _nativeForDst, _receiver);\n }\n}\n"
},
"@layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol": {
"content": "// SPDX-License-Identifier: LZBL-1.2\n\npragma solidity ^0.8.20;\n\nlibrary CalldataBytesLib {\n function toU8(bytes calldata _bytes, uint256 _start) internal pure returns (uint8) {\n return uint8(_bytes[_start]);\n }\n\n function toU16(bytes calldata _bytes, uint256 _start) internal pure returns (uint16) {\n unchecked {\n uint256 end = _start + 2;\n return uint16(bytes2(_bytes[_start:end]));\n }\n }\n\n function toU32(bytes calldata _bytes, uint256 _start) internal pure returns (uint32) {\n unchecked {\n uint256 end = _start + 4;\n return uint32(bytes4(_bytes[_start:end]));\n }\n }\n\n function toU64(bytes calldata _bytes, uint256 _start) internal pure returns (uint64) {\n unchecked {\n uint256 end = _start + 8;\n return uint64(bytes8(_bytes[_start:end]));\n }\n }\n\n function toU128(bytes calldata _bytes, uint256 _start) internal pure returns (uint128) {\n unchecked {\n uint256 end = _start + 16;\n return uint128(bytes16(_bytes[_start:end]));\n }\n }\n\n function toU256(bytes calldata _bytes, uint256 _start) internal pure returns (uint256) {\n unchecked {\n uint256 end = _start + 32;\n return uint256(bytes32(_bytes[_start:end]));\n }\n }\n\n function toAddr(bytes calldata _bytes, uint256 _start) internal pure returns (address) {\n unchecked {\n uint256 end = _start + 20;\n return address(bytes20(_bytes[_start:end]));\n }\n }\n\n function toB32(bytes calldata _bytes, uint256 _start) internal pure returns (bytes32) {\n unchecked {\n uint256 end = _start + 32;\n return bytes32(_bytes[_start:end]);\n }\n }\n}\n"
},
"@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol": {
"content": "// SPDX-License-Identifier: MIT\n\n// modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/BitMaps.sol\npragma solidity ^0.8.20;\n\ntype BitMap256 is uint256;\n\nusing BitMaps for BitMap256 global;\n\nlibrary BitMaps {\n /**\n * @dev Returns whether the bit at `index` is set.\n */\n function get(BitMap256 bitmap, uint8 index) internal pure returns (bool) {\n uint256 mask = 1 << index;\n return BitMap256.unwrap(bitmap) & mask != 0;\n }\n\n /**\n * @dev Sets the bit at `index`.\n */\n function set(BitMap256 bitmap, uint8 index) internal pure returns (BitMap256) {\n uint256 mask = 1 << index;\n return BitMap256.wrap(BitMap256.unwrap(bitmap) | mask);\n }\n}\n"
},
"@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/ExecutorOptions.sol": {
"content": "// SPDX-License-Identifier: LZBL-1.2\n\npragma solidity ^0.8.20;\n\nimport { CalldataBytesLib } from \"../../libs/CalldataBytesLib.sol\";\n\nlibrary ExecutorOptions {\n using CalldataBytesLib for bytes;\n\n uint8 internal constant WORKER_ID = 1;\n\n uint8 internal constant OPTION_TYPE_LZRECEIVE = 1;\n uint8 internal constant OPTION_TYPE_NATIVE_DROP = 2;\n uint8 internal constant OPTION_TYPE_LZCOMPOSE = 3;\n uint8 internal constant OPTION_TYPE_ORDERED_EXECUTION = 4;\n\n error Executor_InvalidLzReceiveOption();\n error Executor_InvalidNativeDropOption();\n error Executor_InvalidLzComposeOption();\n\n /// @dev decode the next executor option from the options starting from the specified cursor\n /// @param _options [executor_id][executor_option][executor_id][executor_option]...\n /// executor_option = [option_size][option_type][option]\n /// option_size = len(option_type) + len(option)\n /// executor_id: uint8, option_size: uint16, option_type: uint8, option: bytes\n /// @param _cursor the cursor to start decoding from\n /// @return optionType the type of the option\n /// @return option the option of the executor\n /// @return cursor the cursor to start decoding the next executor option\n function nextExecutorOption(\n bytes calldata _options,\n uint256 _cursor\n ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) {\n unchecked {\n // skip worker id\n cursor = _cursor + 1;\n\n // read option size\n uint16 size = _options.toU16(cursor);\n cursor += 2;\n\n // read option type\n optionType = _options.toU8(cursor);\n\n // startCursor and endCursor are used to slice the option from _options\n uint256 startCursor = cursor + 1; // skip option type\n uint256 endCursor = cursor + size;\n option = _options[startCursor:endCursor];\n cursor += size;\n }\n }\n\n function decodeLzReceiveOption(bytes calldata _option) internal pure returns (uint128 gas, uint128 value) {\n if (_option.length != 16 && _option.length != 32) revert Executor_InvalidLzReceiveOption();\n gas = _option.toU128(0);\n value = _option.length == 32 ? _option.toU128(16) : 0;\n }\n\n function decodeNativeDropOption(bytes calldata _option) internal pure returns (uint128 amount, bytes32 receiver) {\n if (_option.length != 48) revert Executor_InvalidNativeDropOption();\n amount = _option.toU128(0);\n receiver = _option.toB32(16);\n }\n\n function decodeLzComposeOption(\n bytes calldata _option\n ) internal pure returns (uint16 index, uint128 gas, uint128 value) {\n if (_option.length != 18 && _option.length != 34) revert Executor_InvalidLzComposeOption();\n index = _option.toU16(0);\n gas = _option.toU128(2);\n value = _option.length == 34 ? _option.toU128(18) : 0;\n }\n\n function encodeLzReceiveOption(uint128 _gas, uint128 _value) internal pure returns (bytes memory) {\n return _value == 0 ? abi.encodePacked(_gas) : abi.encodePacked(_gas, _value);\n }\n\n function encodeNativeDropOption(uint128 _amount, bytes32 _receiver) internal pure returns (bytes memory) {\n return abi.encodePacked(_amount, _receiver);\n }\n\n function encodeLzComposeOption(uint16 _index, uint128 _gas, uint128 _value) internal pure returns (bytes memory) {\n return _value == 0 ? abi.encodePacked(_index, _gas) : abi.encodePacked(_index, _gas, _value);\n }\n}\n"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\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 /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"
},
"@openzeppelin/contracts/utils/math/SafeCast.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n"
},
"contracts/adapters/LayerZero/interfaces/ILayerZeroEndpointV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.0;\n\nstruct MessagingParams {\n uint32 dstEid;\n bytes32 receiver;\n bytes message;\n bytes options;\n bool payInLzToken;\n}\n\nstruct MessagingReceipt {\n bytes32 guid;\n uint64 nonce;\n MessagingFee fee;\n}\n\nstruct MessagingFee {\n uint256 nativeFee;\n uint256 lzTokenFee;\n}\n\nstruct Origin {\n uint32 srcEid;\n bytes32 sender;\n uint64 nonce;\n}\n\ninterface ILayerZeroEndpointV2 {\n event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);\n\n event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);\n\n event PacketDelivered(Origin origin, address receiver);\n\n event LzReceiveAlert(\n address indexed receiver,\n address indexed executor,\n Origin origin,\n bytes32 guid,\n uint256 gas,\n uint256 value,\n bytes message,\n bytes extraData,\n bytes reason\n );\n\n event LzTokenSet(address token);\n\n event DelegateSet(address sender, address delegate);\n\n function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);\n\n function send(\n MessagingParams calldata _params,\n address _refundAddress\n ) external payable returns (MessagingReceipt memory);\n\n function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;\n\n function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);\n\n function initializable(Origin calldata _origin, address _receiver) external view returns (bool);\n\n function lzReceive(\n Origin calldata _origin,\n address _receiver,\n bytes32 _guid,\n bytes calldata _message,\n bytes calldata _extraData\n ) external payable;\n\n // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order\n function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;\n\n function setLzToken(address _lzToken) external;\n\n function lzToken() external view returns (address);\n\n function nativeToken() external view returns (address);\n\n function setDelegate(address _delegate) external;\n}\n"
},
"contracts/adapters/LayerZero/LayerZeroReporter.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { ILayerZeroEndpointV2, MessagingParams } from \"./interfaces/ILayerZeroEndpointV2.sol\";\nimport { Reporter } from \"../Reporter.sol\";\nimport { OptionsBuilder } from \"@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/libs/OptionsBuilder.sol\";\n\ncontract LayerZeroReporter is Reporter, Ownable {\n using OptionsBuilder for bytes;\n\n string public constant PROVIDER = \"layer-zero\";\n ILayerZeroEndpointV2 public immutable LAYER_ZERO_ENDPOINT;\n\n mapping(uint256 => uint32) public endpointIds;\n uint128 public fee;\n address refundAddress;\n\n error EndpointIdNotAvailable();\n\n event EndpointIdSet(uint256 indexed chainId, uint32 indexed endpointId);\n event FeeSet(uint256 fee);\n\n constructor(address headerStorage, address yaho, address lzEndpoint) Reporter(headerStorage, yaho) {\n LAYER_ZERO_ENDPOINT = ILayerZeroEndpointV2(lzEndpoint);\n }\n\n function setEndpointIdByChainId(uint256 chainId, uint32 endpointId) external onlyOwner {\n endpointIds[chainId] = endpointId;\n emit EndpointIdSet(chainId, endpointId);\n }\n\n function setFee(uint128 fee_) external onlyOwner {\n fee = fee_;\n emit FeeSet(fee);\n }\n\n function setRefundAddress(address refundAddress_) external onlyOwner {\n refundAddress = refundAddress_;\n }\n\n function _dispatch(\n uint256 targetChainId,\n address adapter,\n uint256[] memory ids,\n bytes32[] memory hashes\n ) internal override returns (bytes32) {\n uint32 targetEndpointId = endpointIds[targetChainId];\n if (targetEndpointId == 0) revert EndpointIdNotAvailable();\n bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(fee, 0);\n bytes memory message = abi.encode(ids, hashes);\n MessagingParams memory params = MessagingParams(\n targetEndpointId,\n bytes32(abi.encode(adapter)),\n message,\n options,\n false // receiver in lz Token\n );\n // solhint-disable-next-line check-send-result\n LAYER_ZERO_ENDPOINT.send{ value: fee }(params, refundAddress);\n return bytes32(0);\n }\n}\n"
},
"contracts/adapters/Reporter.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.20;\n\nimport { IHeaderStorage } from \"../interfaces/IHeaderStorage.sol\";\nimport { IReporter } from \"../interfaces/IReporter.sol\";\nimport { IAdapter } from \"../interfaces/IAdapter.sol\";\n\nabstract contract Reporter is IReporter {\n address public immutable HEADER_STORAGE;\n address public immutable YAHO;\n\n modifier onlyYaho() {\n if (msg.sender != YAHO) revert NotYaho(msg.sender, YAHO);\n _;\n }\n\n constructor(address headerStorage, address yaho) {\n HEADER_STORAGE = headerStorage;\n YAHO = yaho;\n }\n\n /// @inheritdoc IReporter\n function dispatchBlocks(\n uint256 targetChainId,\n IAdapter adapter,\n uint256[] memory blockNumbers\n ) external payable returns (bytes32) {\n bytes32[] memory blockHeaders = IHeaderStorage(HEADER_STORAGE).storeBlockHeaders(blockNumbers);\n for (uint256 i = 0; i < blockNumbers.length; ) {\n emit BlockDispatched(targetChainId, adapter, blockNumbers[i], blockHeaders[i]);\n unchecked {\n ++i;\n }\n }\n return _dispatch(targetChainId, address(adapter), blockNumbers, blockHeaders);\n }\n\n /// @inheritdoc IReporter\n function dispatchMessages(\n uint256 targetChainId,\n IAdapter adapter,\n uint256[] memory messageIds,\n bytes32[] memory messageHashes\n ) external payable onlyYaho returns (bytes32) {\n for (uint256 i = 0; i < messageIds.length; ) {\n emit MessageDispatched(targetChainId, adapter, messageIds[i], messageHashes[i]);\n unchecked {\n ++i;\n }\n }\n return _dispatch(targetChainId, address(adapter), messageIds, messageHashes);\n }\n\n function _dispatch(\n uint256 targetChainId,\n address adapter,\n uint256[] memory ids,\n bytes32[] memory hashes\n ) internal virtual returns (bytes32);\n}\n"
},
"contracts/interfaces/IAdapter.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title IAdapter\n */\ninterface IAdapter {\n error ConflictingBlockHeader(uint256 blockNumber, bytes32 blockHash, bytes32 storedBlockHash);\n error InvalidBlockHeaderLength(uint256 length);\n error InvalidBlockHeaderRLP();\n\n /**\n * @dev Emitted when a hash is stored.\n * @param id - The ID of the stored hash.\n * @param hash - The stored hash as bytes32 values.\n */\n event HashStored(uint256 indexed id, bytes32 indexed hash);\n\n /**\n * @dev Returns the hash for a given ID.\n * @param domain - Identifier for the domain to query.\n * @param id - Identifier for the ID to query.\n * @return hash Bytes32 hash for the given ID on the given domain.\n * @notice MUST return bytes32(0) if the hash is not present.\n */\n function getHash(uint256 domain, uint256 id) external view returns (bytes32 hash);\n}\n"
},
"contracts/interfaces/IHeaderStorage.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\n/**\n * @title IHeaderStorage\n */\ninterface IHeaderStorage {\n error HeaderOutOfRange(uint256 blockNumber);\n\n /**\n * @dev Emitted when a block header is stored.\n * @param blockNumber - The block number associated with the stored header.\n * @param blockHeader - The stored block header as a bytes32 value.\n */\n event HeaderStored(uint256 indexed blockNumber, bytes32 indexed blockHeader);\n\n /**\n * @dev Retrieves the stored block header for a specific block number.\n * @param blockNumber - The block number as a uint256 value.\n * @return The block header as a bytes32 value.\n */\n function headers(uint256 blockNumber) external view returns (bytes32);\n\n /**\n * @dev Stores and returns the header for the given block.\n * @param blockNumber - Block number.\n * @return blockHeader - Block header stored.\n * @notice Reverts if the given block header was not previously stored and is now out of range.\n */\n function storeBlockHeader(uint256 blockNumber) external returns (bytes32);\n\n /**\n * @dev Stores and returns the header for an array of given blocks.\n * @param blockNumbers - Array of block numbers.\n * @return blockHeaders - Array of block headers stored.\n * @notice Reverts if the given block header was not previously stored and is now out of range.\n */\n function storeBlockHeaders(uint256[] memory blockNumbers) external returns (bytes32[] memory);\n}\n"
},
"contracts/interfaces/IReporter.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity ^0.8.0;\n\nimport { IAdapter } from \"./IAdapter.sol\";\n\ninterface IReporter {\n error NotYaho(address sender, address expectedYaho);\n\n /**\n * @dev Emitted when a block is dispatched to another chain.\n * @param targetChainId - The target chain's identifier associated with the dispatched block.\n * @param adapter - The adapter address associated with the dispatched block.\n * @param blockNumber - The block number associated with the dispatched block.\n * @param blockHeader - The dispatched block header as a bytes32 value.\n */\n event BlockDispatched(\n uint256 indexed targetChainId,\n IAdapter adapter,\n uint256 indexed blockNumber,\n bytes32 blockHeader\n );\n\n /**\n * @dev Emitted when a message is dispatched to another chain.\n * @param targetChainId - The target chain's identifier associated with the dispatched message.\n * @param adapter - The adapter address associated with the dispatched message.\n * @param messageId - The message identifier associated with the dispatched message.\n * @param messageHash - The dispatched message hash as a bytes32 value.\n */\n event MessageDispatched(\n uint256 indexed targetChainId,\n IAdapter adapter,\n uint256 indexed messageId,\n bytes32 messageHash\n );\n\n /**\n * @dev Dispatches blocks to a given adapter on the target chaib.\n * @param targetChainId - The target chain's Uint256 identifier.\n * @param adapter - The adapter instance to use.\n * @param blockNumbers - An array of Uint256 block numbers to dispatch.\n * @notice blockNumbers must include block numbers that are greater than or equal to (currentBlock - 256) due to EVM limitations.\n * @return result - The result returned by the adapter as bytes.\n */\n function dispatchBlocks(\n uint256 targetChainId,\n IAdapter adapter,\n uint256[] memory blockNumbers\n ) external payable returns (bytes32);\n\n /**\n * @dev Dispatches messages to a target chain using the specified adapter.\n * @param targetChainId - The target chain's Uint256 identifier.\n * @param adapter - The adapter instance to use.\n * @param messageIds - An array of Uint256 message identifiers.\n * @param messageHashes - An array of bytes32 message hashes.\n * @notice This function can be called only by Yaho\n * @return result - The result returned by the adapter as bytes.\n */\n function dispatchMessages(\n uint256 targetChainId,\n IAdapter adapter,\n uint256[] memory messageIds,\n bytes32[] memory messageHashes\n ) external payable returns (bytes32);\n}\n"
},
"solidity-bytes-utils/contracts/BytesLib.sol": {
"content": "// SPDX-License-Identifier: Unlicense\n/*\n * @title Solidity Bytes Arrays Utils\n * @author Gonçalo Sá <[email protected]>\n *\n * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.\n * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.\n */\npragma solidity >=0.8.0 <0.9.0;\n\n\nlibrary BytesLib {\n function concat(\n bytes memory _preBytes,\n bytes memory _postBytes\n )\n internal\n pure\n returns (bytes memory)\n {\n bytes memory tempBytes;\n\n assembly {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // Store the length of the first bytes array at the beginning of\n // the memory for tempBytes.\n let length := mload(_preBytes)\n mstore(tempBytes, length)\n\n // Maintain a memory counter for the current write location in the\n // temp bytes array by adding the 32 bytes for the array length to\n // the starting location.\n let mc := add(tempBytes, 0x20)\n // Stop copying when the memory counter reaches the length of the\n // first bytes array.\n let end := add(mc, length)\n\n for {\n // Initialize a copy counter to the start of the _preBytes data,\n // 32 bytes into its memory.\n let cc := add(_preBytes, 0x20)\n } lt(mc, end) {\n // Increase both counters by 32 bytes each iteration.\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // Write the _preBytes data into the tempBytes memory 32 bytes\n // at a time.\n mstore(mc, mload(cc))\n }\n\n // Add the length of _postBytes to the current length of tempBytes\n // and store it as the new length in the first 32 bytes of the\n // tempBytes memory.\n length := mload(_postBytes)\n mstore(tempBytes, add(length, mload(tempBytes)))\n\n // Move the memory counter back from a multiple of 0x20 to the\n // actual end of the _preBytes data.\n mc := end\n // Stop copying when the memory counter reaches the new combined\n // length of the arrays.\n end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n // Update the free-memory pointer by padding our last write location\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\n // next 32 byte block, then round down to the nearest multiple of\n // 32. If the sum of the length of the two arrays is zero then add\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\n mstore(0x40, and(\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\n not(31) // Round down to the nearest 32 bytes.\n ))\n }\n\n return tempBytes;\n }\n\n function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {\n assembly {\n // Read the first 32 bytes of _preBytes storage, which is the length\n // of the array. (We don't need to use the offset into the slot\n // because arrays use the entire slot.)\n let fslot := sload(_preBytes.slot)\n // Arrays of 31 bytes or less have an even value in their slot,\n // while longer arrays have an odd value. The actual length is\n // the slot divided by two for odd values, and the lowest order\n // byte divided by two for even values.\n // If the slot is even, bitwise and the slot with 255 and divide by\n // two to get the length. If the slot is odd, bitwise and the slot\n // with -1 and divide by two.\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n let mlength := mload(_postBytes)\n let newlength := add(slength, mlength)\n // slength can contain both the length and contents of the array\n // if length < 32 bytes so let's prepare for that\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n switch add(lt(slength, 32), lt(newlength, 32))\n case 2 {\n // Since the new array still fits in the slot, we just need to\n // update the contents of the slot.\n // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\n sstore(\n _preBytes.slot,\n // all the modifications to the slot are inside this\n // next block\n add(\n // we can just add to the slot contents because the\n // bytes we want to change are the LSBs\n fslot,\n add(\n mul(\n div(\n // load the bytes from memory\n mload(add(_postBytes, 0x20)),\n // zero all bytes to the right\n exp(0x100, sub(32, mlength))\n ),\n // and now shift left the number of bytes to\n // leave space for the length in the slot\n exp(0x100, sub(32, newlength))\n ),\n // increase length by the double of the memory\n // bytes length\n mul(mlength, 2)\n )\n )\n )\n }\n case 1 {\n // The stored value fits in the slot, but the combined value\n // will exceed it.\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n // save new length\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n // The contents of the _postBytes array start 32 bytes into\n // the structure. Our first read should obtain the `submod`\n // bytes that can fit into the unused space in the last word\n // of the stored array. To get this, we read 32 bytes starting\n // from `submod`, so the data we read overlaps with the array\n // contents by `submod` bytes. Masking the lowest-order\n // `submod` bytes allows us to add that value directly to the\n // stored value.\n\n let submod := sub(32, slength)\n let mc := add(_postBytes, submod)\n let end := add(_postBytes, mlength)\n let mask := sub(exp(0x100, submod), 1)\n\n sstore(\n sc,\n add(\n and(\n fslot,\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00\n ),\n and(mload(mc), mask)\n )\n )\n\n for {\n mc := add(mc, 0x20)\n sc := add(sc, 1)\n } lt(mc, end) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n sstore(sc, mload(mc))\n }\n\n mask := exp(0x100, sub(mc, end))\n\n sstore(sc, mul(div(mload(mc), mask), mask))\n }\n default {\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n // Start copying to the last used word of the stored array.\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\n\n // save new length\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\n\n // Copy over the first `submod` bytes of the new data as in\n // case 1 above.\n let slengthmod := mod(slength, 32)\n let mlengthmod := mod(mlength, 32)\n let submod := sub(32, slengthmod)\n let mc := add(_postBytes, submod)\n let end := add(_postBytes, mlength)\n let mask := sub(exp(0x100, submod), 1)\n\n sstore(sc, add(sload(sc), and(mload(mc), mask)))\n\n for {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } lt(mc, end) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n sstore(sc, mload(mc))\n }\n\n mask := exp(0x100, sub(mc, end))\n\n sstore(sc, mul(div(mload(mc), mask), mask))\n }\n }\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (bytes memory)\n {\n require(_length + 31 >= _length, \"slice_overflow\");\n require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n bytes memory tempBytes;\n\n assembly {\n switch iszero(_length)\n case 0 {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // The first word of the slice result is potentially a partial\n // word read from the original array. To read it, we calculate\n // the length of that partial word and start copying that many\n // bytes into the array. The first word we copy will start with\n // data we don't care about, but the last `lengthmod` bytes will\n // land at the beginning of the contents of the new array. When\n // we're done copying, we overwrite the full first word with\n // the actual length of the slice.\n let lengthmod := and(_length, 31)\n\n // The multiplication in the next line is necessary\n // because when slicing multiples of 32 bytes (lengthmod == 0)\n // the following copy loop was copying the origin's length\n // and then ending prematurely not copying everything it should.\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n let end := add(mc, _length)\n\n for {\n // The multiplication in the next line has the same exact purpose\n // as the one above.\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n mstore(tempBytes, _length)\n\n //update free-memory pointer\n //allocating the array padded to 32 bytes like the compiler does now\n mstore(0x40, and(add(mc, 31), not(31)))\n }\n //if we want a zero-length slice let's just return a zero-length array\n default {\n tempBytes := mload(0x40)\n //zero out the 32 bytes slice we are about to return\n //we need to do it because Solidity does not garbage collect\n mstore(tempBytes, 0)\n\n mstore(0x40, add(tempBytes, 0x20))\n }\n }\n\n return tempBytes;\n }\n\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\n require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\n address tempAddress;\n\n assembly {\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n }\n\n return tempAddress;\n }\n\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\n require(_bytes.length >= _start + 1 , \"toUint8_outOfBounds\");\n uint8 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x1), _start))\n }\n\n return tempUint;\n }\n\n function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {\n require(_bytes.length >= _start + 2, \"toUint16_outOfBounds\");\n uint16 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x2), _start))\n }\n\n return tempUint;\n }\n\n function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {\n require(_bytes.length >= _start + 4, \"toUint32_outOfBounds\");\n uint32 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x4), _start))\n }\n\n return tempUint;\n }\n\n function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {\n require(_bytes.length >= _start + 8, \"toUint64_outOfBounds\");\n uint64 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x8), _start))\n }\n\n return tempUint;\n }\n\n function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {\n require(_bytes.length >= _start + 12, \"toUint96_outOfBounds\");\n uint96 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0xc), _start))\n }\n\n return tempUint;\n }\n\n function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {\n require(_bytes.length >= _start + 16, \"toUint128_outOfBounds\");\n uint128 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x10), _start))\n }\n\n return tempUint;\n }\n\n function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {\n require(_bytes.length >= _start + 32, \"toUint256_outOfBounds\");\n uint256 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x20), _start))\n }\n\n return tempUint;\n }\n\n function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {\n require(_bytes.length >= _start + 32, \"toBytes32_outOfBounds\");\n bytes32 tempBytes32;\n\n assembly {\n tempBytes32 := mload(add(add(_bytes, 0x20), _start))\n }\n\n return tempBytes32;\n }\n\n function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\n bool success = true;\n\n assembly {\n let length := mload(_preBytes)\n\n // if lengths don't match the arrays are not equal\n switch eq(length, mload(_postBytes))\n case 1 {\n // cb is a circuit breaker in the for loop since there's\n // no said feature for inline assembly loops\n // cb = 1 - don't breaker\n // cb = 0 - break\n let cb := 1\n\n let mc := add(_preBytes, 0x20)\n let end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n // the next line is the loop condition:\n // while(uint256(mc < end) + cb == 2)\n } eq(add(lt(mc, end), cb), 2) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // if any of these checks fails then arrays are not equal\n if iszero(eq(mload(mc), mload(cc))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n }\n default {\n // unsuccess:\n success := 0\n }\n }\n\n return success;\n }\n\n function equal_nonAligned(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {\n bool success = true;\n\n assembly {\n let length := mload(_preBytes)\n\n // if lengths don't match the arrays are not equal\n switch eq(length, mload(_postBytes))\n case 1 {\n // cb is a circuit breaker in the for loop since there's\n // no said feature for inline assembly loops\n // cb = 1 - don't breaker\n // cb = 0 - break\n let cb := 1\n\n let endMinusWord := add(_preBytes, length)\n let mc := add(_preBytes, 0x20)\n let cc := add(_postBytes, 0x20)\n\n for {\n // the next line is the loop condition:\n // while(uint256(mc < endWord) + cb == 2)\n } eq(add(lt(mc, endMinusWord), cb), 2) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // if any of these checks fails then arrays are not equal\n if iszero(eq(mload(mc), mload(cc))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n\n // Only if still successful\n // For <1 word tail bytes\n if gt(success, 0) {\n // Get the remainder of length/32\n // length % 32 = AND(length, 32 - 1)\n let numTailBytes := and(length, 0x1f)\n let mcRem := mload(mc)\n let ccRem := mload(cc)\n for {\n let i := 0\n // the next line is the loop condition:\n // while(uint256(i < numTailBytes) + cb == 2)\n } eq(add(lt(i, numTailBytes), cb), 2) {\n i := add(i, 1)\n } {\n if iszero(eq(byte(i, mcRem), byte(i, ccRem))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n }\n }\n default {\n // unsuccess:\n success := 0\n }\n }\n\n return success;\n }\n\n function equalStorage(\n bytes storage _preBytes,\n bytes memory _postBytes\n )\n internal\n view\n returns (bool)\n {\n bool success = true;\n\n assembly {\n // we know _preBytes_offset is 0\n let fslot := sload(_preBytes.slot)\n // Decode the length of the stored array like in concatStorage().\n let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)\n let mlength := mload(_postBytes)\n\n // if lengths don't match the arrays are not equal\n switch eq(slength, mlength)\n case 1 {\n // slength can contain both the length and contents of the array\n // if length < 32 bytes so let's prepare for that\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\n if iszero(iszero(slength)) {\n switch lt(slength, 32)\n case 1 {\n // blank the last byte which is the length\n fslot := mul(div(fslot, 0x100), 0x100)\n\n if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\n // unsuccess:\n success := 0\n }\n }\n default {\n // cb is a circuit breaker in the for loop since there's\n // no said feature for inline assembly loops\n // cb = 1 - don't breaker\n // cb = 0 - break\n let cb := 1\n\n // get the keccak hash to get the contents of the array\n mstore(0x0, _preBytes.slot)\n let sc := keccak256(0x0, 0x20)\n\n let mc := add(_postBytes, 0x20)\n let end := add(mc, mlength)\n\n // the next line is the loop condition:\n // while(uint256(mc < end) + cb == 2)\n for {} eq(add(lt(mc, end), cb), 2) {\n sc := add(sc, 1)\n mc := add(mc, 0x20)\n } {\n if iszero(eq(sload(sc), mload(mc))) {\n // unsuccess:\n success := 0\n cb := 0\n }\n }\n }\n }\n }\n default {\n // unsuccess:\n success := 0\n }\n }\n\n return success;\n }\n}\n"
}
},
"settings": {
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 10000
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.